Article View: gnu.gcc.bug
Article #6235gcc -shared lossage in gcc 2.7.0
From: David Taylor
Date: Wed, 17 Jan 1996 00:00
Date: Wed, 17 Jan 1996 00:00
33 lines
1776 bytes
1776 bytes
This is in gcc 2.7.0 configured for sparc-sun-solaris2.4
First, the -shared option to gcc is not documented in the texinfo file.
Second, the specs for the -shared option specify in *link:
%{!h*:%{o*:-h %*}}
This saves the name of the shared object inside the shared object if you
specify -o on the command line. The documentation for ld says that the
resulting saved name, if present, is stored at link time in executables
that reference the shared object (rather than the name of the shared
object itself). The name saved in the executable is used at run time to
find the shared object.
Why is this a problem? First, gcc's behavior is undocumented. Second,
there's no guarantee that the name of the shared object -- at the time
it is built -- will be the same as the name at the time it is linked
against.
Due to a combination of paranoia and having had file systems fill up one
time too many, I almost never have the link name match the final name
for a deliverable file; instead I typically do something like:
libmpi-io.so: $(PICOBJS)
$(LD) -o x$@ $(PICOBJS)
$(MV) x$@ $@
That is, link to the name with an 'x' on the front, then if successful
move that name to the real name.
There are just too many tools around that will leave the executable
around when the link fails to trust it to link to the final name.
Technical Details
Message-ID:
<9601171428.AA12661@thokk.think.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,1c4350b79a415343,start X-Google-Attributes: gid113d02,public From: taylor@think.com (David Taylor) Subject: gcc -shared lossage in gcc 2.7.0 Date: 1996/01/17 Message-ID: <9601171428.AA12661@thokk.think.com> X-Deja-AN: 135719359 distribution: gnu sender: daemon@cis.ohio-state.edu organization: GNUs Not Usenet newsgroups: gnu.gcc.bug