1 ## Show that the value field is omitted when a relocation does not reference a symbol.
2 ## In other cases, particularly when a symbol has a zero value or when it has an empty
3 ## name, we print it. Test for both static and dynamic relocation printing.
5 # RUN: yaml2obj %s -o %t
6 # RUN: llvm-readelf --relocations --dyn-relocations %t 2>&1 | FileCheck %s -DFILE=%t
7 # RUN: llvm-readobj --relocations %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=LLVM
9 # CHECK: Relocation section '.rela.text' at offset {{.*}} contains 5 entries:
10 # CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
11 # CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
12 # CHECK-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 sym + 1
13 # CHECK-NEXT: 0000000000000000 0000000200000000 R_X86_64_NONE 0000000000000123 <null> + 456
14 # CHECK-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0x0 (SHN_UNDEF)
15 # CHECK-NEXT: 0000000000000000 0000000300000000 R_X86_64_NONE 0000000000000000 <?> + 678
16 # CHECK-NEXT: 0000000000000000 0000000400000000 R_X86_64_NONE 0000000000000000 <null> + 2
18 # CHECK: Relocation section '.rela.dyn' at offset {{.*}} contains 5 entries:
19 # CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
20 # CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
21 # CHECK-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 sym + 1
22 # CHECK-NEXT: 0000000000000000 0000000200000000 R_X86_64_NONE 0000000000000123 <null> + 456
23 # CHECK-NEXT: 0000000000000000 0000000300000000 R_X86_64_NONE 0000000000000000 <?> + 678
24 # CHECK-NEXT: 0000000000000000 0000000400000000 R_X86_64_NONE 0000000000000000 <null> + 2
26 # CHECK: 'RELA' relocation section at offset {{.*}} contains 120 bytes:
27 # CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
28 # CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
29 # CHECK-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 sym + 1
30 # CHECK-NEXT: 0000000000000000 0000000200000000 R_X86_64_NONE 0000000000000123 <null> + 456
31 # CHECK-NEXT: 0000000000000000 0000000300000000 R_X86_64_NONE 0000000000000000 <null> + 678
32 # CHECK-NEXT: 0000000000000000 0000000400000000 R_X86_64_NONE 0000000000000000 <null> + 2
35 # LLVM-NEXT: Section (2) .rela.text {
36 # LLVM-NEXT: 0x0 R_X86_64_NONE - 0x1
37 # LLVM-NEXT: 0x0 R_X86_64_NONE sym 0x1
38 # LLVM-NEXT: 0x0 R_X86_64_NONE <null> 0x456
39 # LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0x0 (SHN_UNDEF)
40 # LLVM-NEXT: 0x0 R_X86_64_NONE <?> 0x678
41 # LLVM-NEXT: 0x0 R_X86_64_NONE <null> 0x2
43 # LLVM-NEXT: Section (4) .rela.dyn {
44 # LLVM-NEXT: 0x0 R_X86_64_NONE - 0x1
45 # LLVM-NEXT: 0x0 R_X86_64_NONE sym 0x1
46 # LLVM-NEXT: 0x0 R_X86_64_NONE <null> 0x456
47 # LLVM-NEXT: 0x0 R_X86_64_NONE <?> 0x678
48 # LLVM-NEXT: 0x0 R_X86_64_NONE <null> 0x2
82 ## References a symbol with a zero value and an empty name.
123 ## References a symbol with a zero value and an empty name.