[llvm] r288321 - Object: Set SF_Indirect in ModuleSymbolTable.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 23:00:35 PST 2016


Author: pcc
Date: Thu Dec  1 01:00:35 2016
New Revision: 288321

URL: http://llvm.org/viewvc/llvm-project?rev=288321&view=rev
Log:
Object: Set SF_Indirect in ModuleSymbolTable.

This lets us remove the last use of IRObjectFile::getSymbolGV() in llvm-nm.

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

Modified:
    llvm/trunk/lib/Object/ModuleSymbolTable.cpp
    llvm/trunk/tools/llvm-nm/llvm-nm.cpp

Modified: llvm/trunk/lib/Object/ModuleSymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ModuleSymbolTable.cpp?rev=288321&r1=288320&r2=288321&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ModuleSymbolTable.cpp (original)
+++ llvm/trunk/lib/Object/ModuleSymbolTable.cpp Thu Dec  1 01:00:35 2016
@@ -166,6 +166,8 @@ uint32_t ModuleSymbolTable::getSymbolFla
   }
   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())

Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=288321&r1=288320&r2=288321&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Thu Dec  1 01:00:35 2016
@@ -998,13 +998,8 @@ dumpSymbolNamesFromObject(SymbolicFile &
     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.




More information about the llvm-commits mailing list