1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[llvm-objdump] --syms: print st_size as "%016" PRIx64 instead of "%08" PRIx64 for 64-bit objects

This is GNU objdump's behavior and it is reasonable to match.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D75588
This commit is contained in:
Fangrui Song 2020-03-03 16:59:33 -08:00
parent 97a6ae2276
commit 0e48a6385b
6 changed files with 30 additions and 22 deletions

View File

@ -30,6 +30,6 @@ aarch64_inst:
// CHECK-OBJ-NEXT: 0000: 2040105E
// CHECK-OBJ-NEXT: )
// CHECK-SYMS-NOT: 0000000000000000 .inst.aarch64_inst 00000000 $d
// CHECK-SYMS: 0000000000000000 .inst.aarch64_inst 00000000 $x
// CHECK-SYMS-NOT: 0000000000000000 .inst.aarch64_inst 00000000 $d
// CHECK-SYMS-NOT: 0000000000000000 .inst.aarch64_inst 0000000000000000 $d
// CHECK-SYMS: 0000000000000000 .inst.aarch64_inst 0000000000000000 $x
// CHECK-SYMS-NOT: 0000000000000000 .inst.aarch64_inst 0000000000000000 $d

View File

@ -21,8 +21,8 @@
// + .starts_data to have $d at 0
// CHECK: 00000000 .starts_data 00000000 $d
// CHECK-NEXT: 00000000 .text 00000000 $x
// CHECK-NEXT: 00000000 .wibble 00000000 $x
// CHECK: 0000000000000000 .starts_data 0000000000000000 $d
// CHECK-NEXT: 0000000000000000 .text 0000000000000000 $x
// CHECK-NEXT: 0000000000000000 .wibble 0000000000000000 $x
// CHECK-NOT: ${{[adtx]}}

View File

@ -28,9 +28,9 @@
# ADJUST-NEXT: 8 .shstrtab 0000003c 0000000000000000
# COMMON: SYMBOL TABLE:
# COMMON-NEXT: 0000000000000001 l F .text 00000000 func
# COMMON-NEXT: 0000000000000000 .text 00000000 sym
# COMMON-NEXT: 0000000000000000 l d .text 00000000 .text
# COMMON-NEXT: 0000000000000001 l F .text 0000000000000000 func
# COMMON-NEXT: 0000000000000000 .text 0000000000000000 sym
# COMMON-NEXT: 0000000000000000 l d .text 0000000000000000 .text
# NOADJUST: 0000000000000000 sym:
# NOADJUST-NEXT: 0: {{.*}} nop

View File

@ -3,7 +3,7 @@
## Check we demangle symbols when printing symbol table.
# CHECK: SYMBOL TABLE:
# CHECK-NEXT: 0000000000000000 g F .text 00000000 foo()
# CHECK-NEXT: 0000000000000000 g F .text 0000000000000000 foo()
## Check we demangle symbols when printing relocations.
# CHECK: 000000000000001 R_X86_64_PLT32 foo()-0x4

View File

@ -1,18 +1,26 @@
# RUN: yaml2obj %s -o %t
# RUN: llvm-objdump --syms %t > %t1
# RUN: llvm-objdump -t %t > %t2
# RUN: cmp %t1 %t2
# RUN: FileCheck %s --input-file=%t1
# RUN: yaml2obj -D BITS=32 %s -o %t.32
# RUN: llvm-objdump --syms %t.32 > %t.32.txt
# RUN: llvm-objdump -t %t.32 | cmp - %t.32.txt
# RUN: FileCheck --check-prefix=ELF32 %s --input-file=%t.32.txt
# CHECK: SYMBOL TABLE:
# CHECK-NEXT: 0000000000001004 l F .text 00000000 lfoo
# CHECK-NEXT: 0000000000001008 l O .text 00000000 lbar
# CHECK-NEXT: 0000000000001004 g F .text 00000000 foo
# CHECK-NEXT: 0000000000001008 g O .text 00000000 bar
# RUN: yaml2obj -D BITS=64 %s -o %t.64
# RUN: llvm-objdump --syms %t.64 | FileCheck --check-prefix=ELF64 %s
# ELF32: SYMBOL TABLE:
# ELF32-NEXT: 00001004 l F .text 00000000 lfoo
# ELF32-NEXT: 00001008 l O .text 00000000 lbar
# ELF32-NEXT: 00001004 g F .text 00000000 foo
# ELF32-NEXT: 00001008 g O .text 00000000 bar
# ELF64: SYMBOL TABLE:
# ELF64-NEXT: 0000000000001004 l F .text 0000000000000000 lfoo
# ELF64-NEXT: 0000000000001008 l O .text 0000000000000000 lbar
# ELF64-NEXT: 0000000000001004 g F .text 0000000000000000 foo
# ELF64-NEXT: 0000000000001008 g O .text 0000000000000000 bar
!ELF
FileHeader:
Class: ELFCLASS64
Class: ELFCLASS[[BITS]]
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64

View File

@ -1943,7 +1943,7 @@ void printSymbolTable(const ObjectFile *O, StringRef ArchiveName,
if (Common || isa<ELFObjectFileBase>(O)) {
uint64_t Val =
Common ? Symbol.getAlignment() : ELFSymbolRef(Symbol).getSize();
outs() << format("\t%08" PRIx64, Val);
outs() << '\t' << format(Fmt, Val);
}
if (isa<ELFObjectFileBase>(O)) {