This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: OpenBSD configurations for gcc 3.3.x


Basically, this is the configuration information for most OpenBSD systems
using gcc 3.3.

I believe it would be appropriate, since it's not too intrusive, and it
won't make any OpenBSD system more broken than some of them are.

Right now, OpenBSD-current can run a `make build' on at least i386,
sparc64, powerpc.  We have fixed all the arch-independent tree (a few
patches are pending, awaiting review), most arch-dependent parts.
In our ports tree, over 2500 packages build correctly on i386, there are 
still 35 broken packages, most of them getting fixed.

Other arches like hppa and alpha are still building.
x86-64 builds a viable cross-compiler.

This patch only contains OpenBSD specific configuration fixes, plus the
requisite paraphernalia.

Notes about what's going on:

- OpenBSD switched from libc/libc_ to libc/libc+libpthread  in its 3.3
release. Splitting out openbsd-libpthread.h/openbsd-libc_r.h was done for
that reason. It's either that, or abandon old OpenBSD systems (I wouldn't
actually mind).

- recent OpenBSD systems have non-executable stacks. The trampoline stuff
is needed for C nested functions, and I have used it in the past to
bootstrap Ada on an i386-a.out system (I haven't had time to try it out
on elf yet).

- fixinc.wrap is enough on all OpenBSD systems. Most of the headers are
shared between architectures, in fact.

- the other infrastructure change is the use of the new
builtin_define/builtin_assert.

Config by config:
- update old i386-a.out config.
- new i386-elf config for OpenBSD >=3.4.
- alpha is now elf.  Old ECOFF OpenBSD alpha was never properly working,
was quite buggy, without shared libraries, and is totally unsupported now.
- sparc is now elf as well, has been for a while. Old a.out config is
completely unsupported.
- new hppa configuration has been working for a while in a 2.95 mutant. 
- new sparc64 configuration has been working for >1 year.
- rs6000 is too intrusive, and will only be submitted for -current.

Now would be a good time to tell me if there is anything seriously wrong
with this patch.   Based on people' comments (and some tests still going
on), I'll probably submit an updated patch for approval in a few days...




Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.266.2.19
diff -u -p -c -r1.266.2.19 config.gcc
*** config.gcc	2 Dec 2003 05:33:15 -0000	1.266.2.19
--- config.gcc	12 Jan 2004 23:28:18 -0000
*************** case $machine in
*** 402,408 ****
  	esac
  	;;
  *-*-openbsd*)
! 	tm_file=${cpu_type}/openbsd.h
  	tmake_file="t-libc-ok t-openbsd t-libgcc-pic"
  	xm_defines=POSIX
  	if test x$enable_threads = xyes; then
--- 402,416 ----
  	esac
  	;;
  *-*-openbsd*)
! 	case $machine in
! 	*-*-openbsd2* | *-*-openbsd3.[012])
! 		openbsd_libspec="openbsd-libc_r.h"
! 		;;
! 	*)
! 		openbsd_libspec="openbsd-libpthread.h"
! 		;;
! 	esac
! 	tm_file="${openbsd_libspec} ${cpu_type}/openbsd.h"
  	tmake_file="t-libc-ok t-openbsd t-libgcc-pic"
  	xm_defines=POSIX
  	if test x$enable_threads = xyes; then
*************** alpha*-*-netbsd*)
*** 578,587 ****
  	;;
  
  alpha*-*-openbsd*)
! 	tm_file="${cpu_type}/${cpu_type}.h ${tm_file}"
  	# default x-alpha is only appropriate for dec-osf.
  	target_cpu_default="MASK_GAS"
  	tmake_file="alpha/t-alpha alpha/t-ieee"
  	;;
  
  alpha*-dec-osf[45]*)
--- 586,596 ----
  	;;
  
  alpha*-*-openbsd*)
!  	tm_file="alpha/alpha.h alpha/elf.h alpha/openbsd1.h openbsd.h ${tm_file}"
  	# default x-alpha is only appropriate for dec-osf.
  	target_cpu_default="MASK_GAS"
  	tmake_file="alpha/t-alpha alpha/t-ieee"
+ 	gas=yes gnu_ld=yes
  	;;
  
  alpha*-dec-osf[45]*)
*************** hppa*-*-linux* | parisc*-*-linux*)
*** 818,825 ****
  	tmake_file="t-slibgcc-elf-ver t-linux pa/t-linux"
  	;;
  hppa*-*-openbsd*)
! 	target_cpu_default="MASK_PA_11"
! 	tmake_file=pa/t-bsd
  	;;
  hppa1.1-*-pro*)
  	target_cpu_default="(MASK_JUMP_IN_DELAY | MASK_PORTABLE_RUNTIME | MASK_GAS | MASK_NO_SPACE_REGS | MASK_SOFT_FLOAT)"
--- 827,834 ----
  	tmake_file="t-slibgcc-elf-ver t-linux pa/t-linux"
  	;;
  hppa*-*-openbsd*)
! 	target_cpu_default="MASK_PA_11 | MASK_NO_SPACE_REGS"
! 	tmake_file="t-libc-ok t-openbsd t-openbsd-thread pa/t-openbsd"
  	;;
  hppa1.1-*-pro*)
  	target_cpu_default="(MASK_JUMP_IN_DELAY | MASK_PORTABLE_RUNTIME | MASK_GAS | MASK_NO_SPACE_REGS | MASK_SOFT_FLOAT)"
*************** i[34567]86-*-netbsd*)
*** 1142,1154 ****
  x86_64-*-netbsd*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
  	;;
! i[34567]86-*-openbsd*)
  	tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h ${tm_file}"
  	# needed to unconfuse gdb
  	tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
  	# we need collect2 until our bug is fixed...
  	use_collect2=yes
  	;;
  i[34567]86-*-coff*)
  	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h"
  	;;
--- 1151,1177 ----
  x86_64-*-netbsd*)
  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
  	;;
! i[34567]86-*-openbsd2* | i[34567]86-*-openbsd3.[0123])
  	tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h ${tm_file}"
  	# needed to unconfuse gdb
  	tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
  	# we need collect2 until our bug is fixed...
  	use_collect2=yes
  	;;
+ i[34567]86-*-openbsd*)
+ 	# needed to unconfuse gdb
+ 	tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
+ 	tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h"
+ 	tm_file="${tm_file} exec-stack.h"
+ 	tm_file="${tm_file} openbsd.h openbsd-libpthread.h i386/openbsdelf.h"
+ 	gas=yes
+ 	gnu_ld=yes
+ 	stabs=yes
+   	;;
+ x86_64-*-openbsd*)
+ 	tm_file="i386/biarch64.h i386/i386.h i386/unix.h i386/att.h dbxelf.h elfos.h openbsd.h openbsd-libpthread.h i386/x86-64.h i386/openbsd64.h"
+ 	tmake_file="t-libc-ok t-openbsd i386/t-openbsd"
+ 	;;
  i[34567]86-*-coff*)
  	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h"
  	;;
*************** sparc-*-netbsd*)
*** 2397,2413 ****
  	use_collect2=yes
  	;;
  sparc-*-openbsd*)
! 	tm_file="sparc/sparc.h ${tm_file}"
  	# needed to unconfuse gdb
  	tmake_file="t-libc-ok t-openbsd sparc/t-openbsd"
  	# we need collect2 until our bug is fixed...
  	use_collect2=yes
  	;;
  sparc64-*-openbsd*)
! 	tm_file="sparc/openbsd1-64.h sparc/sparc.h elfos.h svr4.h sparc/sysv4.h sparc/sol2.h sparc/sp64-elf.h openbsd.h sparc/openbsd64.h"
  	xm_file=sparc/xm-sp64.h
  	gas=yes gnu_ld=yes
  	with_cpu=ultrasparc
  	;;
  sparc-*-bsd*)
  	tm_file="${tm_file} sparc/bsd.h"
--- 2420,2438 ----
  	use_collect2=yes
  	;;
  sparc-*-openbsd*)
! 	tm_file="sparc/sparc.h elfos.h svr4.h sparc/sysv4.h ${tm_file}"
  	# needed to unconfuse gdb
  	tmake_file="t-libc-ok t-openbsd sparc/t-openbsd"
  	# we need collect2 until our bug is fixed...
+ 	gas=yes gnu_ld=yes
  	use_collect2=yes
  	;;
  sparc64-*-openbsd*)
! 	tm_file="sparc/openbsd1-64.h sparc/sparc.h elfos.h svr4.h sparc/sysv4.h sparc/sp64-elf.h openbsd.h ${openbsd_libspec} sparc/openbsd64.h"
  	xm_file=sparc/xm-sp64.h
  	gas=yes gnu_ld=yes
  	with_cpu=ultrasparc
+ 	float_format=i128
  	;;
  sparc-*-bsd*)
  	tm_file="${tm_file} sparc/bsd.h"
Index: config/exec-stack.h
===================================================================
RCS file: config/exec-stack.h
diff -N config/exec-stack.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/exec-stack.h	12 Jan 2004 23:28:18 -0000
***************
*** 0 ****
--- 1,40 ----
+ /* Enable stack execute around trampoline address.  
+    Copyright (C) 2002 Free Software Foundation, Inc.
+ 
+ This file is part of GNU CC.
+ 
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ 
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+ #undef FINALIZE_TRAMPOLINE
+ #define FINALIZE_TRAMPOLINE(TRAMP) \
+   emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \
+ 		    0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode)
+ 
+ #undef TRANSFER_FROM_TRAMPOLINE
+ #define TRANSFER_FROM_TRAMPOLINE					\
+ extern void __enable_execute_stack (void *);				\
+ void									\
+ __enable_execute_stack (addr)						\
+      void *addr;							\
+ {									\
+   long size = getpagesize ();						\
+   long mask = ~(size-1);						\
+   char *page = (char *) (((long) addr) & mask); 			\
+   char *end  = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
+ 								      \
+   if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \
+     perror ("mprotect of trampoline code");				\
+ }
Index: config/openbsd-libc_r.h
===================================================================
RCS file: config/openbsd-libc_r.h
diff -N config/openbsd-libc_r.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/openbsd-libc_r.h	12 Jan 2004 23:28:18 -0000
***************
*** 0 ****
--- 1,24 ----
+ /* LIB_SPEC appropriate for OpenBSD.  Select the appropriate libc, 
+    depending on profiling and threads.  Basically,
+    -lc(_r)?(_p)?, select _r for threads, and _p for p or pg.  */
+ /*  Copyright (C) 2004 Free Software Foundation, Inc.
+ 
+ This file is part of GNU CC.
+ 
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ 
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+ #define OBSD_LIB_SPEC "%{!shared:-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}}"
+ 
Index: config/openbsd-libpthread.h
===================================================================
RCS file: config/openbsd-libpthread.h
diff -N config/openbsd-libpthread.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/openbsd-libpthread.h	12 Jan 2004 23:28:18 -0000
***************
*** 0 ****
--- 1,23 ----
+ /* LIB_SPEC appropriate for OpenBSD.  Include -lpthread if -pthread is
+    specified on the command line. */
+ /*   Copyright (C) 2004 Free Software Foundation, Inc.
+ 
+ This file is part of GNU CC.
+ 
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ 
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+ #define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
+ 
Index: config/openbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/openbsd.h,v
retrieving revision 1.15
diff -u -p -c -r1.15 openbsd.h
*** config/openbsd.h	26 Nov 2002 04:54:46 -0000	1.15
--- config/openbsd.h	12 Jan 2004 23:28:19 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 52,71 ****
  
  #ifdef OPENBSD_NATIVE
  
- #undef GCC_INCLUDE_DIR
- #define GCC_INCLUDE_DIR "/usr/include"
- 
  /* The compiler is configured with ONLY the gcc/g++ standard headers.  */
  #undef INCLUDE_DEFAULTS
  #define INCLUDE_DEFAULTS			\
    {						\
      { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },	\
!     { GCC_INCLUDE_DIR, "GCC", 0, 0 },		\
      { 0, 0, 0, 0 }				\
    }
  
  /* Under OpenBSD, the normal location of the various *crt*.o files is the
     /usr/lib directory.  */
  #define STANDARD_STARTFILE_PREFIX	"/usr/lib/"
  
  #endif
--- 52,71 ----
  
  #ifdef OPENBSD_NATIVE
  
  /* The compiler is configured with ONLY the gcc/g++ standard headers.  */
  #undef INCLUDE_DEFAULTS
  #define INCLUDE_DEFAULTS			\
    {						\
      { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },	\
!     { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1 },\
!     { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1 }, \
!     { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 },	\
      { 0, 0, 0, 0 }				\
    }
  
  /* Under OpenBSD, the normal location of the various *crt*.o files is the
     /usr/lib directory.  */
+ #undef STANDARD_STARTFILE_PREFIX
  #define STANDARD_STARTFILE_PREFIX	"/usr/lib/"
  
  #endif
*************** Boston, MA 02111-1307, USA.  */
*** 73,80 ****
  
  /* Controlling the compilation driver.  */
  
  /* CPP_SPEC appropriate for OpenBSD. We deal with -posix and -pthread.
!    XXX the way threads are handling currently is not very satisfying,
     since all code must be compiled with -pthread to work. 
     This two-stage defines makes it easy to pick that for targets that
     have subspecs.  */
--- 73,111 ----
  
  /* Controlling the compilation driver.  */
  
+ /* TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets.  */
+ #define OPENBSD_OS_CPP_BUILTINS_COMMON()	\
+   do						\
+     {						\
+       builtin_define ("__OpenBSD__");		\
+       builtin_define ("__unix__");		\
+       builtin_define ("__ANSI_COMPAT");		\
+       builtin_assert ("system=unix");		\
+       builtin_assert ("system=bsd");		\
+       builtin_assert ("system=OpenBSD");	\
+     }						\
+   while (0)
+ 
+ /* TARGET_OS_CPP_BUILTINS() common to all OpenBSD ELF targets.  */
+ #define OPENBSD_OS_CPP_BUILTINS_ELF()		\
+   do						\
+     {						\
+       OPENBSD_OS_CPP_BUILTINS_COMMON();		\
+       builtin_define ("__ELF__");		\
+     }						\
+   while (0)
+ 
+ /* TARGET_OS_CPP_BUILTINS() common to all LP64 OpenBSD targets.  */
+ #define OPENBSD_OS_CPP_BUILTINS_LP64()		\
+   do						\
+     {						\
+       builtin_define ("_LP64");			\
+       builtin_define ("__LP64__");		\
+     }						\
+   while (0)
+ 
  /* CPP_SPEC appropriate for OpenBSD. We deal with -posix and -pthread.
!    XXX the way threads are handled currently is not very satisfying,
     since all code must be compiled with -pthread to work. 
     This two-stage defines makes it easy to pick that for targets that
     have subspecs.  */
*************** Boston, MA 02111-1307, USA.  */
*** 84,94 ****
  #define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
  #endif
  
- /* LIB_SPEC appropriate for OpenBSD.  Select the appropriate libc, 
-    depending on profiling and threads.  Basically, 
-    -lc(_r)?(_p)?, select _r for threads, and _p for p or pg.  */
- #define OBSD_LIB_SPEC "%{!shared:-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}}"
- 
  #ifndef OBSD_HAS_CORRECT_SPECS
  
  #ifndef OBSD_NO_DYNAMIC_LIBRARIES
--- 115,120 ----
*************** do {									 \
*** 288,291 ****
     work.  On the other hand, we don't define HANDLE_PRAGMA_WEAK directly,
     as this depends on a few other details as well...  */
  #define HANDLE_SYSV_PRAGMA 1
- 
--- 314,316 ----
Index: config/alpha/openbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/openbsd.h,v
retrieving revision 1.6
diff -u -p -c -r1.6 openbsd.h
*** config/alpha/openbsd.h	13 May 2002 05:57:38 -0000	1.6
--- config/alpha/openbsd.h	12 Jan 2004 23:28:19 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 21,50 ****
  /* We settle for little endian for now.  */
  #define TARGET_ENDIAN_DEFAULT 0
  
- #define OBSD_NO_DYNAMIC_LIBRARIES
- #define OBSD_HAS_DECLARE_FUNCTION_NAME
- #define OBSD_HAS_DECLARE_FUNCTION_SIZE
- #define OBSD_HAS_DECLARE_OBJECT
- 
- /* alpha ecoff supports only weak aliases, see below.  */
- #define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS (FILE,NAME,0)
- 
- #include <openbsd.h>
- 
  /* Controlling the compilation driver.  */
  
  /* alpha needs __start.  */
  #undef LINK_SPEC
  #define LINK_SPEC \
!   "%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{assert*}"
  
  /* run-time target specifications */
  #define TARGET_OS_CPP_BUILTINS()		\
      do {					\
! 	builtin_define ("__OpenBSD__");		\
! 	builtin_define ("__ANSI_COMPAT");	\
! 	builtin_define ("__unix__");		\
! 	builtin_assert ("system=unix");		\
      } while (0)
  
  /* Layout of source language data types.  */
--- 21,51 ----
  /* We settle for little endian for now.  */
  #define TARGET_ENDIAN_DEFAULT 0
  
  /* Controlling the compilation driver.  */
  
  /* alpha needs __start.  */
  #undef LINK_SPEC
  #define LINK_SPEC \
!   "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
!    %{shared:-shared} %{R*} \
!    %{static:-Bstatic} \
!    %{!static:-Bdynamic} \
!    %{assert*} \
!    %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
! 
! /* As an elf system, we need crtbegin/crtend stuff.  */
! #undef STARTFILE_SPEC
! #define STARTFILE_SPEC "\
! 	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
! 	crtbegin%O%s} %{shared:crtbeginS%O%s}"
! #undef ENDFILE_SPEC
! #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
  
  /* run-time target specifications */
  #define TARGET_OS_CPP_BUILTINS()		\
      do {					\
! 	OPENBSD_OS_CPP_BUILTINS_ELF();		\
! 	OPENBSD_OS_CPP_BUILTINS_LP64();		\
      } while (0)
  
  /* Layout of source language data types.  */
*************** Boston, MA 02111-1307, USA.  */
*** 63,129 ****
  #define WCHAR_TYPE_SIZE 32
  
  
! #undef PREFERRED_DEBUGGING_TYPE
! #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
  
  #define LOCAL_LABEL_PREFIX	"."
  
! /* We don't have an init section yet.  */
! #undef HAS_INIT_SECTION
! 
! /* collect2 support (assembler format: macros for initialization).  */
! 
! /* Don't tell collect2 we use COFF as we don't have (yet ?) a dynamic ld
!    library with the proper functions to handle this -> collect2 will
!    default to using nm.  */
! #undef OBJECT_FORMAT_COFF
! #undef EXTENDED_COFF
! 
! /* Assembler format: exception region output.  */
! 
! /* All configurations that don't use elf must be explicit about not using
!    dwarf unwind information. egcs doesn't try too hard to check internal
!    configuration files...  */
! #ifdef INCOMING_RETURN_ADDR_RTX
! #undef DWARF2_UNWIND_INFO
! #define DWARF2_UNWIND_INFO 0
! #endif
! 
! /* Assembler format: file framework.  */
! 
! /* Taken from alpha/osf.h. This used to be common to all alpha
!    configurations, but elf has departed from it.
!    Check alpha/alpha.h, alpha/osf.h for it when egcs is upgraded.  */
! #ifndef ASM_FILE_START
! #define ASM_FILE_START(FILE)					\
! {								\
!   alpha_write_verstamp (FILE);					\
!   fprintf (FILE, "\t.set noreorder\n");				\
!   fprintf (FILE, "\t.set volatile\n");                          \
!   fprintf (FILE, "\t.set noat\n");				\
!   if (TARGET_SUPPORT_ARCH)					\
!     fprintf (FILE, "\t.arch %s\n",				\
!              TARGET_CPU_EV6 ? "ev6"				\
! 	     : (TARGET_CPU_EV5					\
! 		? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \
! 		: "ev4"));					\
! 								\
!   ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename);	\
! }
! #endif
! 
! /* Assembler format: label output.  */
! 
! #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE)	\
!  do {						\
!   fputs ("\t.weakext\t", FILE);			\
!   assemble_name (FILE, NAME);			\
!   if (VALUE)					\
!     {						\
!       fputs (" , ", FILE);			\
!       assemble_name (FILE, VALUE);		\
!     }						\
!   fputc ('\n', FILE);				\
!  } while (0)
! 
  
--- 64,85 ----
  #define WCHAR_TYPE_SIZE 32
  
  
! /* #undef PREFERRED_DEBUGGING_TYPE */
! /* #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG */
  
+ /* Output and generation of labels.  */
  #define LOCAL_LABEL_PREFIX	"."
  
! /* .set on alpha is not used to output labels.  */
! #undef SET_ASM_OP
  
+ /* So, provide corresponding default, without the .set.  */
+ #undef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
+ #define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO)     \
+  do {                                                                   \
+   assemble_name (FILE, SY);                                             \
+   fputc ('=', FILE);                                                    \
+   assemble_name (FILE, HI);                                             \
+   fputc ('-', FILE);                                                    \
+   assemble_name (FILE, LO);                                             \
+   } while (0)
Index: config/alpha/openbsd1.h
===================================================================
RCS file: config/alpha/openbsd1.h
diff -N config/alpha/openbsd1.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/alpha/openbsd1.h	12 Jan 2004 23:28:19 -0000
***************
*** 0 ****
--- 1,23 ----
+ /* Configuration fragment for an alpha OpenBSD target.
+    Copyright (C) 1999 Free Software Foundation, Inc.
+ 
+ This file is part of GNU CC.
+ 
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ 
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+ #define OBSD_HAS_DECLARE_FUNCTION_NAME
+ #define OBSD_HAS_DECLARE_FUNCTION_SIZE
+ #define OBSD_HAS_DECLARE_OBJECT
Index: config/i386/openbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/openbsd.h,v
retrieving revision 1.18
diff -u -p -c -r1.18 openbsd.h
*** config/i386/openbsd.h	20 Oct 2002 22:37:10 -0000	1.18
--- config/i386/openbsd.h	12 Jan 2004 23:28:19 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 29,39 ****
  #define TARGET_OS_CPP_BUILTINS()		\
    do						\
      {						\
! 	builtin_define ("__unix__");		\
! 	builtin_define ("__OpenBSD__");		\
! 	builtin_assert ("system=unix");		\
! 	builtin_assert ("system=bsd");		\
! 	builtin_assert ("system=OpenBSD");	\
      }						\
    while (0)
  
--- 29,35 ----
  #define TARGET_OS_CPP_BUILTINS()		\
    do						\
      {						\
!     	OPENBSD_OS_CPP_BUILTINS_COMMON();	\
      }						\
    while (0)
  
*************** Boston, MA 02111-1307, USA.  */
*** 101,103 ****
--- 97,115 ----
  
  /* OpenBSD gas currently does not support quad, so do not use it.  */
  #undef ASM_QUAD
+ 
+ #define TRANSFER_FROM_TRAMPOLINE					\
+ extern void __enable_execute_stack (void *);				\
+ void									\
+ __enable_execute_stack (addr)						\
+      void *addr;							\
+ {									\
+   long size = getpagesize ();						\
+   long mask = ~(size-1);						\
+   char *page = (char *) (((long) addr) & mask); 			\
+   char *end  = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
+ 								      \
+   /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ 			\
+   if (mprotect (page, end - page, 7) < 0)				\
+     perror ("mprotect of trampoline code");				\
+ }
Index: config/i386/openbsd64.h
===================================================================
RCS file: config/i386/openbsd64.h
diff -N config/i386/openbsd64.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/i386/openbsd64.h	12 Jan 2004 23:28:19 -0000
***************
*** 0 ****
--- 1,123 ----
+ /* Configuration for an OpenBSD x86-64 target.
+    
+    Copyright (C) 2003 Free Software Foundation, Inc.
+ 
+ This file is part of GNU CC.
+ 
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ 
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+ #undef TARGET_VERSION
+ #define TARGET_VERSION fprintf (stderr, " (OpenBSD/x86-64 ELF)")
+ 
+ /* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
+    libraries compiled with the native cc, so undef it. */
+ #undef NO_DOLLAR_IN_LABEL
+ 
+ /* Override the default comment-starter of "/".  */
+ #undef ASM_COMMENT_START
+ #define ASM_COMMENT_START "#"
+ 
+ /* Run-time target specifications */
+ 
+ #define TARGET_OS_CPP_BUILTINS()		\
+   do						\
+     {						\
+     	OPENBSD_OS_CPP_BUILTINS_ELF();		\
+ 	OPENBSD_OS_CPP_BUILTINS_LP64();		\
+ 	builtin_define ("__unix__");		\
+ 	builtin_assert ("system=bsd");		\
+     }						\
+   while (0)
+ 
+ /* As an elf system, we need crtbegin/crtend stuff.  */
+ #undef STARTFILE_SPEC
+ #define STARTFILE_SPEC "\
+ 	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
+ 	crtbegin%O%s} %{shared:crtbeginS%O%s}"
+ #undef ENDFILE_SPEC
+ #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+ 
+ /* Layout of source language data types.  */
+ 
+ /* This must agree with <machine/ansi.h> */
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "long unsigned int"
+ 
+ #undef PTRDIFF_TYPE
+ #define PTRDIFF_TYPE "long int"
+ 
+ #undef WCHAR_TYPE
+ #define WCHAR_TYPE "int"
+ 
+ #undef WCHAR_TYPE_SIZE
+ #define WCHAR_TYPE_SIZE 32
+ 
+ /* Assembler format: overall framework.  */
+ 
+ #undef ASM_APP_ON
+ #define ASM_APP_ON "#APP\n"
+ 
+ #undef ASM_APP_OFF
+ #define ASM_APP_OFF "#NO_APP\n"
+ 
+ #undef SET_ASM_OP
+ #define SET_ASM_OP	"\t.set\t"
+ 
+ /* The following macros were originally stolen from i386v4.h.
+    These have to be defined to get PIC code correct.  */
+ 
+ /* Assembler format: dispatch tables.  */
+ 
+ /* Assembler format: sections.  */
+ 
+ /* Stack & calling: aggregate returns.  */
+ 
+ /* Don't default to pcc-struct-return, because gcc is the only compiler, and
+    we want to retain compatibility with older gcc versions.  */
+ #define DEFAULT_PCC_STRUCT_RETURN 0
+ 
+ /* Assembler format: alignment output.  */
+ 
+ /* Stack & calling: profiling.  */
+ 
+ /* OpenBSD's profiler recovers all information from the stack pointer.
+    The icky part is not here, but in machine/profile.h.  */
+ #undef FUNCTION_PROFILER
+ #define FUNCTION_PROFILER(FILE, LABELNO)  \
+   fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
+ 
+ /* Assembler format: exception region output.  */
+ 
+ /* Assembler format: alignment output.  */
+ 
+ /* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
+ 
+ /* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h.  */
+ 
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+   "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
+    %{shared:-shared} %{R*} \
+    %{static:-Bstatic} \
+    %{!static:-Bdynamic} \
+    %{assert*} \
+    %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
+ 
+ #define OBSD_HAS_CORRECT_SPECS
+ 
+ /* pick up defines for mprotect (used in TRANSFER_FROM_TRANPOLINE) */
+ #include <sys/types.h>
+ #include <sys/mman.h>
Index: config/i386/openbsdelf.h
===================================================================
RCS file: config/i386/openbsdelf.h
diff -N config/i386/openbsdelf.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/i386/openbsdelf.h	12 Jan 2004 23:28:19 -0000
***************
*** 0 ****
--- 1,134 ----
+ /* Configuration for an OpenBSD i386 target.
+    
+    Copyright (C) 1999 Free Software Foundation, Inc.
+ 
+ This file is part of GNU CC.
+ 
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ 
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+ /* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
+    libraries compiled with the native cc, so undef it. */
+ #undef NO_DOLLAR_IN_LABEL
+ 
+ /* Override the default comment-starter of "/".  */
+ #undef ASM_COMMENT_START
+ #define ASM_COMMENT_START "#"
+ 
+ 
+ /* This goes away when the math-emulator is fixed */
+ #undef TARGET_DEFAULT
+ #define TARGET_DEFAULT \
+   (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
+ 
+ /* Run-time target specifications */
+ 
+ #define TARGET_OS_CPP_BUILTINS()		\
+   do						\
+     {						\
+     	OPENBSD_OS_CPP_BUILTINS_ELF();		\
+     }						\
+   while (0)
+ 
+ /* As an elf system, we need crtbegin/crtend stuff.  */
+ #undef STARTFILE_SPEC
+ #define STARTFILE_SPEC "\
+ 	%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
+ 	crtbegin%O%s} %{shared:crtbeginS%O%s}"
+ #undef ENDFILE_SPEC
+ #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+ 
+ /* Layout of source language data types.  */
+ 
+ /* This must agree with <machine/ansi.h> */
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "unsigned int"
+ 
+ #undef PTRDIFF_TYPE
+ #define PTRDIFF_TYPE "int"
+ 
+ #undef WCHAR_TYPE
+ #define WCHAR_TYPE "int"
+ 
+ #undef WCHAR_TYPE_SIZE
+ #define WCHAR_TYPE_SIZE BITS_PER_WORD
+ 
+ /* Assembler format: overall framework.  */
+ 
+ #undef ASM_APP_ON
+ #define ASM_APP_ON "#APP\n"
+ 
+ #undef ASM_APP_OFF
+ #define ASM_APP_OFF "#NO_APP\n"
+ 
+ #undef SET_ASM_OP
+ #define SET_ASM_OP	"\t.set\t"
+ 
+ /* The following macros were originally stolen from i386v4.h.
+    These have to be defined to get PIC code correct.  */
+ 
+ /* Assembler format: dispatch tables.  */
+ 
+ /* Assembler format: sections.  */
+ 
+ /* Stack & calling: aggregate returns.  */
+ 
+ /* Don't default to pcc-struct-return, because gcc is the only compiler, and
+    we want to retain compatibility with older gcc versions.  */
+ #define DEFAULT_PCC_STRUCT_RETURN 0
+ 
+ /* Assembler format: alignment output.  */
+ 
+ #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
+ #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
+   if ((LOG) != 0) {\
+     if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
+     else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
+   }
+ #endif
+ 
+ /* Stack & calling: profiling.  */
+ 
+ /* OpenBSD's profiler recovers all information from the stack pointer.
+    The icky part is not here, but in machine/profile.h.  */
+ #undef FUNCTION_PROFILER
+ #define FUNCTION_PROFILER(FILE, LABELNO)  \
+   fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
+ 
+ /* Assembler format: exception region output.  */
+ 
+ /* our configuration still doesn't handle dwarf2 correctly */
+ #define DWARF2_UNWIND_INFO 0
+ 
+ /* Assembler format: alignment output.  */
+ 
+ /* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
+ 
+ /* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h.  */
+ 
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+   "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
+    %{shared:-shared} %{R*} \
+    %{static:-Bstatic} \
+    %{!static:-Bdynamic} \
+    %{assert*} \
+    %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
+ 
+ #define OBSD_HAS_CORRECT_SPECS
+ 
+ /* pick up defines for mprotect (used in TRANSFER_FROM_TRANPOLINE) */
+ #include <sys/types.h>
+ #include <sys/mman.h>
Index: config/pa/openbsd.h
===================================================================
RCS file: config/pa/openbsd.h
diff -N config/pa/openbsd.h
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/pa/openbsd.h	12 Jan 2004 23:28:19 -0000
***************
*** 0 ****
--- 1,196 ----
+ /* Configuration file for an hppa risc OpenBSD target.
+    Copyright (C) 1999 Free Software Foundation, Inc.
+ 
+ This file is part of GNU CC.
+ 
+ GNU CC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+ 
+ GNU CC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GNU CC; see the file COPYING.  If not, write to
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+ 
+ #include <pa/pa.h>
+ #include <pa/pa32-regs.h>
+ #define OBSD_HAS_DECLARE_FUNCTION_NAME
+ #include <openbsd.h>
+ 
+ /* Turn off various SOM crap we don't want.  */
+ #undef TARGET_ELF32
+ #define TARGET_ELF32 1
+ 
+ #undef MAX_OFILE_ALIGNMENT
+ #define	MAX_OFILE_ALIGNMENT 0x8000
+ 
+ /* Run-time target specifications. */
+ #undef TARGET_OS_CPP_BUILTINS
+ #define TARGET_OS_CPP_BUILTINS()		\
+   do						\
+     {						\
+ 	OPENBSD_OS_CPP_BUILTINS_ELF();		\
+     }						\
+   while (0)
+ 
+ 
+ #undef OVERRIDE_OPTIONS
+ #define OVERRIDE_OPTIONS						 \
+ {							                 \
+     override_options ();				                 \
+     if (! flag_pic)						         \
+         target_flags |= MASK_PORTABLE_RUNTIME | MASK_FAST_INDIRECT_CALLS;\
+ }
+ 	
+ /* XXX Why doesn't PA support -R  like everyone ??? */
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+   "%{EB} %{EL} %{shared} %{non_shared} \
+    %{call_shared} %{no_archive} %{exact_version} \
+    %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \
+    %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \
+    %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \
+    %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}"
+ 
+ /* Layout of source language data types. */
+ 
+ /* This must agree with <machine/ansi.h> */
+ #undef SIZE_TYPE
+ #define SIZE_TYPE "unsigned int"
+ 
+ #undef PTRDIFF_TYPE
+ #define PTRDIFF_TYPE "int"
+ 
+ #undef WCHAR_TYPE
+ #define WCHAR_TYPE "int"
+ 
+ #undef WCHAR_TYPE_SIZE
+ #define WCHAR_TYPE_SIZE 32
+ 
+ /* Output at beginning of assembler file.  */
+ /* This is slightly changed from main pa.h to only output dyncall
+    when compiling PIC. */
+ #undef ASM_FILE_START
+ #define ASM_FILE_START(FILE) \
+ do { \
+      if (write_symbols != NO_DEBUG) \
+        output_file_directive ((FILE), main_input_filename); \
+      if (TARGET_64BIT) \
+        fputs("\t.LEVEL 2.0w\n", FILE); \
+      else if (TARGET_PA_20) \
+        fputs("\t.LEVEL 2.0\n", FILE); \
+      else if (TARGET_PA_11) \
+        fputs("\t.LEVEL 1.1\n", FILE); \
+      else \
+        fputs("\t.LEVEL 1.0\n", FILE); \
+      if (flag_pic || !TARGET_FAST_INDIRECT_CALLS) \
+        fputs ("\t.IMPORT $$dyncall, MILLICODE\n", FILE); \
+      if (profile_flag) \
+        fputs ("\t.IMPORT _mcount, CODE\n", FILE); \
+    } while (0)
+ 
+ #undef ASM_OUTPUT_FUNCTION_PREFIX
+ 
+ /* We want local labels to start with period if made with asm_fprintf.  */
+ #undef LOCAL_LABEL_PREFIX
+ #define LOCAL_LABEL_PREFIX "."
+ 
+ /* Use the default.  */
+ #undef ASM_OUTPUT_LABEL
+ 
+ /* Define these to generate the Linux/ELF/SysV style of internal
+    labels all the time - i.e. to be compatible with
+    ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
+    ones in pa.h and note the lack of dollar signs in these.  FIXME:
+    shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
+ 
+ #undef ASM_OUTPUT_ADDR_VEC_ELT
+ #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
+   if (TARGET_BIG_SWITCH)					\
+     fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldil LR'.L%d,%%r1\n\tbe RR'.L%d(%%sr4,%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE, VALUE);		\
+   else								\
+     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
+ #undef ASM_OUTPUT_ADDR_DIFF_ELT
+ #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+   if (TARGET_BIG_SWITCH)					\
+     fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldw T'.L%d(%%r19),%%r1\n\tbv %%r0(%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE);				\
+   else								\
+     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
+ 
+ #undef STRING_ASM_OP
+ #define STRING_ASM_OP   ".stringz"
+ 
+ #undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
+ 
+ #undef ASM_OUTPUT_SECTION_NAME
+ /* Switch into a generic section.
+    This is currently only used to support section attributes.
+ 
+    We make the section read-only and executable for a function decl,
+    read-only for a const data decl, and writable for a non-const data decl.  */
+ #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
+ 	fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n", NAME, \
+ 	  (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
+ 	  (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw")
+ 
+ /* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
+    labels in a function declaration (since pa.c seems determined to do
+    it differently)  */
+ 
+ #undef ASM_DECLARE_FUNCTION_NAME
+ #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
+   do								\
+     {								\
+       if (TREE_PUBLIC (DECL))					\
+       {								\
+ 	fputs ("\t.export ", FILE);				\
+ 	assemble_name (FILE, NAME);				\
+ 	fputs (", entry\n", FILE);				\
+       }								\
+       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");	\
+       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));		\
+     }								\
+   while (0)
+ 
+ /* As well as globalizing the label, we need to encode the label
+    to ensure a plabel is generated in an indirect call.  */
+ #undef ASM_OUTPUT_EXTERNAL_LIBCALL
+ #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)			\
+   do								\
+     {								\
+       if (!FUNCTION_NAME_P (XSTR (FUN, 0)))			\
+         hppa_encode_label (FUN);				\
+       (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0));	\
+     }								\
+   while (0)
+ 
+ /* As an elf system, we need crtbegin/crtend stuff.  */
+ #undef STARTFILE_SPEC
+ #define STARTFILE_SPEC "%{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} crtbegin%O%s} %{shared:crtbeginS%O%s}"
+ #undef ENDFILE_SPEC
+ #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+ 
+ #undef TEXT_SECTION_ASM_OP
+ #define TEXT_SECTION_ASM_OP "\t.text"
+ #undef READONLY_DATA_SECTION_ASM_OP
+ #define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata"
+ #undef DATA_SECTION_ASM_OP
+ #define DATA_SECTION_ASM_OP "\t.data"
+ #undef BSS_SECTION_ASM_OP
+ #define BSS_SECTION_ASM_OP "\t.section\t.bss"
+ #define CTORS_SECTION_ASM_OP    "\t.section\t.ctors,\"aw\""
+ #define DTORS_SECTION_ASM_OP    "\t.section\t.dtors,\"aw\""
+ 
+ /* Remove hpux specific pa defines. */
+ #undef LDD_SUFFIX
+ #undef PARSE_LDD_OUTPUT
+ 
+ #undef DO_GLOBAL_DTORS_BODY
+ #define	HAS_INIT_SECTION
Index: config/pa/t-openbsd
===================================================================
RCS file: config/pa/t-openbsd
diff -N config/pa/t-openbsd
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- config/pa/t-openbsd	12 Jan 2004 23:28:19 -0000
***************
*** 0 ****
--- 1,17 ----
+ #Plug millicode routines into libgcc.a  We want these on both native and
+ #cross compiles.  We use the "64-bit" routines because the "32-bit" code
+ #is broken for certain corner cases.
+ 
+ LIB1ASMFUNCS = _divI _divU _remI _remU _div_const _mulI _dyncall
+ LIB1ASMSRC = pa/milli64.S
+ 
+ # Compile libgcc2.a as PIC.
+ TARGET_LIBGCC2_CFLAGS = -DELF=1 -DLINUX
+ 
+ # Don't build a shared libgcc_s.so.  Our libgcc contains millicode, and
+ # the ABI (linker and dynamic linker really) does not allow millicode
+ # to be exported from shared libraries.  Consequently, to successfully
+ # link against libgcc_s.so it is necessary to link against _both_
+ # libgcc_s.so and libgcc.a.  This is a pain.  It's easier just to disable
+ # the shared libgcc.
+ SHLIB_LINK =
Index: config/sparc/openbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/openbsd.h,v
retrieving revision 1.8
diff -u -p -c -r1.8 openbsd.h
*** config/sparc/openbsd.h	20 Oct 2002 22:37:13 -0000	1.8
--- config/sparc/openbsd.h	12 Jan 2004 23:28:19 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 23,29 ****
  #include <openbsd.h>
  
  /* Run-time target specifications.  */
! #define CPP_PREDEFINES "-D__unix__ -D__sparc__ -D__OpenBSD__ -Asystem=unix -Asystem=OpenBSD -Acpu=sparc -Amachine=sparc"
  
  /* Layout of source language data types */
  
--- 23,36 ----
  #include <openbsd.h>
  
  /* Run-time target specifications.  */
! #define TARGET_OS_CPP_BUILTINS()			\
!   do							\
!     {							\
!       OPENBSD_OS_CPP_BUILTINS_ELF();			\
!       builtin_define ("__sparc");			\
!       builtin_define ("__sparc__");			\
!     }							\
!   while (0)
  
  /* Layout of source language data types */
  
Index: config/sparc/openbsd64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/openbsd64.h,v
retrieving revision 1.1
diff -u -p -c -r1.1 openbsd64.h
*** config/sparc/openbsd64.h	30 May 2002 20:35:58 -0000	1.1
--- config/sparc/openbsd64.h	12 Jan 2004 23:28:21 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 31,38 ****
  #define SPARC_DEFAULT_CMODEL CM_MEDMID
  
  /* Run-time target specifications.  */
! #undef CPP_PREDEFINES
! #define CPP_PREDEFINES "-D__unix__ -D__sparc__ -D__sparc64__ -D__sparcv9__ -D__sparc_v9__ -D__arch64__ -D__ELF__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(sparc) -Amachine(sparc)"
  
  #undef CPP_SUBTARGET_SPEC
  #define CPP_SUBTARGET_SPEC ""
--- 31,49 ----
  #define SPARC_DEFAULT_CMODEL CM_MEDMID
  
  /* Run-time target specifications.  */
! #define TARGET_OS_CPP_BUILTINS()			\
!   do							\
!     {							\
!       OPENBSD_OS_CPP_BUILTINS_ELF();			\
!       OPENBSD_OS_CPP_BUILTINS_LP64();			\
!       builtin_define ("__sparc64__");			\
!       builtin_define ("__sparc_v9__");			\
!       builtin_define ("__sparcv9__");			\
!       builtin_define ("__arch64__");			\
!       builtin_define ("__sparc");			\
!       builtin_define ("__sparc__");			\
!     }							\
!   while (0)
  
  #undef CPP_SUBTARGET_SPEC
  #define CPP_SUBTARGET_SPEC ""
*************** Boston, MA 02111-1307, USA.  */
*** 57,62 ****
--- 68,81 ----
  #undef LONG_DOUBLE_TYPE_SIZE
  #define LONG_DOUBLE_TYPE_SIZE 128
  
+ #undef	WINT_TYPE
+ #define	WINT_TYPE "long int"
+ 
+ #undef	WINT_TYPE_SIZE
+ #define	WINT_TYPE_SIZE 32
+ 
+ #define HANDLE_PRAGMA_REDEFINE_EXTNAME 1
+ 
  #undef LINK_SPEC
  #define LINK_SPEC \
    "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
*************** Boston, MA 02111-1307, USA.  */
*** 73,75 ****
--- 92,237 ----
          crtbegin%O%s} %{shared:crtbeginS%O%s}"
  #undef ENDFILE_SPEC
  #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+ 
+ #undef ASM_CPU_DEFAULT_SPEC
+ #define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa"
+ 
+ #undef ASM_CPU_SPEC
+ #define ASM_CPU_SPEC "\
+ %{mcpu=v8plus:-xarch=v8plus} \
+ %{mcpu=ultrasparc:-xarch=v8plusa} \
+ %{!mcpu*:%(asm_cpu_default)} \
+ "
+ 
+ /* Same as sparc.h */
+ #undef DBX_REGISTER_NUMBER
+ #define DBX_REGISTER_NUMBER(REGNO) \
+   (TARGET_FLAT && (REGNO) == HARD_FRAME_POINTER_REGNUM ? 31 : REGNO)
+ 
+ /* We use stabs-in-elf by default, because that is what the native
+    toolchain uses.  */
+ #undef PREFERRED_DEBUGGING_TYPE
+ #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+ 
+ /* The Solaris 2 assembler uses .skip, not .zero, so put this back.  */
+ #undef ASM_OUTPUT_SKIP
+ #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
+   fprintf (FILE, "\t.skip %u\n", (SIZE))
+ 
+ #undef  LOCAL_LABEL_PREFIX
+ #define LOCAL_LABEL_PREFIX  "."
+ 
+ /* This is how to output a definition of an internal numbered label where
+    PREFIX is the class of label and NUM is the number within the class.  */
+ 
+ #undef  ASM_OUTPUT_INTERNAL_LABEL
+ #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)	\
+   fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
+ 
+ /* This is how to output a reference to an internal numbered label where
+    PREFIX is the class of label and NUM is the number within the class.  */
+ 
+ #undef  ASM_OUTPUT_INTERNAL_LABELREF
+ #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM)	\
+   fprintf (FILE, ".L%s%d", PREFIX, NUM)
+ 
+ /* This is how to store into the string LABEL
+    the symbol_ref name of an internal numbered label where
+    PREFIX is the class of label and NUM is the number within the class.
+    This is suitable for output with `assemble_name'.  */
+ 
+ #undef  ASM_GENERATE_INTERNAL_LABEL
+ #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
+   sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
+ 
+ /* Select a format to encode pointers in exception handling data.  CODE
+    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
+    true if the symbol may be affected by dynamic relocations.
+ 
+    Some Solaris dynamic linkers don't handle unaligned section relative
+    relocs properly, so force them to be aligned.  */
+ #ifndef HAVE_AS_SPARC_UA_PCREL
+ #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)		\
+   ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
+ #endif
+ 
+ /* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h.
+    Instead, it is enabled here, because it does work under Solaris.  */
+ /* Define for support of TFmode long double and REAL_ARITHMETIC.
+    Sparc ABI says that long double is 4 words.  */
+ #define LONG_DOUBLE_TYPE_SIZE 128
+ 
+ /* But indicate that it isn't supported by the hardware.  */
+ #define WIDEST_HARDWARE_FP_SIZE 64
+ 
+ #define STDC_0_IN_SYSTEM_HEADERS 1
+ 
+ #define MULDI3_LIBCALL "__mul64"
+ #define DIVDI3_LIBCALL "__div64"
+ #define UDIVDI3_LIBCALL "__udiv64"
+ #define MODDI3_LIBCALL "__rem64"
+ #define UMODDI3_LIBCALL "__urem64"
+ 
+ #undef INIT_SUBTARGET_OPTABS
+ #define INIT_SUBTARGET_OPTABS						\
+   fixsfdi_libfunc							\
+     = init_one_libfunc (TARGET_ARCH64 ? "__ftol" : "__ftoll");		\
+   fixunssfdi_libfunc							\
+     = init_one_libfunc (TARGET_ARCH64 ? "__ftoul" : "__ftoull");	\
+   fixdfdi_libfunc							\
+     = init_one_libfunc (TARGET_ARCH64 ? "__dtol" : "__dtoll");		\
+   fixunsdfdi_libfunc							\
+     = init_one_libfunc (TARGET_ARCH64 ? "__dtoul" : "__dtoull")
+ 
+ 
+ /*
+  * Attempt to turn on access permissions for the stack.
+  *
+  * This code must be defined when compiling gcc but not when compiling
+  * libgcc2.a, unless we're generating code for 64 bits SPARC
+  *
+  * _SC_STACK_PROT is only defined for post 2.6, but we want this code
+  * to run always.  2.6 can change the stack protection but has no way to
+  * query it.
+  *
+  */
+ 
+ /* This declares mprotect (used in TRANSFER_FROM_TRAMPOLINE) for
+    libgcc2.c.  */
+ /* We don't want to include this because sys/mman.h is not present on
+    some non-Solaris configurations that use sol2.h.  */
+ #if 0 /* def L_trampoline */
+ #include <sys/mman.h>
+ #endif
+ 
+ #define TRANSFER_FROM_TRAMPOLINE					\
+ static int need_enable_exec_stack;					\
+ 									\
+ static void check_enabling(void) __attribute__ ((constructor));		\
+ static void check_enabling(void)					\
+ {									\
+   extern long sysconf(int);						\
+ 									\
+   int prot = (int) sysconf(515 /*_SC_STACK_PROT */);			\
+   if (prot != 7)							\
+     need_enable_exec_stack = 1;						\
+ }									\
+ 									\
+ extern void __enable_execute_stack (void *);				\
+ void									\
+ __enable_execute_stack (addr)						\
+      void *addr;							\
+ {									\
+   if (!need_enable_exec_stack)						\
+     return;								\
+   else {								\
+     long size = getpagesize ();						\
+     long mask = ~(size-1);						\
+     char *page = (char *) (((long) addr) & mask); 			\
+     char *end  = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
+ 									\
+     /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ 			\
+     if (mprotect (page, end - page, 7) < 0)				\
+       perror ("mprotect of trampoline code");				\
+   }									\
+ }
Index: fixinc/mkfixinc.sh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/mkfixinc.sh,v
retrieving revision 1.42.2.1
diff -u -p -c -r1.42.2.1 mkfixinc.sh
*** fixinc/mkfixinc.sh	6 Nov 2003 23:13:36 -0000	1.42.2.1
--- fixinc/mkfixinc.sh	12 Jan 2004 23:28:21 -0000
*************** case $machine in
*** 47,53 ****
          fixincludes=fixinc.interix
          ;;
  
!     i?86-*-openbsd*)
          fixincludes=fixinc.wrap
          ;;
  
--- 47,53 ----
          fixincludes=fixinc.interix
          ;;
  
!     *-*-openbsd*)
          fixincludes=fixinc.wrap
          ;;
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]