[llvm-branch-commits] [llvm] [llvm-objcopy] Support CREL (PR #97521)

James Henderson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 5 02:28:26 PDT 2024


================
@@ -0,0 +1,140 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objcopy --remove-section=.foo --strip-symbol=unused %t %t.out
+# RUN: llvm-readelf -Sr %t.out | FileCheck %s
+
+# CHECK:      [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
+# CHECK-NEXT: [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
+# CHECK-NEXT: [ 1] .text             PROGBITS        0000000000000000 {{.*}} 000008 00   A  0   0  0
+# CHECK-NEXT: [ 2] .crel.text        CREL            0000000000000000 {{.*}} 000022 00      5   1  0
+# CHECK-NEXT: [ 3] nonalloc          PROGBITS        0000000000000000 {{.*}} 000030 00      0   0  0
+# CHECK-NEXT: [ 4] .crelnonalloc     CREL            0000000000000000 {{.*}} 00000b 00      5   3  0
+
+# CHECK:      Relocation section '.crel.text' at offset {{.*}} contains 4 entries:
+# CHECK-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
+# CHECK-NEXT: 0000000000000001  {{.*}}           R_X86_64_32            0000000000000000 g1 + 1
+# CHECK-NEXT: 0000000000000002  {{.*}}           R_X86_64_64            0000000000000000 l1 + 2
+# CHECK-NEXT: 0000000000000000  {{.*}}           R_X86_64_32S           0000000000000000 g1 - 1
+# CHECK-NEXT: 0000000000000004  {{.*}}           R_X86_64_32S           0000000000000000 .text - 8000000000000000
+# CHECK-EMPTY:
+# CHECK-NEXT: Relocation section '.crelnonalloc' at offset {{.*}} contains 3 entries:
+# CHECK-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
+# CHECK-NEXT: 0000000000000010  {{.*}}           R_X86_64_64            0000000000000000 g1 + 1
+# CHECK-NEXT: 0000000000000020  {{.*}}           R_X86_64_64            0000000000000000 g2 + 2
+# CHECK-NEXT: 0000000000000030  {{.*}}           R_X86_64_64                       0
+
+--- !ELF
+FileHeader: !FileHeader
----------------
jh7370 wrote:

This line doesn't look right?

https://github.com/llvm/llvm-project/pull/97521


More information about the llvm-branch-commits mailing list