[llvm-branch-commits] [llvm-branch] r362668 - Merging r360439:
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 5 19:22:35 PDT 2019
Author: tstellar
Date: Wed Jun 5 19:22:34 2019
New Revision: 362668
URL: http://llvm.org/viewvc/llvm-project?rev=362668&view=rev
Log:
Merging r360439:
------------------------------------------------------------------------
r360439 | maskray | 2019-05-10 09:24:57 -0700 (Fri, 10 May 2019) | 8 lines
[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
------------------------------------------------------------------------
Added:
llvm/branches/release_80/test/tools/llvm-objdump/elf-symbol-visibility.test
Modified:
llvm/branches/release_80/tools/llvm-objdump/llvm-objdump.cpp
Added: llvm/branches/release_80/test/tools/llvm-objdump/elf-symbol-visibility.test
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/test/tools/llvm-objdump/elf-symbol-visibility.test?rev=362668&view=auto
==============================================================================
--- llvm/branches/release_80/test/tools/llvm-objdump/elf-symbol-visibility.test (added)
+++ llvm/branches/release_80/test/tools/llvm-objdump/elf-symbol-visibility.test Wed Jun 5 19:22:34 2019
@@ -0,0 +1,37 @@
+# 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:
+ Local:
+ - 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
Modified: llvm/branches/release_80/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_80/tools/llvm-objdump/llvm-objdump.cpp?rev=362668&r1=362667&r2=362668&view=diff
==============================================================================
--- llvm/branches/release_80/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/branches/release_80/tools/llvm-objdump/llvm-objdump.cpp Wed Jun 5 19:22:34 2019
@@ -2087,20 +2087,38 @@ void llvm::printSymbolTable(const Object
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';
}
}
More information about the llvm-branch-commits
mailing list