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]

Patch: let OpenBSD handle -shared correctly


This fixes an old problem that Niklas and I erroneously tried to fix by
patching collect2 (we saw that it did not work for shared libraries,
but missed the shared_obj support, which needs -shared to work to be
useful).

Hence this patch, which enables -shared on OpenBSD, and is self-contained.

(As far as ctors/dtors go, currently ld.so does call the ctors/dtors
directly. It would be better to have gcc do the job at link-time, but
ldd does not support shared libraries, hence, I will have to add to 
the SUNOS4_SHARED_LIBRARIES support to handle OpenBSD a.out as well)

ChangeLog entry:
Thu May  4 04:04:33 CEST 2000  Marc Espie <espie@cvs.openbsd.org>

	* config/openbsd.h (LINK_SPEC): pass correct flags to ld 
	to support -shared, on platforms with dynamic libraries.

Index: openbsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/openbsd.h,v
retrieving revision 1.5
diff -c -r1.5 openbsd.h
*** openbsd.h	2000/03/07 20:39:09	1.5
--- openbsd.h	2000/05/04 02:04:02
***************
*** 119,125 ****
    "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}"
  #else
  #define LINK_SPEC \
!   "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
  #endif
  
  #undef LIB_SPEC
--- 119,125 ----
    "%{!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

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