[PATCH] D61718: [llvm-objdump] Print st_other
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 10 04:32:05 PDT 2019
MaskRay updated this revision to Diff 199000.
MaskRay added a comment.
Use yaml2obj
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61718/new/
https://reviews.llvm.org/D61718
Files:
test/tools/llvm-objdump/elf-symbol-visibility.test
tools/llvm-objdump/llvm-objdump.cpp
Index: tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- tools/llvm-objdump/llvm-objdump.cpp
+++ tools/llvm-objdump/llvm-objdump.cpp
@@ -1686,20 +1686,38 @@
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';
}
}
Index: test/tools/llvm-objdump/elf-symbol-visibility.test
===================================================================
--- /dev/null
+++ test/tools/llvm-objdump/elf-symbol-visibility.test
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61718.199000.patch
Type: text/x-patch
Size: 2461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190510/a1b0c102/attachment.bin>
More information about the llvm-commits
mailing list