Object: Add SF_Executable symbol flag.

This allows us to remove a few uses of IRObjectFile::getSymbolGV() in
llvm-nm.

While here change host-dependent logic in llvm-nm to target-dependent
logic.

Differential Revision: https://reviews.llvm.org/D27075

llvm-svn: 288320
This commit is contained in:
Peter Collingbourne
2016-12-01 06:53:47 +00:00
parent 863cbfbeba
commit e2f1b4a651
3 changed files with 20 additions and 18 deletions

View File

@@ -109,7 +109,8 @@ void ModuleSymbolTable::CollectAsmSymbols(
for (auto &KV : Streamer) {
StringRef Key = KV.first();
RecordStreamer::State Value = KV.second;
uint32_t Res = BasicSymbolRef::SF_None;
// FIXME: For now we just assume that all asm symbols are executable.
uint32_t Res = BasicSymbolRef::SF_Executable;
switch (Value) {
case RecordStreamer::NeverSeen:
llvm_unreachable("NeverSeen should have been replaced earlier");
@@ -163,6 +164,8 @@ uint32_t ModuleSymbolTable::getSymbolFlags(Symbol S) const {
if (GVar->isConstant())
Res |= BasicSymbolRef::SF_Const;
}
if (dyn_cast_or_null<Function>(GV->getBaseObject()))
Res |= BasicSymbolRef::SF_Executable;
if (GV->hasPrivateLinkage())
Res |= BasicSymbolRef::SF_FormatSpecific;
if (!GV->hasLocalLinkage())