diff options
author | Manoj Gupta <manojgupta@google.com> | 2019-08-23 18:01:13 +0000 |
---|---|---|
committer | Manoj Gupta <manojgupta@google.com> | 2019-08-23 18:01:13 +0000 |
commit | 30232770fbe5f5df7d5d01bd418c5ef9cc76b75e (patch) | |
tree | 1437c54abf36a66b1284f2f6a8b857e596b223a6 /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | 5b02cfa0b3c2c34943108b02ff2ff45ec46a2af3 (diff) | |
download | bcm5719-llvm-30232770fbe5f5df7d5d01bd418c5ef9cc76b75e.tar.gz bcm5719-llvm-30232770fbe5f5df7d5d01bd418c5ef9cc76b75e.zip |
Revert r369233.
This breaks building of some projects like libfuse and alsa-lib
that now fail when linking.
Error details in PR43092.
llvm-svn: 369790
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index f9b1ad38400..014eafed588 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -1285,21 +1285,8 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssembler &Asm, Alias->setBinding(Symbol.getBinding()); Alias->setOther(Symbol.getOther()); - // Record the rename. This serves two purposes: 1) detect multiple symbol - // version definitions, 2) consistently suppress the original symbol in the - // symbol table. GNU as keeps the original symbol for defined @ and @@, but - // suppresses in for other cases (@@@ or undefined). The original symbol is - // usually undesired and difficult to remove in an archive. Moreoever, it - // can cause linker issues like binutils PR/18703. If the user wants other - // aliases to the versioned symbol, they can copy the original symbol to - // other symbol names with .set directive. - auto R = Renames.try_emplace(&Symbol, Alias); - if (!R.second && R.first->second != Alias) { - Asm.getContext().reportError( - SMLoc(), llvm::Twine("multiple symbol versions defined for ") + - Symbol.getName()); + if (!Symbol.isUndefined() && !Rest.startswith("@@@")) continue; - } // FIXME: Get source locations for these errors or diagnose them earlier. if (Symbol.isUndefined() && Rest.startswith("@@") && @@ -1308,6 +1295,15 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssembler &Asm, " must be defined"); continue; } + + if (Renames.count(&Symbol) && Renames[&Symbol] != Alias) { + Asm.getContext().reportError( + SMLoc(), llvm::Twine("multiple symbol versions defined for ") + + Symbol.getName()); + continue; + } + + Renames.insert(std::make_pair(&Symbol, Alias)); } for (const MCSymbol *&Sym : AddrsigSyms) { |