This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Of libgcc -pic and -shared and openbsd config
- To: gcc at gcc dot gnu dot org
- Subject: Of libgcc -pic and -shared and openbsd config
- From: Marc Espie <espie at quatramaran dot ens dot fr>
- Date: Tue, 19 Sep 2000 19:31:55 +0200
This is not an actual patch yet, but rather a request for comments.
I've tried turning on -fPIC for OpenBSD. Unfortunately, this triggers
a linker bug on some arches. The bug has been fixed, and the upcoming
2.8 release will have the fix (people running 2.8beta ought to know what
they're doing anyways...)
I believe that something like the following ought to work.
I'm not too fond of the configure.in change to grab the right OpenBSD
target fragment, but I can't see how to achieve it otherwise.
Note that I believe a separate t-openbsd/t-openbsd-old makes sense,
even though they `share' a large part, the idea being that t-openbsd-old
is somewhat broken, and not to use for anything else.
The last issue is the libc spec change for -shared... like FreeBSD does,
I think we ought not to link against libc by default for shared libraries
(especially since we have a shared libc). Opinions ?
PS: having a real gcc account rocks for new files diffs :)
Index: config/t-openbsd
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/t-openbsd,v
retrieving revision 1.2
diff -c -r1.2 t-openbsd
*** t-openbsd 1999/09/04 15:08:55 1.2
--- t-openbsd 2000/09/19 17:15:55
***************
*** 5,7 ****
--- 5,9 ----
USER_H = ${LANG_EXTRA_HEADERS}
INSTALL_ASSERT_H =
+ # Compile libgcc2.a with pic.
+ TARGET_LIBGCC2_CFLAGS = -fPIC
Index: config/t-openbsd-old
===================================================================
RCS file: t-openbsd-old
diff -N t-openbsd-old
*** /dev/null Tue May 5 13:32:27 1998
--- t-openbsd-old Tue Sep 19 10:15:55 2000
***************
*** 0 ****
--- 1,7 ----
+ # Don't run fixproto
+ STMP_FIXPROTO =
+
+ # We don't need GCC's own include files but we do need lang specific ones.
+ USER_H = ${LANG_EXTRA_HEADERS}
+ INSTALL_ASSERT_H =
+
Index: config/openbsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/openbsd.h,v
retrieving revision 1.6
diff -c -r1.6 openbsd.h
*** openbsd.h 2000/05/05 16:30:23 1.6
--- openbsd.h 2000/09/19 17:15:56
***************
*** 83,89 ****
/* 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
--- 83,89 ----
/* 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
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.420
diff -c -r1.420 configure.in
*** configure.in 2000/09/17 00:12:33 1.420
--- configure.in 2000/09/19 17:15:59
***************
*** 679,685 ****
;;
*-*-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
--- 679,696 ----
;;
*-*-openbsd*)
tm_file=${cpu_type}/openbsd.h
! case $machine in
! changequote(,)dnl
! i[34567]86-*-openbsd2[01234567] |
! m68k-*-openbsd2[01234567] |
! m88k-*-openbsd2[01234567] |
! sparc-*-openbsd2[01234567] |
! vax-*-openbsd2[01234567] )
! changequote([,])dnl
! tmake_file="t-libc-ok t-openbsd-old";;
! *)
! tmake_file="t-libc-ok t-openbsd";;
! esac;
# avoid surprises, always provide an xm-openbsd file
xm_file=${cpu_type}/xm-openbsd.h
# don't depend on processor x-fragments as well