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

Joseph S. Myers joseph at codesourcery.com
Tue Feb 24 19:41:30 UTC 2009


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.

-- 
Joseph S. Myers
joseph at codesourcery.com


More information about the uClibc mailing list