Skip to content

Commit c493057

Browse files
committed
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 ------------------------------------------------------------------------ llvm-svn: 362668
1 parent d95b14d commit c493057

File tree

5 files changed

+67
-12
lines changed

5 files changed

+67
-12
lines changed

lld/test/ELF/gc-sections-metadata-startstop.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# CHECK-NOT: yy
1212

1313
# CHECK: SYMBOL TABLE:
14-
# CHECK: xx 00000000 __start_xx
14+
# CHECK: xx 00000000 .protected __start_xx
1515
# CHECK: w *UND* 00000000 __start_yy
1616

1717
.weak __start_xx

lld/test/ELF/mips-micro-relocs.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
# EL-NEXT: 20028: 00 00 00 00 nop
4040
# EL-NEXT: 2002c: 00 94 e8 ff b -44
4141

42-
# SYM: 00037ff0 .got 00000000 .hidden _gp
43-
# SYM: 00020000 g F .text 00000000 foo
44-
# SYM: 00020010 .text 00000000 __start
42+
# SYM: 00037ff0 .got 00000000 .hidden _gp
43+
# SYM: 00020000 g F .text 00000000 0x80 foo
44+
# SYM: 00020010 .text 00000000 0x80 __start
4545

4646
.text
4747
.set micromips

lld/test/ELF/mips-micror6-relocs.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
# EL-NEXT: 20014: 7f 80 f6 ff beqzc $3, -36
2727
# EL-NEXT: 20018: ff b7 f4 ff balc -24 <foo>
2828

29-
# SYM: 00020000 g F .text 00000000 foo
30-
# SYM: 00020010 .text 00000000 __start
29+
# SYM: 00020000 g F .text 00000000 0x80 foo
30+
# SYM: 00020010 .text 00000000 0x80 __start
3131

3232
.text
3333
.set micromips
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# RUN: yaml2obj %s -o %t
2+
# RUN: llvm-objdump --syms %t | FileCheck %s
3+
4+
# CHECK: SYMBOL TABLE:
5+
# CHECK-NEXT: .text 00000000 default
6+
# CHECK-NEXT: .text 00000000 .internal internal
7+
# CHECK-NEXT: .text 00000000 .hidden hidden
8+
# CHECK-NEXT: .text 00000000 .protected protected
9+
# CHECK-NEXT: .text 00000000 0x20 mips_pic
10+
11+
!ELF
12+
FileHeader:
13+
Class: ELFCLASS32
14+
Data: ELFDATA2LSB
15+
Type: ET_REL
16+
Machine: EM_MIPS
17+
Flags: [ EF_MIPS_ABI_O32, EF_MIPS_ARCH_32 ]
18+
Sections:
19+
- Name: .text
20+
Type: SHT_PROGBITS
21+
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
22+
Symbols:
23+
Local:
24+
- Name: default
25+
Section: .text
26+
- Name: internal
27+
Visibility: STV_INTERNAL
28+
Section: .text
29+
- Name: hidden
30+
Visibility: STV_HIDDEN
31+
Section: .text
32+
- Name: protected
33+
Visibility: STV_PROTECTED
34+
Section: .text
35+
- Name: mips_pic
36+
Other: [ STO_MIPS_PIC ]
37+
Section: .text

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,20 +2087,38 @@ void llvm::printSymbolTable(const ObjectFile *O, StringRef ArchiveName,
20872087
outs() << SectionName;
20882088
}
20892089

2090-
outs() << '\t';
20912090
if (Common || isa<ELFObjectFileBase>(O)) {
20922091
uint64_t Val =
20932092
Common ? Symbol.getAlignment() : ELFSymbolRef(Symbol).getSize();
2094-
outs() << format("\t %08" PRIx64 " ", Val);
2093+
outs() << format("\t%08" PRIx64, Val);
20952094
}
20962095

2097-
if (Hidden)
2098-
outs() << ".hidden ";
2096+
if (isa<ELFObjectFileBase>(O)) {
2097+
uint8_t Other = ELFSymbolRef(Symbol).getOther();
2098+
switch (Other) {
2099+
case ELF::STV_DEFAULT:
2100+
break;
2101+
case ELF::STV_INTERNAL:
2102+
outs() << " .internal";
2103+
break;
2104+
case ELF::STV_HIDDEN:
2105+
outs() << " .hidden";
2106+
break;
2107+
case ELF::STV_PROTECTED:
2108+
outs() << " .protected";
2109+
break;
2110+
default:
2111+
outs() << format(" 0x%02x", Other);
2112+
break;
2113+
}
2114+
} else if (Hidden) {
2115+
outs() << " .hidden";
2116+
}
20992117

21002118
if (Demangle)
2101-
outs() << demangle(Name) << '\n';
2119+
outs() << ' ' << demangle(Name) << '\n';
21022120
else
2103-
outs() << Name << '\n';
2121+
outs() << ' ' << Name << '\n';
21042122
}
21052123
}
21062124

0 commit comments

Comments
 (0)