1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[llvm-objdump] Print st_other

Add support for ".hidden" ".internal" ".protected" and " 0x%02x" for
other st_other bits used by some architectures.

Reviewed By: sfertile

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

llvm-svn: 360439
This commit is contained in:
Fangrui Song 2019-05-10 16:24:57 +00:00
parent e9eb57ab9c
commit bb85ceb346
2 changed files with 60 additions and 6 deletions

View File

@ -0,0 +1,36 @@
# RUN: yaml2obj %s -o %t
# RUN: llvm-objdump --syms %t | FileCheck %s
# CHECK: SYMBOL TABLE:
# CHECK-NEXT: .text 00000000 default
# CHECK-NEXT: .text 00000000 .internal internal
# CHECK-NEXT: .text 00000000 .hidden hidden
# CHECK-NEXT: .text 00000000 .protected protected
# CHECK-NEXT: .text 00000000 0x20 mips_pic
!ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
- Name: default
Section: .text
- Name: internal
Visibility: STV_INTERNAL
Section: .text
- Name: hidden
Visibility: STV_HIDDEN
Section: .text
- Name: protected
Visibility: STV_PROTECTED
Section: .text
- Name: mips_pic
Other: [ STO_MIPS_PIC ]
Section: .text

View File

@ -1686,20 +1686,38 @@ void printSymbolTable(const ObjectFile *O, StringRef ArchiveName,
outs() << SectionName;
}
outs() << '\t';
if (Common || isa<ELFObjectFileBase>(O)) {
uint64_t Val =
Common ? Symbol.getAlignment() : ELFSymbolRef(Symbol).getSize();
outs() << format("\t %08" PRIx64 " ", Val);
outs() << format("\t%08" PRIx64, Val);
}
if (Hidden)
outs() << ".hidden ";
if (isa<ELFObjectFileBase>(O)) {
uint8_t Other = ELFSymbolRef(Symbol).getOther();
switch (Other) {
case ELF::STV_DEFAULT:
break;
case ELF::STV_INTERNAL:
outs() << " .internal";
break;
case ELF::STV_HIDDEN:
outs() << " .hidden";
break;
case ELF::STV_PROTECTED:
outs() << " .protected";
break;
default:
outs() << format(" 0x%02x", Other);
break;
}
} else if (Hidden) {
outs() << " .hidden";
}
if (Demangle)
outs() << demangle(Name) << '\n';
outs() << ' ' << demangle(Name) << '\n';
else
outs() << Name << '\n';
outs() << ' ' << Name << '\n';
}
}