This is the mail archive of the gcc-patches@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]

[GCC 3.0] Fix OpenBSD build


This patch does fix a few loose ends with gcc 3.0 on OpenBSD systems.
The multilib part should have been there much earlier, I just kept on
fighting with pic code, until rth helped me figure it out.

Can I commit this to the 3.0 branch ?

2001-07-09  Marc Espie <espie@openbsd.org>

	* config.gcc (*-*-openbsd*):  Add fragment to compile libgcc
	correctly for shared configurations.
	* config/t-libgcc-pic:  New.
	* config/{i386,m68k,sparc}/t-openbsd:  New.
	* config/openbsd.h:  Include cpu_spec in cpp_spec where needed.
	Support -shared.  Support debugging libraries with -g.
	* config/i386/openbsd.h:  Correct ASM_COMMENT_START.  Ensure dwarf2
	frame information does not emit pointer diffs.

*** gcc/config.gcc.orig	Tue Jun  5 21:09:51 2001
--- gcc/config.gcc	Mon Jul  9 12:52:07 2001
*************** case $machine in
*** 287,293 ****
  	;;
  *-*-openbsd*)
  	tm_file=${cpu_type}/openbsd.h
! 	tmake_file="t-libc-ok t-openbsd"
  	# avoid surprises, always provide an xm-openbsd file 
  	xm_file=${cpu_type}/xm-openbsd.h
  	# don't depend on processor x-fragments as well
--- 287,293 ----
  	;;
  *-*-openbsd*)
  	tm_file=${cpu_type}/openbsd.h
! 	tmake_file="t-libc-ok t-openbsd t-libgcc-pic"
  	# avoid surprises, always provide an xm-openbsd file 
  	xm_file=${cpu_type}/xm-openbsd.h
  	# don't depend on processor x-fragments as well
*************** i[34567]86-*-netbsd*)
*** 1142,1147 ****
--- 1142,1149 ----
  	use_collect2=yes
  	;;
  i[34567]86-*-openbsd*)
+ 	# 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
  	;;
*************** m68k*-*-netbsd*)
*** 2039,2044 ****
--- 2041,2048 ----
  	use_collect2=yes
  	;;
  m68k*-*-openbsd*)
+ 	# needed to unconfuse gdb
+ 	tmake_file="t-libc-ok t-openbsd m68k/t-openbsd"
  	float_format=m68k
  	# we need collect2 until our bug is fixed...
  	use_collect2=yes
*************** sparc-*-netbsd*)
*** 3030,3035 ****
--- 3034,3041 ----
  	use_collect2=yes
  	;;
  sparc-*-openbsd*)
+ 	# 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
  	;;
*** gcc/config/t-libgcc-pic.orig	Mon Jul  9 12:52:07 2001
--- gcc/config/t-libgcc-pic	Mon Jul  9 12:52:07 2001
***************
*** 0 ****
--- 1,2 ----
+ # Compile libgcc2.a with pic.
+ TARGET_LIBGCC2_CFLAGS = -fPIC
*** gcc/config/i386/t-openbsd.orig	Mon Jul  9 12:52:07 2001
--- gcc/config/i386/t-openbsd	Mon Jul  9 12:52:07 2001
***************
*** 0 ****
--- 1,6 ----
+ # gdb gets confused if pic code is linked with non pic
+ # We cope by building variants of libgcc.
+ MULTILIB_OPTIONS = fpic
+ MULTILIB_MATCHES=fpic=fPIC
+ LIBGCC = stmp-multilib
+ INSTALL_LIBGCC = install-multilib
*** gcc/config/sparc/t-openbsd.orig	Mon Jul  9 12:52:07 2001
--- gcc/config/sparc/t-openbsd	Mon Jul  9 12:52:07 2001
***************
*** 0 ****
--- 1,5 ----
+ # The native linker doesn't handle linking -fpic code with -fPIC code.  Ugh.
+ # We cope by building both variants of libgcc.
+ MULTILIB_OPTIONS = fpic/fPIC
+ LIBGCC = stmp-multilib
+ INSTALL_LIBGCC = install-multilib
*** gcc/config/m68k/t-openbsd.orig	Mon Jul  9 12:52:07 2001
--- gcc/config/m68k/t-openbsd	Mon Jul  9 12:52:07 2001
***************
*** 0 ****
--- 1,5 ----
+ # gdb gets confused if pic code is linked with non pic
+ # We cope by building all variants of libgcc.
+ MULTILIB_OPTIONS = fpic/fPIC
+ LIBGCC = stmp-multilib
+ INSTALL_LIBGCC = install-multilib
*** gcc/config/openbsd.h.orig	Mon Sep 25 13:45:51 2000
--- gcc/config/openbsd.h	Mon Jul  9 12:52:07 2001
*************** Boston, MA 02111-1307, USA.  */
*** 78,89 ****
     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.  */
  #define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
  
  /* 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 "-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}"
  
  #ifndef OBSD_HAS_CORRECT_SPECS
  
--- 78,93 ----
     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.  */
+ #ifdef CPP_CPU_SPEC
+ #define OBSD_CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
+ #else
  #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
  
*************** Boston, MA 02111-1307, USA.  */
*** 103,108 ****
--- 107,121 ----
     pic code.  */
  #undef ASM_SPEC
  #define ASM_SPEC "%{fpic:-k} %{fPIC:-k -K} %|"
+ 
+ /* Exception region output.  */
+ 
+ #undef ASM_PREFERRED_EH_DATA_FORMAT
+ #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                      \
+   (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel      \
+      : DW_EH_PE_absptr)
+ 
+ 
  #else
  /* Since we use gas, stdin -> - is a good idea, but we don't want to
     override native specs just for that.  */
*************** Boston, MA 02111-1307, USA.  */
*** 116,125 ****
  #undef LINK_SPEC
  #ifdef OBSD_NO_DYNAMIC_LIBRARIES
  #define LINK_SPEC \
!   "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}"
  #else
  #define LINK_SPEC \
!   "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}}} %{shared:-Bshareable -x} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
  #endif
  
  #undef LIB_SPEC
--- 129,138 ----
  #undef LINK_SPEC
  #ifdef OBSD_NO_DYNAMIC_LIBRARIES
  #define LINK_SPEC \
!   "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}"
  #else
  #define LINK_SPEC \
!   "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}}} %{shared:-Bshareable -x} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
  #endif
  
  #undef LIB_SPEC
*** gcc/config/i386/openbsd.h.orig	Sun May 20 21:49:17 2001
--- gcc/config/i386/openbsd.h	Mon Jul  9 12:52:07 2001
*************** Boston, MA 02111-1307, USA.  */
*** 133,135 ****
--- 133,140 ----
  #endif
  
  /* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h.  */
+ 
+ #undef ASM_COMMENT_START
+ #define ASM_COMMENT_START ";#"
+ 
+ #undef ASM_PREFERRED_EH_DATA_FORMAT


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