Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 275666 - sys-devel/binutils: ld should search libraries in its sysroot first
Summary: sys-devel/binutils: ld should search libraries in its sysroot first
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://sourceware.org/bugzilla/show_b...
Whiteboard:
Keywords:
: 266319 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-06-28 07:08 UTC by Sven 'sleipnir' Rebhan
Modified: 2009-07-20 09:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ld should search libs in sysroot first (binutils-2.19.1-ld-sysroot.patch,1.16 KB, patch)
2009-06-28 07:10 UTC, Sven 'sleipnir' Rebhan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sven 'sleipnir' Rebhan 2009-06-28 07:08:51 UTC
When cross-compiling and linking against a #4411 linker script, ld will search the library on the host first. For an amd64 host the following test script

echo "Testing with absolute linker script (systems libz)..."
echo "int main(void) { return 0; }" > test.c
echo "GROUP ( /lib/libz.so )" > "${PWD}/libfoo-script.so"
armv4tl-softfloat-linux-gnueabi-gcc test.c -o test libfoo-script.so

will fail with

Testing with absolute linker script (systems libz)...
/lib/libz.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status

because the lib (/lib/libz.so) specified in the linker script is searched on host first. The following patch solves this problem (upstream bug http://sourceware.org/bugzilla/show_bug.cgi?id=10340).


Reproducible: Always
Comment 1 Sven 'sleipnir' Rebhan 2009-06-28 07:10:53 UTC
Created attachment 195936 [details, diff]
ld should search libs in sysroot first

When ld was configured with a sysroot, it should always search for libraries with absolute filename in this sysroot first. This patch was tested on x86_64-pc-linux-gnu without sysroot and armv4tl-softfloat-linux-gnueabi cross-compilation with sysroot and works fine on both.
Comment 2 SpanKY gentoo-dev 2009-07-05 19:57:51 UTC
*** Bug 266319 has been marked as a duplicate of this bug. ***
Comment 3 SpanKY gentoo-dev 2009-07-20 09:11:49 UTC
patch has been added to binutils-2.19.51.0.12.  if things work out, we can also put it into binutils-2.19.1.