This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] ld sysroot prefix handling

Please CC me as I'm not subscribed to the list!

Hello List,

while cross-compiling a Gentoo Linux system for an arm architecture I noticed
that in some cases the sysroot prefix is not prepended to absolute library path.
This especially can be seen after adding some debugging to  ldfile.c line 311.
For linking a simple C program "int main(void) { return 0; }" you see that the
entry->sysrooted flag is set to TRUE while the filename to link is
The toolchain sysroot is /usr/armv4tl-softfloat-linux-gnueabi. In the
following the
sysroot prefix gets prepended. However, in my interpretation the sysroot prefix
should have been prepended before if  entry->sysrooted == TRUE!?

When linking against the following linker script

OUTPUT_FORMAT ( elf32-littlearm )
GROUP ( /lib/ )

you get a entry->sysrooted == FALSE and filename == "/lib/" in the
following the prefix gets not prepended as  entry->sysrooted == FALSE which
leads to sever problems during cross-compilation.

The questions are now:
- Should the sysroot prefix have been prepended when entry->sysrooted == TRUE?
- If so, why is the  filename then "/lib/" in the first case?
- If not, why isn't the sysroot prepended to the file specified in the
linker file?

I attached a RFC patch that solves both issues for me by testing if
the sysroot was
already prepended right before ld tries to prepend the prefix and
change the condition
to if ! entry->sysrooted.

Best regards,

   Sven 'sleipnir' Rebhan

Attachment: binutils-2.19.1-ld-sysroot.patch
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]