Bug#273264: gcc-3.3: wrong linker path embedded in binaries, misuse of ld?
On Mon, Oct 04, 2004 at 11:29:58AM -0700, Steve Langasek wrote:
> On Mon, Oct 04, 2004 at 09:20:14AM -0400, Daniel Jacobowitz wrote:
> > On Fri, Sep 24, 2004 at 03:44:39PM -0700, Steve Langasek wrote:
> > > Package: gcc-3.3
> > > Version: 1:3.3.4-12
>
> > > Using this version of gcc-3.3, trying to combine '-static' with
> > > '-Wl,-Bdynamic' as linker options to gcc on my alpha results in
> > > unusable binaries that have an embedded linker path of /usr/lib/ld.so
> > > instead of /lib/ld-linux.so.2. If I use '-Wl,-Bstatic' and
> > > '-Wl,-Bdynamic' instead, the resulting output is sane, so this looks
> > > like a problem with gcc's invocation of ld.
>
> > Binutils doesn't know where the dynamic linker is. GCC tells it, but
> > only if you tell GCC that you're using dynamic linking by not
> > specifying -static. This isn't the only change - you'll get different
> > startfiles, for instance, and you may get a different selection of
> > -lgcc_s/-lgcc/-lgcc_eh.
>
> > What are you trying to accomplish by lying to GCC about your link?
>
> I was trying to get certain libraries linked dynamically, and certain
> others linked statically (specifically for vetting a certain static
> lib). If this should only be done using -Wl,-B options, I can certainly
> live with that; it makes sense that gcc wouldn't know that certain -Wl
> options interfere with -static, anyway. It just caught me off-guard
> when this happened, as I assumed -static and -Wl,-Bstatic could be used
> fairly interchangeably and there wasn't anything in the docs to make me
> think otherwise.
Yes, you need to use -Wl,-Bstatic and -Wl,-Bdynamic for this. If you
can think of an appropriate place in the documentation to describe
this...
--
Daniel Jacobowitz
Reply to: