From f9a0056016fb89c84b5663642d0c836430a3ad87 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 4 Mar 2020 17:19:18 -0800 Subject: [llvm-objdump] --syms: make flags closer to GNU objdump This fixes several issues. The behavior changes are: A SHN_COMMON symbol does not have the 'g' flag. An undefined symbol does not have 'g' or 'l' flag. A STB_GLOBAL SymbolRef::ST_Unknown symbol has the 'g' flag. A STB_LOCAL SymbolRef::ST_Unknown symbol has the 'l' flag. Reviewed By: rupprecht Differential Revision: https://reviews.llvm.org/D75659 --- llvm/tools/llvm-objdump/llvm-objdump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp') diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index c9dec65..4675bd5 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1898,7 +1898,7 @@ void printSymbolTable(const ObjectFile *O, StringRef ArchiveName, bool Hidden = Flags & SymbolRef::SF_Hidden; char GlobLoc = ' '; - if (Type != SymbolRef::ST_Unknown) + if ((Section != O->section_end() || Absolute) && !Weak) GlobLoc = Global ? 'g' : 'l'; char Debug = (Type == SymbolRef::ST_Debug || Type == SymbolRef::ST_File) ? 'd' : ' '; -- cgit v1.1