[llvm] r212344 - Don't include llvm.metadata variables in archive symbol tables.
Rafael Espindola
rafael.espindola at gmail.com
Fri Jul 4 08:03:17 PDT 2014
Author: rafael
Date: Fri Jul 4 10:03:17 2014
New Revision: 212344
URL: http://llvm.org/viewvc/llvm-project?rev=212344&view=rev
Log:
Don't include llvm.metadata variables in archive symbol tables.
Modified:
llvm/trunk/lib/Object/IRObjectFile.cpp
llvm/trunk/test/Object/Inputs/trivial.ll
llvm/trunk/test/Object/nm-archive.test
Modified: llvm/trunk/lib/Object/IRObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=212344&r1=212343&r2=212344&view=diff
==============================================================================
--- llvm/trunk/lib/Object/IRObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/IRObjectFile.cpp Fri Jul 4 10:03:17 2014
@@ -240,6 +240,11 @@ uint32_t IRObjectFile::getSymbolFlags(Da
if (GV->hasLinkOnceLinkage() || GV->hasWeakLinkage())
Res |= BasicSymbolRef::SF_Weak;
+ if (auto *Var = dyn_cast<GlobalVariable>(GV)) {
+ if (Var->getSection() == StringRef("llvm.metadata"))
+ Res |= BasicSymbolRef::SF_FormatSpecific;
+ }
+
return Res;
}
Modified: llvm/trunk/test/Object/Inputs/trivial.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/trivial.ll?rev=212344&r1=212343&r2=212344&view=diff
==============================================================================
--- llvm/trunk/test/Object/Inputs/trivial.ll (original)
+++ llvm/trunk/test/Object/Inputs/trivial.ll Fri Jul 4 10:03:17 2014
@@ -10,3 +10,6 @@ entry:
declare i32 @puts(i8* nocapture) nounwind
declare void @SomeOtherFunction(...)
+
+ at var = global i32 0
+ at llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @var to i8*)], section "llvm.metadata"
Modified: llvm/trunk/test/Object/nm-archive.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/nm-archive.test?rev=212344&r1=212343&r2=212344&view=diff
==============================================================================
--- llvm/trunk/test/Object/nm-archive.test (original)
+++ llvm/trunk/test/Object/nm-archive.test Fri Jul 4 10:03:17 2014
@@ -18,6 +18,7 @@ RUN: llvm-nm %t2 | FileCheck %s -check-p
BITCODE: U SomeOtherFunction
BITCODE-NEXT: T main
BITCODE-NEXT: U puts
+BITCODE-NEXT: D var
Test we don't error with an archive with no symtab.
More information about the llvm-commits
mailing list