Recommit "rL366894: [yaml2obj] - Allow custom fields for the SHT_UNDEF sections."
[llvm-complete.git] / test / tools / llvm-readobj / elf-reloc-negative-addend-no-sym.test
blob86ec658f19a8d9ee01cee134e2bb23610e844071
1 # Show that llvm-readelf properly prints the addend for relocations that do not
2 # have an associated symbol but have a negative addend.
4 # RUN: yaml2obj %s -o %t
5 # RUN: llvm-readelf --relocations %t | FileCheck %s --check-prefix=REL
6 # RUN: llvm-readelf --dyn-relocations %t | FileCheck %s --check-prefix=DYN
8 # REL:      Relocation section '.rela.text' at offset {{.*}} contains 1 entries:
9 # REL-NEXT:    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
10 # REL-NEXT: 0000000000000000  0000000000000000 R_X86_64_NONE                     ffffffffffffffff
11 # REL-EMPTY:
12 # REL-NEXT: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:
13 # REL-NEXT:    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
14 # REL-NEXT: 0000000000000008  0000000000000000 R_X86_64_NONE                     ffffffffffffffff
16 # DYN:      'RELA' relocation section at offset {{.*}} contains 24 bytes:
17 # DYN-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
18 # DYN-NEXT: 0000000000000008  0000000000000000 R_X86_64_NONE                     ffffffffffffffff
20 --- !ELF
21 FileHeader:
22   Class:   ELFCLASS64
23   Data:    ELFDATA2LSB
24   Type:    ET_EXEC
25   Machine: EM_X86_64
26 Sections:
27   - Name: .text
28     Type: SHT_PROGBITS
29     Size: 0x10
30   - Name: .rela.text
31     Type: SHT_RELA
32     Link: .symtab
33     Info: .text
34     Relocations:
35       - Offset: 0
36         Type: R_X86_64_NONE
37         Addend: -1
38   - Name: .dynamic
39     Type: SHT_DYNAMIC
40     Flags: [SHF_ALLOC]
41     Address: 0x1000
42     AddressAlign: 0x1000
43     Entries:
44       - Tag: DT_RELA
45         Value: 0x1100
46       - Tag: DT_RELASZ
47         Value: 24
48       - Tag: DT_RELAENT
49         Value: 24
50       - Tag: DT_NULL
51         Value: 0
52   - Name: .rela.dyn
53     Type: SHT_RELA
54     Flags: [SHF_ALLOC]
55     Info: .text
56     Address: 0x1100
57     AddressAlign: 0x100
58     Relocations:
59       - Offset: 8
60         Type: R_X86_64_NONE
61         Addend: -1
62 DynamicSymbols:
63   - Name:    force_dynsym
64     Binding: STB_GLOBAL
65 ProgramHeaders:
66   - Type: PT_LOAD
67     VAddr: 0x1000
68     Sections:
69       - Section: .rela.dyn
70       - Section: .dynamic
71   - Type: PT_DYNAMIC
72     VAddr: 0x1000
73     Sections:
74       - Section: .dynamic