[GCC 3.0] Fix OpenBSD build
Marc Espie
espie@schutzenberger.liafa.jussieu.fr
Fri Jul 13 07:10:00 GMT 2001
Second try to fix OpenBSD build. As compared to the first try, I removed
the erroneous def of ASM_PREFERRED_EH_DATA_FORMAT. Tests on sparc show
the same fix as for i386 is needed.
Can I commit this to the 3.0 branch ?
On Mon, Jul 09, 2001 at 02:59:51PM +0200, Marc Espie wrote:
2001-07-13 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.
* config/sparc/openbsd.h: Ensure dwarf2 frame information does not
emit pointer diffs.
*** gcc/config.gcc.orig Tue Jun 5 21:09:51 2001
--- gcc/config.gcc Fri Jul 13 15:13:06 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 Fri Jul 13 15:13:06 2001
--- gcc/config/t-libgcc-pic Fri Jul 13 15:13:06 2001
***************
*** 0 ****
--- 1,2 ----
+ # Compile libgcc2.a with pic.
+ TARGET_LIBGCC2_CFLAGS = -fPIC
*** gcc/config/i386/t-openbsd.orig Fri Jul 13 15:13:06 2001
--- gcc/config/i386/t-openbsd Fri Jul 13 15:13:06 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/m68k/t-openbsd.orig Fri Jul 13 15:13:06 2001
--- gcc/config/m68k/t-openbsd Fri Jul 13 15:13:06 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/sparc/t-openbsd.orig Fri Jul 13 15:13:06 2001
--- gcc/config/sparc/t-openbsd Fri Jul 13 15:13:06 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/openbsd.h.orig Mon Sep 25 13:45:51 2000
--- gcc/config/openbsd.h Fri Jul 13 15:13:06 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,113 ----
pic code. */
#undef ASM_SPEC
#define ASM_SPEC "%{fpic:-k} %{fPIC:-k -K} %|"
+
#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
--- 121,130 ----
#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 Fri Jul 13 16:03:53 2001
*************** Boston, MA 02111-1307, USA. */
*** 114,119 ****
--- 114,121 ----
configuration files... */
#define DWARF2_UNWIND_INFO 0
+ #undef ASM_PREFERRED_EH_DATA_FORMAT
+
/* Assembler format: alignment output. */
/* A C statement to output to the stdio stream FILE an assembler
*************** Boston, MA 02111-1307, USA. */
*** 133,135 ****
--- 135,141 ----
#endif
/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h. */
+
+ #undef ASM_COMMENT_START
+ #define ASM_COMMENT_START ";#"
+
*** gcc/config/sparc/openbsd.h.orig Fri Jul 13 16:03:16 2001
--- gcc/config/sparc/openbsd.h Fri Jul 13 16:03:46 2001
*************** Boston, MA 02111-1307, USA. */
*** 64,68 ****
configuration files... */
#define DWARF2_UNWIND_INFO 0
! /* Default sparc.h does already define ASM_OUTPUT_MI_THUNK */
--- 64,69 ----
configuration files... */
#define DWARF2_UNWIND_INFO 0
! #undef ASM_PREFERRED_EH_DATA_FORMAT
+ /* Default sparc.h does already define ASM_OUTPUT_MI_THUNK */
More information about the Gcc-patches
mailing list