[llvm] 942b090 - [llvm-objdump, test] Improve zero dumping and inline relocs tests
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 16 16:54:50 PST 2023
Author: Fangrui Song
Date: 2023-12-16T16:54:45-08:00
New Revision: 942b0901b09a89b09ebb75e75141e678a206cc36
URL: https://github.com/llvm/llvm-project/commit/942b0901b09a89b09ebb75e75141e678a206cc36
DIFF: https://github.com/llvm/llvm-project/commit/942b0901b09a89b09ebb75e75141e678a206cc36.diff
LOG: [llvm-objdump,test] Improve zero dumping and inline relocs tests
Added:
Modified:
llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test
llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test b/llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test
index d61d7455570b19..62776f8c5a9900 100644
--- a/llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test
+++ b/llvm/test/tools/llvm-objdump/X86/disassemble-zeroes-relocations.test
@@ -2,6 +2,7 @@
## Check we do not skip zeroes blocks if have relocations pointed to these places.
# RUN: llvm-objdump -D --reloc -j .rodata %t | FileCheck %s
+# RUN: llvm-objdump -D --reloc -j .rodata --disassemble-symbols=rodata3 %t | FileCheck %s --check-prefix=CHECK2
# CHECK: 0000000000000000 <rodata1>:
# CHECK-NEXT: 0: 00 00 addb %al, (%rax)
@@ -30,6 +31,12 @@
# CHECK-NEXT: 43: 00 00 addb %al, (%rax)
# CHECK-NEXT: 45: 00 00 addb %al, (%rax)
+# CHECK2: Disassembly of section .rodata:
+# CHECK2-EMPTY:
+# CHECK2-NEXT: 0000000000000037 <rodata3>:
+# CHECK2-NEXT: ...
+# CHECK2-NOT: {{.}}
+
## Check that without -reloc all zeroes would be omitted.
# RUN: llvm-objdump -D %t | FileCheck %s --check-prefix=SKIP
diff --git a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test
index 631ee205a5c180..6c3c0bd1c98038 100644
--- a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test
+++ b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs-exec.test
@@ -4,6 +4,7 @@
# RUN: llvm-objdump --no-print-imm-hex -dr %t | FileCheck %s --match-full-lines --strict-whitespace
# RUN: llvm-objdump --no-print-imm-hex -dr --no-leading-addr %t | FileCheck %s --check-prefix=NOADDR --match-full-lines --strict-whitespace
# RUN: llvm-objdump --no-print-imm-hex -dr --no-addresses %t | FileCheck %s --check-prefix=NOADDR --match-full-lines --strict-whitespace
+# RUN: llvm-objdump --no-print-imm-hex -dr --disassemble-symbols=text1 %t | FileCheck %s --check-prefix=CHECK2 --match-full-lines --strict-whitespace
# RUN: yaml2obj -DBITS=32 %s -o %t.32
# RUN: llvm-objdump --no-print-imm-hex -dr --no-leading-addr %t.32 | FileCheck %s --check-prefix=NOADDR --match-full-lines --strict-whitespace
@@ -15,6 +16,19 @@
# CHECK-NEXT: 400006: e8 fc fe ff ff callq 0x3fff07 <puts+0x3fff07>
# CHECK-NEXT: 0000000000400007: R_X86_64_PLT32 puts-0x4
# CHECK-NEXT: 40000b: 90 nop
+# CHECK-EMPTY:
+# CHECK-NEXT:000000000040000c <text1>:
+# CHECK-NEXT: 40000c: bf 10 00 40 00 movl $4194320, %edi # imm = 0x400010
+# CHECK-NEXT: 000000000040000d: R_X86_64_32 .rodata
+# CHECK-NOT: {{.}}
+
+## FIXME: --disassemble-symbols: remove inline relocs from skipped functions
+# CHECK2:000000000040000c <text1>:
+#CHECK2-NEXT: 40000c: bf 10 00 40 00 movl $4194320, %edi # imm = 0x400010
+#CHECK2-NEXT: 0000000000400002: R_X86_64_32 .rodata
+#CHECK2-NEXT: 0000000000400007: R_X86_64_PLT32 puts-0x4
+#CHECK2-NEXT: 000000000040000d: R_X86_64_32 .rodata
+#CHECK2-NOT: {{.}}
# NOADDR:<.text>:
# NOADDR-NEXT: 90 nop
@@ -42,7 +56,7 @@ Sections:
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x400000
AddressAlign: 0x10
- Content: 90BF10004000E8FCFEFFFF90
+ Content: 90BF10004000E8FCFEFFFF90BF10004000
- Name: .rodata
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
@@ -62,6 +76,10 @@ Sections:
Symbol: puts
Type: R_X86_64_PLT32
Addend: -4
+ - Offset: 0x40000d
+ Symbol: .rodata
+ Type: R_X86_64_32
+ Addend: 0
Symbols:
- Name: .rodata
Type: STT_SECTION
@@ -70,4 +88,9 @@ Symbols:
- Name: puts
Type: STT_FUNC
Binding: STB_GLOBAL
+ - Name: text1
+ Type: STT_FUNC
+ Binding: STB_GLOBAL
+ Section: .text
+ Value: 0x40000c
...
More information about the llvm-commits
mailing list