http://sourceware.org/bugzilla/show_bug.cgi?id=15149

             Bug #: 15149
           Summary: Weak reference leads to DT_NEEDED entry
           Product: binutils
           Version: 2.24 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassig...@sourceware.org
        ReportedBy: hjl.to...@gmail.com
    Classification: Unclassified


[hjl@gnu-6 xxx]$ cat foo.c
extern void bar (void);

int main()
{
  bar ();
  return 0;
}
[hjl@gnu-6 xxx]$ cat bar.c
extern int xxx __attribute__((weak));

int
bar (void)
{
  return xxx;
}
[hjl@gnu-6 xxx]$ cat xxx.c
int xxx = 3;
[hjl@gnu-6 xxx]$ cat yyy.c
[hjl@gnu-6 xxx]$ make
gcc -Wl,--no-copy-dt-needed-entries    -c -o bar.o bar.c
gcc -Wl,--no-copy-dt-needed-entries    -c -o foo.o foo.c
gcc -Wl,--no-copy-dt-needed-entries -shared -fPIC -o libxxx.so xxx.c
gcc -Wl,--no-copy-dt-needed-entries -shared -fPIC -o libyyy.so yyy.c libxxx.so
gcc -Wl,--no-copy-dt-needed-entries  -o x bar.o foo.o libyyy.so
-Wl,-rpath-link,.
gcc -Wl,--no-copy-dt-needed-entries -fuse-ld=gold  -o y bar.o foo.o libyyy.so
-Wl,-rpath-link,.
readelf -d x | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libyyy.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libxxx.so]
readelf -d y | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libyyy.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
[hjl@gnu-6 xxx]$

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to