When building the gold testsuite with LDFLAGS="-Wl,--as-needed", the following tests fail due to undefined symbols: FAIL: exception_separate_shared_12_test (exit: 127) =================================================== ./exception_separate_shared_12_test: symbol lookup error: ./exception_shared_1.so: undefined symbol: _Z2f1v FAIL: exception_separate_shared_21_test (exit: 127) =================================================== ./exception_separate_shared_21_test: symbol lookup error: ./exception_shared_1.so: undefined symbol: _Z2f1v When built with --as-needed: 0x00000001 (NEEDED) Shared library: [exception_shared_1.so] 0x00000001 (NEEDED) Shared library: [libc.so.6] When built without --as-needed: 0x00000001 (NEEDED) Shared library: [exception_shared_1.so] 0x00000001 (NEEDED) Shared library: [exception_shared_2.so] 0x00000001 (NEEDED) Shared library: [libstdc++.so.6] 0x00000001 (NEEDED) Shared library: [libm.so.6] 0x00000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x00000001 (NEEDED) Shared library: [libc.so.6]
Fixed with this commit: https://sourceware.org/ml/binutils-cvs/2012-12/msg00083.html