diff options
author | Fangrui Song <i@maskray.me> | 2023-12-07 10:49:57 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2023-12-07 10:49:57 -0800 |
commit | 0e6685ab1a8313cd1dc7eb3c99ff642e6c492aa2 (patch) | |
tree | 802a02e4d3af186c6b7ee914b62742535edf8058 | |
parent | dd0e38eb3467c7ed3f15b31cb8771d5b2ce08675 (diff) | |
download | llvm-0e6685ab1a8313cd1dc7eb3c99ff642e6c492aa2.zip llvm-0e6685ab1a8313cd1dc7eb3c99ff642e6c492aa2.tar.gz llvm-0e6685ab1a8313cd1dc7eb3c99ff642e6c492aa2.tar.bz2 |
[ELF,test] Improve tombstone value tests
Add 32-bit test for -z dead-reloc-in-nonalloc= and add tests for a
non-x86 64-bit (x86-64 is unique in discerning signed/unsigned 32-bit
absolute relocations (R_X86_64_32/R_X86_64_32S).
AArch64/PPC64/RISC-V/etc don't have the distinction). Having a test will
improve coverage for #74686
-rw-r--r-- | lld/test/ELF/debug-dead-reloc-32.s | 11 | ||||
-rw-r--r-- | lld/test/ELF/debug-dead-reloc.s | 11 |
2 files changed, 19 insertions, 3 deletions
diff --git a/lld/test/ELF/debug-dead-reloc-32.s b/lld/test/ELF/debug-dead-reloc-32.s index b2708a7..99335b4 100644 --- a/lld/test/ELF/debug-dead-reloc-32.s +++ b/lld/test/ELF/debug-dead-reloc-32.s @@ -14,6 +14,17 @@ # CHECK-NEXT: Contents of section .debug_addr: # CHECK-NEXT: 0000 00000000 +## -z dead-reloc-in-nonalloc= can override the tombstone value. +# RUN: ld.lld -z dead-reloc-in-nonalloc=.debug_loc=42 -z dead-reloc-in-nonalloc=.debug_addr=0xfffffffffffffffe %t.o -o %t1 +# RUN: llvm-objdump -s %t1 | FileCheck %s --check-prefix=OVERRIDE + +# OVERRIDE: Contents of section .debug_loc: +# OVERRIDE-NEXT: 0000 2a000000 *... +# OVERRIDE-NEXT: Contents of section .debug_ranges: +# OVERRIDE-NEXT: 0000 01000000 .... +# OVERRIDE-NEXT: Contents of section .debug_addr: +# OVERRIDE-NEXT: 0000 feffffff .... + .section .text.1,"axe" .byte 0 diff --git a/lld/test/ELF/debug-dead-reloc.s b/lld/test/ELF/debug-dead-reloc.s index fcf5320..cfa41e0 100644 --- a/lld/test/ELF/debug-dead-reloc.s +++ b/lld/test/ELF/debug-dead-reloc.s @@ -1,4 +1,4 @@ -# REQUIRES: x86 +# REQUIRES: aarch64, x86 ## Test we resolve symbolic relocations in .debug_* sections to a tombstone ## value if the referenced symbol is discarded (--gc-sections, non-prevailing ## section group, SHF_EXCLUDE, /DISCARD/, etc). @@ -9,13 +9,18 @@ # RUN: llvm-objdump -s %t | FileCheck %s # RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=REL +# RUN: echo '.globl _start; _start: bl group' | llvm-mc -filetype=obj -triple=aarch64 - -o %t.a64.o +# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t1.a64.o +# RUN: ld.lld --emit-relocs --gc-sections %t.a64.o %t1.a64.o %t1.a64.o -o %t.a64 +# RUN: llvm-objdump -s %t.a64 | FileCheck %s + # CHECK: Contents of section .debug_loc: # CHECK-NEXT: 0000 01000000 00000000 01000000 00000000 # CHECK: Contents of section .debug_ranges: # CHECK-NEXT: 0000 01000000 00000000 01000000 00000000 # CHECK: Contents of section .debug_addr: -# CHECK-NEXT: 0000 {{.*}}000 00000000 {{.*}}000 00000000 -# CHECK-NEXT: 0010 00000000 00000000 {{.*}}000 00000000 +# CHECK-NEXT: 0000 {{.*}}00 00000000 {{.*}}00 00000000 +# CHECK-NEXT: 0010 00000000 00000000 {{.*}}00 00000000 # CHECK: Contents of section .debug_foo: # CHECK-NEXT: 0000 00000000 00000000 08000000 00000000 # CHECK-NEXT: 0010 00000000 00000000 08000000 00000000 |