bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/18859] New: Gold linker does not fully respect -no-as-needed


From: eugeni.stepanov at gmail dot com
Subject: [Bug gold/18859] New: Gold linker does not fully respect -no-as-needed
Date: Thu, 20 Aug 2015 20:53:31 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=18859

            Bug ID: 18859
           Summary: Gold linker does not fully respect -no-as-needed
           Product: binutils
           Version: 2.26 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: eugeni.stepanov at gmail dot com
                CC: ian at airs dot com
  Target Milestone: ---

Gold and ld behave differently when a shared library is first mentioned when
-as-needed is in effect, and then again after -no-as-needed. Ld generates a
DT_NEEDED entry for such library, and gold does not.

$ cat 1.c
int main() { return 0; }

# BFD linker
$ g++ 1.c -Wl,-as-needed -lutil -Wl,-no-as-needed -lutil -fuse-ld=bfd &&
readelf -d a.out  | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

# Gold linker
$ g++ 1.c -Wl,-as-needed -lutil -Wl,-no-as-needed -lutil -fuse-ld=gold &&
readelf -d a.out  | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]