[PATCH] D27076: Object: Set SF_Indirect in ModuleSymbolTable.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 16:10:17 PST 2016


pcc created this revision.
pcc added a reviewer: mehdi_amini.
pcc added subscribers: llvm-commits, rafael.
pcc added a dependency: D27075: Object: Add SF_Text symbol flag..

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

Depends on https://reviews.llvm.org/D27075


https://reviews.llvm.org/D27076

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


Index: llvm/tools/llvm-nm/llvm-nm.cpp
===================================================================
--- llvm/tools/llvm-nm/llvm-nm.cpp
+++ llvm/tools/llvm-nm/llvm-nm.cpp
@@ -1003,13 +1003,9 @@
     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)
+      if (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.
Index: llvm/lib/Object/ModuleSymbolTable.cpp
===================================================================
--- llvm/lib/Object/ModuleSymbolTable.cpp
+++ llvm/lib/Object/ModuleSymbolTable.cpp
@@ -161,6 +161,8 @@
     if (GVar->isConstant())
       Res |= BasicSymbolRef::SF_Const;
   }
+  if (isa<GlobalAlias>(GV))
+    Res |= BasicSymbolRef::SF_Indirect;
   if (auto *GO = GV->getBaseObject())
     if (isa<Function>(GO) && !GO->hasSection())
       Res |= BasicSymbolRef::SF_Text;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27076.79168.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161124/48a62ac9/attachment.bin>


More information about the llvm-commits mailing list