Skip to content

Commit 7b74b0d

Browse files
committed
[llvm-objdump] --syms: print 'u' for STB_GNU_UNIQUE
GCC when configured with --enable-gnu-unique (default on glibc>=2.11) emits STB_GNU_UNIQUE for certain objects which are otherwise emitted as STT_OBJECT, such as an inline function's static local variable or its guard variable, and a static data member of a template. Clang does not implement -fgnu-unique. Implementing it as a binding is strange and the feature itself is considered by some as a misfeature. Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D75797
1 parent e799405 commit 7b74b0d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

llvm/test/tools/llvm-objdump/ELF/symbol-table.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# CHECK-NEXT:0000000000000000 *UND* 0000000000000000 reserve
2626
# CHECK-NEXT:0000000000000000 g *ABS* 0000000000000000 abs
2727
# CHECK-NEXT:0000000000000000 *COM* 0000000000000000 common2
28-
# CHECK-NEXT:0000000000000000 g O .data 0000000000000000 gnu_unique
28+
# CHECK-NEXT:0000000000000000 u O .data 0000000000000000 gnu_unique
2929
# CHECK-NEXT:0000000000000000 g .data 0000000000000000 invalid_binding
3030
# CHECK-NEXT:0000000000000000 g .data 0000000000000000 STB_HIOS
3131
# CHECK-NEXT:0000000000000000 g .data 0000000000000000 STB_LOPROC

llvm/tools/llvm-objdump/llvm-objdump.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,8 @@ void printSymbolTable(const ObjectFile *O, StringRef ArchiveName,
19031903
if (auto *ELF = dyn_cast<ELFObjectFileBase>(O)) {
19041904
if (ELFSymbolRef(*I).getELFType() == ELF::STT_GNU_IFUNC)
19051905
IFunc = 'i';
1906+
if (ELFSymbolRef(*I).getBinding() == ELF::STB_GNU_UNIQUE)
1907+
GlobLoc = 'u';
19061908
}
19071909
char Debug = (Type == SymbolRef::ST_Debug || Type == SymbolRef::ST_File)
19081910
? 'd' : ' ';

0 commit comments

Comments
 (0)