linked with lld: % nm build-lld-selfhost2/lib/libc++abi.so | grep 'GLOBAL_OFFSET' U _GLOBAL_OFFSET_TABLE_ with gnu ld: % nm build-nodebug/lib/libc++abi.so | grep 'GLOBAL_OFFSET' 00000000002592e0 a _GLOBAL_OFFSET_TABLE_ and link failures are observed in 'check-libcxxabi' /usr/bin/ld: /tank/emaste/src/llvm/build-lld-selfhost2/projects/libcxxabi/test/Output/catch_pointer_reference.pass.cpp.exe: hidden symbol `_GLOBAL_OFFSET_TABLE_' in /usr/lib/crt1.o is referenced by DSO /usr/bin/ld: final link failed: Nonrepresentable section on output CC: error: linker command failed with exit code 1 (use -v to see invocation)
I'm working on a (proper) fix, in the meanwhile you can workaround using the following: Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp (revision 262736) +++ ELF/Writer.cpp (working copy) @@ -1021,6 +1021,12 @@ if (isOutputDynamic()) Symtab.addSynthetic("_DYNAMIC", *Out<ELFT>::Dynamic, 0, STV_HIDDEN); + // If the ouput contains a GotPlt section, add + // _GLOBAL_OFFSET_TABLE_ to the symbol table. + if (Config->Shared && Out<ELFT>::GotPlt) + Symtab.addSynthetic("_GLOBAL_OFFSET_TABLE_", *Out<ELFT>::GotPlt, + Out<ELFT>::GotPlt->getSize(), STV_HIDDEN); + // Define __rel[a]_iplt_{start,end} symbols if needed. addRelIpltSymbols();
Committed as r263594 http://reviews.llvm.org/rL263594