ld doesn't relocate sysroot if called as tooldir/bin/ld

Daniel Jacobowitz drow@mvista.com
Wed Feb 26 14:20:00 GMT 2003


On Wed, Feb 26, 2003 at 03:42:53AM -0300, Alexandre Oliva wrote:
> On Feb 20, 2003, Daniel Jacobowitz <drow@mvista.com> wrote:
> 
> > On Thu, Feb 20, 2003 at 07:10:06AM -0300, Alexandre Oliva wrote:
> 
> >> What would people think of arranging for pathnames in linker
> >> scripts within the sysroot to have the sysroot pathname prepended
> >> to them?  This would solve the main problem of relocating a cross
> >> toolchain with a glibc sysroot, because the glibc linker scripts
> >> reference full pathnames in the real root.  Comments?
> 
> > Oooh.  I love it.  That'd kill one of the last truly gross hacks in my
> > cross tool setup.
> 
> /me loves killing truly gross hacks :-)
> 
> Ok to install?
> 

> Index: ld/ChangeLog
> from  Alexandre Oliva  <aoliva@redhat.com>
> 
> 	* ldfile.h (struct search_dirs): Added sysrooted field.
> 	* ldlang.h (struct lang_input_statement_struct): Likewise.
> 	* ldfile.c (ldfile_add_library_path): Mark sysrooted paths.
> 	(ldfile_open_file_search): Look for sysrooted filename
> 	starting with / in ld_sysroot first.  Clear sysrooted flag if
> 	it's found in the current directory.  Set it from the
> 	search directory's sysrooted flag where it is found otherwise.

May I recommend a slightly different behavior?  It looks like, given
"GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )", your patch will
search for $sysroot/lib/libc.so.6 and fall back to /lib/libc.so.6.  I'd
rather it only searched the $sysroot'd version - that's how GCC does
this.


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Binutils mailing list