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

             Bug #: 15153
           Summary: gold fails to detect undefined symbol
           Product: binutils
           Version: 2.24 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
        AssignedTo: i...@airs.com
        ReportedBy: hjl.to...@gmail.com
                CC: ccout...@google.com
    Classification: Unclassified


gold fails to detect undefined symbol:

[hjl@gnu-6 xxx]$ cat foo.c
extern int xxx __attribute__((weak));

extern void bar ();

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

int
bar (void)
{
  return xxx;
}
[hjl@gnu-6 xxx]$ make
gcc -Wl,--no-copy-dt-needed-entries    -c -o foo.o foo.c
gcc -Wl,--no-copy-dt-needed-entries -shared -fPIC -o libyyy.so yyy.c
gcc -Wl,--no-copy-dt-needed-entries -fuse-ld=gold -B./
-Wl,--no-allow-shlib-undefined -o y foo.o libyyy.so -Wl,-rpath,.
./y
./y: symbol lookup error: ./libyyy.so: undefined symbol: xxx
make: *** [all] Error 127
[hjl@gnu-6 xxx]$ 

ld detects the error:

[hjl@gnu-6 xxx]$ make x
gcc -Wl,--no-copy-dt-needed-entries -B./ -Wl,--no-allow-shlib-undefined -o x
foo.o libyyy.so -Wl,-rpath,.
foo.o: In function `main':
foo.c:(.text+0x10): undefined reference to `xxx'
collect2: error: ld returned 1 exit status
make: *** [x] Error 1
[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