summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/LTO/LTO.h1
-rw-r--r--llvm/include/llvm/Object/IRSymtab.h2
-rw-r--r--llvm/lib/Object/IRSymtab.cpp2
-rw-r--r--llvm/test/LTO/Resolution/X86/symtab.ll25
-rw-r--r--llvm/tools/llvm-lto2/llvm-lto2.cpp7
5 files changed, 24 insertions, 13 deletions
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index 693568f5b9a..8c083947b84 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -126,6 +126,7 @@ public:
using irsymtab::Symbol::getCommonSize;
using irsymtab::Symbol::getCommonAlignment;
using irsymtab::Symbol::getCOFFWeakExternalFallback;
+ using irsymtab::Symbol::isExecutable;
};
/// A range over the symbols in this InputFile.
diff --git a/llvm/include/llvm/Object/IRSymtab.h b/llvm/include/llvm/Object/IRSymtab.h
index 7ce6fa50e6d..98ef3ffcc97 100644
--- a/llvm/include/llvm/Object/IRSymtab.h
+++ b/llvm/include/llvm/Object/IRSymtab.h
@@ -92,6 +92,7 @@ struct Symbol {
FB_global,
FB_format_specific,
FB_unnamed_addr,
+ FB_executable,
};
/// The index into the Uncommon table, or -1 if this symbol does not have an
@@ -166,6 +167,7 @@ struct Symbol {
bool isGlobal() const { return (Flags >> S::FB_global) & 1; }
bool isFormatSpecific() const { return (Flags >> S::FB_format_specific) & 1; }
bool isUnnamedAddr() const { return (Flags >> S::FB_unnamed_addr) & 1; }
+ bool isExecutable() const { return (Flags >> S::FB_executable) & 1; }
uint64_t getCommonSize() const {
assert(isCommon());
diff --git a/llvm/lib/Object/IRSymtab.cpp b/llvm/lib/Object/IRSymtab.cpp
index 1ef2c4bb730..f78b84b388a 100644
--- a/llvm/lib/Object/IRSymtab.cpp
+++ b/llvm/lib/Object/IRSymtab.cpp
@@ -125,6 +125,8 @@ Error Builder::addSymbol(ModuleSymbolTable::Symbol Msym) {
Sym.Flags |= 1 << storage::Symbol::FB_global;
if (Flags & object::BasicSymbolRef::SF_FormatSpecific)
Sym.Flags |= 1 << storage::Symbol::FB_format_specific;
+ if (Flags & object::BasicSymbolRef::SF_Executable)
+ Sym.Flags |= 1 << storage::Symbol::FB_executable;
Sym.ComdatIndex = -1;
auto *GV = Msym.dyn_cast<GlobalValue *>();
diff --git a/llvm/test/LTO/Resolution/X86/symtab.ll b/llvm/test/LTO/Resolution/X86/symtab.ll
index 48eb198fb1c..e2729ac918a 100644
--- a/llvm/test/LTO/Resolution/X86/symtab.ll
+++ b/llvm/test/LTO/Resolution/X86/symtab.ll
@@ -11,37 +11,42 @@ source_filename = "src.c"
!0 = !{i32 6, !"Linker Options", !{!{!"/include:foo"}}}
!llvm.module.flags = !{ !0 }
-; CHECK: H------ _g1
+; CHECK: D------X _fun
+define i32 @fun() {
+ ret i32 0
+}
+
+; CHECK: H------- _g1
@g1 = hidden global i32 0
-; CHECK: P------ _g2
+; CHECK: P------- _g2
@g2 = protected global i32 0
-; CHECK: D------ _g3
+; CHECK: D------- _g3
@g3 = global i32 0
-; CHECK: DU----- _g4
+; CHECK: DU------ _g4
@g4 = external global i32
-; CHECK: D--W--- _g5
+; CHECK: D--W---- _g5
@g5 = weak global i32 0
-; CHECK: D--W-O- _g6
+; CHECK: D--W-O-- _g6
@g6 = linkonce_odr unnamed_addr global i32 0
-; CHECK: D-----T _g7
+; CHECK: D-----T- _g7
@g7 = thread_local global i32 0
-; CHECK: D-C---- _g8
+; CHECK: D-C----- _g8
; CHECK-NEXT: size 4 align 8
@g8 = common global i32 0, align 8
-; CHECK: D------ _g9
+; CHECK: D------- _g9
; CHECK-NEXT: comdat g9
$g9 = comdat any
@g9 = global i32 0, comdat
-; CHECK: D--WI-- _g10
+; CHECK: D--WI--- _g10
; CHECK-NEXT: comdat g9
; CHECK-NEXT: fallback _g9
@g10 = weak alias i32, i32* @g9
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index 52ba669279c..7a8d4055338 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -317,18 +317,19 @@ static int dumpSymtab(int argc, char **argv) {
PrintBool('I', Sym.isIndirect());
PrintBool('O', Sym.canBeOmittedFromSymbolTable());
PrintBool('T', Sym.isTLS());
+ PrintBool('X', Sym.isExecutable());
outs() << ' ' << Sym.getName() << '\n';
if (Sym.isCommon())
- outs() << " size " << Sym.getCommonSize() << " align "
+ outs() << " size " << Sym.getCommonSize() << " align "
<< Sym.getCommonAlignment() << '\n';
int Comdat = Sym.getComdatIndex();
if (Comdat != -1)
- outs() << " comdat " << ComdatTable[Comdat] << '\n';
+ outs() << " comdat " << ComdatTable[Comdat] << '\n';
if (Sym.isWeak() && Sym.isIndirect())
- outs() << " fallback " << Sym.getCOFFWeakExternalFallback() << '\n';
+ outs() << " fallback " << Sym.getCOFFWeakExternalFallback() << '\n';
}
outs() << '\n';
OpenPOWER on IntegriCloud