[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: GCC 3.2 transition



>> "Marcelo E. Magallon" <mmagallo@debian.org> writes:

 >  I was toying with that idea in my head.  There's no need for a
 >  special C++ compiler, is there?

 "linker" I meant, obviously.
 
 >  Just the normal linker with a different set of default paths.  This
 >  is like using an -rpath.  The problem with -rpath is that it has
 >  precedence over LD_LIBRARY_PATH.  So, the simplest solution is for
 >  g++-3.2 to indicate a different dynamic linker when linking
 >  programs.

 The problem with this solution is that it's not particularly backwards
 compatible.  Systems without this special linker won't be able to run
 the binaries, which is a *big* problem.

 Fiddling arround the ld.so sources to understand how if finds the
 libraries it wants to use, I noticed it looks for two tags in the ELF
 object: DT_RPATH and DT_RUNPATH.  RUNPATH has two nice poperties: it's
 looked at *after* LD_LIBRARY_PATH and it doesn't contaminate other ELF
 objects, that is, it affects *only* the lookup process for the current
 ELF object (that's the documented behaviour at least, I have yet to
 check that ld.so does indeed behave like this).

 I've managed to place such a tag on an excecutable, with the annoying
 side-effect that RPATH also gets set.  I haven't found a way to store
 only DT_RUNPATH on the ELF object.  In order to achive this you have to
 pass the --enable-new-dtags and -rpath options to the linker.  This
 seems to be ok, since the precense of RUNPATH overrides RPATH (again,
 this is the documented behaviour).

 The end effect of this is that a) binaries still work on other systems
 (with no larger breakage than what we see even today -- unresolved
 symbols and so on) b) doesn't touch the dynamic linker c) gives us what
 we want using a very well contained change (modifying the G++ frontend)
 and recompiling.

 Does this have drawbacks?

-- 
Marcelo             | Bishops move diagonally. That's why they often turn up
mmagallo@debian.org | where the kings don't expect them to be.
                    |         -- (Terry Pratchett, Small Gods)



Reply to: