Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jan 1998 08:35:55 +0100
From:      Ollivier Robert <roberto@keltia.freenix.fr>
To:        current@FreeBSD.ORG
Subject:   Re: Building EGCS.  What am I missing?
Message-ID:  <19980128083555.25754@keltia.freenix.fr>
In-Reply-To: <199801280252.SAA27219@austin.polstra.com>; from John Polstra on Tue, Jan 27, 1998 at 06:52:17PM -0800
References:  <19980127002052.38606@keltia.freenix.fr> <Pine.BSF.3.96.980126173228.235P-100000@zippy.dyn.ml.org> <19980127084505.42012@keltia.freenix.fr> <199801280252.SAA27219@austin.polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
According to John Polstra:
> Probably building shared libraries by hand with "ld -Bshareable
> /usr/lib/c++rt0.o *.so ..." will work OK.  The problem just affects
> "gcc -shared".

Here is John's fix, adapted to egcs. The fix was made on pgcc 980122 but it 
should apply mostly cleanly on every version of either egcs or pgcc. I was
able to build a shared lib with our bsd.lib.mk after that. egcs doesn't
have a STARTFILE_SPEC so I added our own (I'm not sure about it).

I'll send them to the egcs folks. 

--- freebsd.h.old	Mon Jan 26 22:07:49 1998
+++ freebsd.h	Wed Jan 28 07:56:19 1998
@@ -38,7 +38,7 @@
 #define CPP_PREDEFINES "-Dunix -Di386 -Dbsd4_4 -D__FreeBSD__=2 -D__386BSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
 
 /* Like the default, except no -lg.  */
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+#define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
 
 #undef SIZE_TYPE
 #define SIZE_TYPE "unsigned int"
@@ -220,7 +220,15 @@
 
 #define ASM_SPEC   " %| %{fpic:-k} %{fPIC:-k}"
 #define LINK_SPEC \
-  "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
+  "%{p:%e`-p' not supported; use `-pg' and gprof(1)} \
+   %{shared:-Bshareable} \
+   %{!shared:%{!nostdlib:%{!r:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} \
+   %{pg:-Bstatic} %{Z}} \
+   %{assert*} %{R*}"
+
+#define STARTFILE_SPEC  \
+  "%{shared:c++rt0.o%s} \
+   %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
 
 /* This is defined when gcc is compiled in the BSD-directory-tree, and must
  * make up for the gap to all the stuff done in the GNU-makefiles.

-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto@keltia.freenix.fr
FreeBSD keltia.freenix.fr 3.0-CURRENT #54: Mon Jan 26 20:29:17 CET 1998



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980128083555.25754>