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]$