summaryrefslogtreecommitdiff
path: root/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2017-03-09 00:19:49 +0000
committerTeresa Johnson <tejohnson@google.com>2017-03-09 00:19:49 +0000
commit611bafa4c47efe79e24e1877d5d210e7347a486b (patch)
tree60bb74ad843044e9d02f5b51dc924d58d557a65e /lib/LTO/LTOBackend.cpp
parent1970df176f7adb2f79917f46a7d89053bf850981 (diff)
Perform symbol binding for .symver versioned symbols
Summary: In a .symver assembler directive like: .symver name, name2@@nodename "name2@@nodename" should get the same symbol binding as "name". While the ELF object writer is updating the symbol binding for .symver aliases before emitting the object file, not doing so when the module inline assembly is handled by the RecordStreamer is causing the wrong behavior in *LTO mode. E.g. when "name" is global, "name2@@nodename" must also be marked as global. Otherwise, the symbol is skipped when iterating over the LTO InputFile symbols (InputFile::Symbol::shouldSkip). So, for example, when performing any *LTO via the gold-plugin, the versioned symbol definition is not recorded by the plugin and passed back to the linker. If the object was in an archive, and there were no other symbols needed from that object, the object would not be included in the final link and references to the versioned symbol are undefined. The llvm-lto2 tests added will give an error about an unused symbol resolution without the fix. Reviewers: rafael, pcc Reviewed By: pcc Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D30485 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297332 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO/LTOBackend.cpp')
-rw-r--r--lib/LTO/LTOBackend.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp
index 25795b1332e..605a32d7331 100644
--- a/lib/LTO/LTOBackend.cpp
+++ b/lib/LTO/LTOBackend.cpp
@@ -354,7 +354,7 @@ static void handleAsmUndefinedRefs(Module &Mod, TargetMachine &TM) {
// llvm.compiler.used to prevent optimization to drop these from the output.
StringSet<> AsmUndefinedRefs;
ModuleSymbolTable::CollectAsmSymbols(
- Triple(Mod.getTargetTriple()), Mod.getModuleInlineAsm(),
+ Mod,
[&AsmUndefinedRefs](StringRef Name, object::BasicSymbolRef::Flags Flags) {
if (Flags & object::BasicSymbolRef::SF_Undefined)
AsmUndefinedRefs.insert(Name);