[llvm] r223790 - Remember the unmangled name in the plugin.
Rafael Espindola
rafael.espindola at gmail.com
Tue Dec 9 08:50:57 PST 2014
Author: rafael
Date: Tue Dec 9 10:50:57 2014
New Revision: 223790
URL: http://llvm.org/viewvc/llvm-project?rev=223790&view=rev
Log:
Remember the unmangled name in the plugin.
This allows it to work with non trivial manglings like the one in COFF.
Amusingly, this can be tested with gold, as emit-llvm causes the plugin to
exit before any COFF is generated.
Added:
llvm/trunk/test/tools/gold/coff.ll
Modified:
llvm/trunk/tools/gold/gold-plugin.cpp
Added: llvm/trunk/test/tools/gold/coff.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/coff.ll?rev=223790&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/coff.ll (added)
+++ llvm/trunk/test/tools/gold/coff.ll Tue Dec 9 10:50:57 2014
@@ -0,0 +1,22 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
+; RUN: -shared %t.o -o %t2.o
+; RUN: llvm-dis %t2.o -o - | FileCheck %s
+
+
+target datalayout = "m:w"
+
+; CHECK: define void @f() {
+define void @f() {
+ ret void
+}
+
+; CHECK: define internal void @g() {
+define hidden void @g() {
+ ret void
+}
+
+; CHECK: define internal void @h() {
+define linkonce_odr void @h() {
+ ret void
+}
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=223790&r1=223789&r2=223790&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Tue Dec 9 10:50:57 2014
@@ -625,7 +625,7 @@ getModuleForFile(LLVMContext &Context, c
// Since we use the regular lib/Linker, we cannot just internalize GV
// now or it will not be copied to the merged module. Instead we force
// it to be copied and then internalize it.
- Internalize.insert(Sym.name);
+ Internalize.insert(GV->getName());
}
break;
}
@@ -638,7 +638,7 @@ getModuleForFile(LLVMContext &Context, c
// Gold might have selected a linkonce_odr and preempted a weak_odr.
// In that case we have to make sure we don't end up internalizing it.
if (!GV->isDiscardableIfUnused())
- Maybe.erase(Sym.name);
+ Maybe.erase(GV->getName());
// fall-through
case LDPR_PREEMPTED_REG:
@@ -651,7 +651,7 @@ getModuleForFile(LLVMContext &Context, c
// and in that module the address might be significant, but that
// copy will be LDPR_PREEMPTED_IR.
if (GV->hasLinkOnceODRLinkage())
- Maybe.insert(Sym.name);
+ Maybe.insert(GV->getName());
keepGlobalValue(*GV, KeptAliases);
break;
}
More information about the llvm-commits
mailing list