Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lld-linked libc++.so, libc++abi.so has undefined _GLOBAL_OFFSET_TABLE_ symbol #27079

Closed
emaste opened this issue Feb 23, 2016 · 2 comments
Closed
Labels
bugzilla Issues migrated from bugzilla lld

Comments

@emaste
Copy link
Member

emaste commented Feb 23, 2016

Bugzilla Link 26705
Resolution FIXED
Resolved on Mar 15, 2016 19:39
Version unspecified
OS FreeBSD
Blocks #23588

Extended Description

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)

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 4, 2016

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::Dynamic, 0, STV_HIDDEN);

  • // If the ouput contains a GotPlt section, add
  • // GLOBAL_OFFSET_TABLE to the symbol table.
  • if (Config->Shared && Out::GotPlt)
  • Symtab.addSynthetic("GLOBAL_OFFSET_TABLE", *Out::GotPlt,
  •  Out<ELFT>::GotPlt->getSize(), STV_HIDDEN);
    
  • // Define __rel[a]iplt{start,end} symbols if needed.
    addRelIpltSymbols();

@emaste
Copy link
Member Author

emaste commented Mar 16, 2016

Committed as r263594 http://reviews.llvm.org/rL263594

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla lld
Projects
None yet
Development

No branches or pull requests

2 participants