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(GV)) + Res |= BasicSymbolRef::SF_Indirect; if (auto *GO = GV->getBaseObject()) if (isa(GO) && !GO->hasSection()) Res |= BasicSymbolRef::SF_Text; 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,8 @@ uint32_t SymFlags = Sym.getFlags(); if (!DebugSyms && (SymFlags & SymbolRef::SF_FormatSpecific)) continue; - if (WithoutAliases) { - if (IRObjectFile *IR = dyn_cast(&Obj)) { - const GlobalValue *GV = IR->getSymbolGV(Sym.getRawDataRefImpl()); - if (GV && isa(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.