[lld] 3334b9d - [ELF][test] Enhance relative dynamic relocation tests
Andrew Ng via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 03:35:54 PDT 2021
Author: Andrew Ng
Date: 2021-10-05T11:32:22+01:00
New Revision: 3334b9d70bc86501b91eae0a5ec2459ef2da6bb3
URL: https://github.com/llvm/llvm-project/commit/3334b9d70bc86501b91eae0a5ec2459ef2da6bb3
DIFF: https://github.com/llvm/llvm-project/commit/3334b9d70bc86501b91eae0a5ec2459ef2da6bb3.diff
LOG: [ELF][test] Enhance relative dynamic relocation tests
Add checking of the value of the relocation with an addend. Also check
all relocation offsets.
Differential Revision: https://reviews.llvm.org/D111071
Added:
Modified:
lld/test/ELF/relative-dynamic-reloc-pie.s
lld/test/ELF/relative-dynamic-reloc.s
Removed:
################################################################################
diff --git a/lld/test/ELF/relative-dynamic-reloc-pie.s b/lld/test/ELF/relative-dynamic-reloc-pie.s
index 8c6e4a8402f44..00b6ae5f29034 100644
--- a/lld/test/ELF/relative-dynamic-reloc-pie.s
+++ b/lld/test/ELF/relative-dynamic-reloc-pie.s
@@ -6,9 +6,10 @@
## Test that we create R_X86_64_RELATIVE relocations with -pie.
# CHECK: Relocations [
# CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-# CHECK-NEXT: 0x3368 R_X86_64_RELATIVE - 0x3368
-# CHECK-NEXT: 0x3370 R_X86_64_RELATIVE - 0x3370
-# CHECK-NEXT: 0x3378 R_X86_64_RELATIVE - 0x3371
+# CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
+# CHECK-NEXT: 0x[[#%X,BAR_ADDR:]] R_X86_64_RELATIVE
+# CHECK-SAME: - 0x[[#BAR_ADDR]]
+# CHECK-NEXT: 0x[[#BAR_ADDR + 8]] R_X86_64_RELATIVE - 0x[[#BAR_ADDR + 1]]
# CHECK-NEXT: }
# CHECK-NEXT: ]
diff --git a/lld/test/ELF/relative-dynamic-reloc.s b/lld/test/ELF/relative-dynamic-reloc.s
index 0bc1ad9fef07f..9f477f8594547 100644
--- a/lld/test/ELF/relative-dynamic-reloc.s
+++ b/lld/test/ELF/relative-dynamic-reloc.s
@@ -9,11 +9,12 @@
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
// CHECK-NEXT: 0x[[FOO_ADDR:.*]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
-// CHECK-NEXT: 0x[[BAR_ADDR:.*]] R_X86_64_RELATIVE - 0x[[BAR_ADDR]]
-// CHECK-NEXT: 0x{{[0-9A-F]+}} R_X86_64_RELATIVE - 0x{{[0-9A-F]+}}
-// CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x[[ZED_ADDR:.*]]
-// CHECK-NEXT: 0x{{.*}} R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
-// CHECK-NEXT: 0x{{[0-9A-F]+}} R_X86_64_64 external 0x0
+// CHECK-NEXT: 0x[[#%X,BAR_ADDR:]] R_X86_64_RELATIVE
+// CHECK-SAME: - 0x[[#BAR_ADDR]]
+// CHECK-NEXT: 0x[[#BAR_ADDR + 8]] R_X86_64_RELATIVE - 0x[[#BAR_ADDR + 1]]
+// CHECK-NEXT: 0x[[#BAR_ADDR + 16]] R_X86_64_RELATIVE - 0x[[ZED_ADDR:.*]]
+// CHECK-NEXT: 0x[[#BAR_ADDR + 24]] R_X86_64_RELATIVE - 0x[[FOO_ADDR]]
+// CHECK-NEXT: 0x[[#BAR_ADDR + 32]] R_X86_64_64 external 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
@@ -21,7 +22,7 @@
// CHECK: Name: foo
// CHECK-NEXT: Value: 0x[[FOO_ADDR]]
// CHECK: Name: bar
-// CHECK-NEXT: Value: 0x[[BAR_ADDR]]
+// CHECK-NEXT: Value: 0x[[#BAR_ADDR]]
// CHECK: Name: zed
// CHECK-NEXT: Value: 0x[[ZED_ADDR]]
// CHECK: ]
More information about the llvm-commits
mailing list