Adding a new config option, mind if I check this in?

Rob Landley rob at landley.net
Thu Feb 26 19:14:42 UTC 2009


On Thursday 26 February 2009 02:12:04 Bernhard Reutner-Fischer wrote:
> On Tue, Feb 24, 2009 at 07:41:30PM +0000, Joseph S. Myers wrote:
> >On Mon, 23 Feb 2009, Rob Landley wrote:
> >> +config HARDWIRED_ABSPATH
> >> +	string "Hardwire absolute paths into linker scripts"
> >> +	default y
> >> +	help
> >> +	  This prepends absolute paths to the libraries mentioned in linker
> >> +	  scripts such as libc.so.
> >> +
> >> +	  This is a build time optimization.  It has no impact on dynamic
> >> +	  linking at runtime, which doesn't use linker scripts.
> >> +
> >> +	  You must disable this to use uClibc with a relocatable toolchain,
> >
> >I don't think this is an adequate explanation of the option.
> >
> >My understanding is that with the option enabled the absolute paths
> >embedded will be ones based on RUNTIME_PREFIX (typically /) and
> >DEVEL_PREFIX (typically /usr), while the libraries are installed under
> >PREFIX (the path which gets relocated).  The compiler and linker will be
> >configured to find their sysroot at PREFIX and if the configured
> >--with-sysroot was a subdirectory of the configured --prefix then the
> >whole toolchain can be relocated and the sysroot will still be found.
> >Finally, when the linker is configured with a sysroot it will
> >automatically interpret a path such as /lib/whatever in a linker script as
> >meaning $sysroot/lib/whatever, and so the correct library will be found
> >based on the reference from the linker script.
> >
> >In summary, references to PREFIX in a linker script are what would cause
> >relocation problems, but references to RUNTIME_PREFIX and DEVEL_PREFIX do
> >not with a properly configured sysrooted toolchain, and this configure
> >option only affects references to RUNTIME_PREFIX and DEVEL_PREFIX; nothing
> >creates references to PREFIX.
>
> This option is imo an inappropriate and dubious hack which is properly
> solved via sysroot since a long time now, yes.

Not for non-gcc compilers, older versions of gcc, or configurations that don't 
use sysroot.

> I build completely relocatable toolchains and they work just fine if
> setup properly so i think that this patch is a bad idea.

*shrug*  I've had the patch in my tree for three years, the other guy's had a 
similar patch in his tree, and I've seen others who didn't quote here.  But 
that just means I can continue to carry it as a patch removing unnecessary 
code indefinitely.

By all means, hardwire this sucker exclusively to the behavior of current gcc 
and have 13 lines of shell script in your makefile implement an "optimization" 
that's too small to measure.  (Just don't ever run gcc under strace to see 
what it's actually _doing_ when it searches for its libraries.  You'll lose 
your lunch.)

Rob


More information about the uClibc mailing list