]> granicus.if.org Git - llvm/commitdiff
Object: Set SF_Indirect in ModuleSymbolTable.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 1 Dec 2016 07:00:35 +0000 (07:00 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 1 Dec 2016 07:00:35 +0000 (07:00 +0000)
This lets us remove the last use of IRObjectFile::getSymbolGV() in llvm-nm.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288321 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Object/ModuleSymbolTable.cpp
tools/llvm-nm/llvm-nm.cpp

index c8b1bb6b775fbd00d657e5ec719980eb01810ef8..90488007ff59a116616baa6e54db9b66e00f56dc 100644 (file)
@@ -166,6 +166,8 @@ uint32_t ModuleSymbolTable::getSymbolFlags(Symbol S) const {
   }
   if (dyn_cast_or_null<Function>(GV->getBaseObject()))
     Res |= BasicSymbolRef::SF_Executable;
+  if (isa<GlobalAlias>(GV))
+    Res |= BasicSymbolRef::SF_Indirect;
   if (GV->hasPrivateLinkage())
     Res |= BasicSymbolRef::SF_FormatSpecific;
   if (!GV->hasLocalLinkage())
index 33385e9953e7f6c57471b1dd7d74ebc97f8366a5..381bca4514e82ae25dc5d929fbd4c053983944f9 100644 (file)
@@ -998,13 +998,8 @@ dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
     uint32_t SymFlags = Sym.getFlags();
     if (!DebugSyms && (SymFlags & SymbolRef::SF_FormatSpecific))
       continue;
-    if (WithoutAliases) {
-      if (IRObjectFile *IR = dyn_cast<IRObjectFile>(&Obj)) {
-        const GlobalValue *GV = IR->getSymbolGV(Sym.getRawDataRefImpl());
-        if (GV && isa<GlobalAlias>(GV))
-          continue;
-      }
-    }
+    if (WithoutAliases && (SymFlags & SymbolRef::SF_Indirect))
+      continue;
     // If a "-s segname sectname" option was specified and this is a Mach-O
     // file and this section appears in this file, Nsect will be non-zero then
     // see if this symbol is a symbol from that section and if not skip it.