ld doesn't honor sysroot prefix for ldscripts - track upstream bug

Bug #625320 reported by Peter Pearse on 2010-08-27
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
binutils (Ubuntu)

Bug Description

Binary package hint: binutils

This bug opened to track http://sourceware.org/bugzilla/show_bug.cgi?id=10340

When ld is configured with a sysroot prefix and test is executed:

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

the linking process terminates 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 Host's library is linked in. For cross-compilation the desired
behaviour is different. Here, the lib specified in the linker script should be
searched in the sysroot first! Patch will be attached.

Created attachment 4025
ld should search search in sysroot first

When ld was configured with a sysroot, it should always search for libraries
with absolute filename in this sysroot first.

Comment on attachment 4025
ld should search search 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 with
sysroot and works ffine on both.

Peter Pearse (peter-pearse) wrote :

Affects cross building.

Matthias Klose (doko) on 2010-08-27
Changed in binutils (Ubuntu):
status: New → In Progress
Changed in binutils:
status: Unknown → Confirmed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package binutils -

binutils ( maverick; urgency=low

  * Link executables statically when `static' is passed in DEB_BUILD_OPTIONS
    (Jim Heck). Closes: #590101.
  * Apply proposed patch for PR ld/10340 (ld doesn't honor sysroot prefix
    for ldscripts). LP: #625320.
 -- Matthias Klose <email address hidden> Fri, 27 Aug 2010 16:52:19 +0200

Changed in binutils (Ubuntu):
status: In Progress → Fix Released
Changed in binutils:
importance: Unknown → Medium

CVSROOT: /cvs/src
Module name: src
Changes by: <email address hidden> 2012-03-08 05:29:33

Modified files:
 ld : ChangeLog ldfile.c ldfile.h ldlang.c ldlang.h
                  ldlex.h ldlex.l

Log message:
 PR ld/10340
 * ldfile.c (is_sysrooted_pathname): Remove notsame param.
 (ldfile_add_library_path): Don't set sysrooted flag.
 (ldfile_open_file_search): Likewise, and don't copy them.
 (try_open): Delete exten and code handling such. Add sysrooted
 param and return whether path is in sysroot.
 (ldfile_find_command_file): Delete extend param. Add sysrooted
 param. Rename local var. Update try_open calls.
 (ldfile_open_command_file_1): Pass sysrooted to lex_push_file.
 * ldfile.h (search_dirs_type): Remove sysrooted field.
 * ldlang.c (new_afile): Always set sysrooted from input_flags.
 (load_symbols): Don't set input_flags.sysrooted.
 * ldlang.h (struct lang_input_statement_flags): Revise sysrooted
 * ldlex.h (lex_push_file): Update prototype.
 * ldlex.l (sysrooted_stack): New array.
 (EOF): Pop input_flags.sysrooted.
 (lex_push_file): Add sysrooted param. Save and set


Changed in binutils:
status: Confirmed → In Progress
Changed in binutils:
status: In Progress → Fix Released

*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.