xref: /llvm-project/lld/test/ELF/relocation-rel-format.test (revision 767e64fc11d7734843ec5bb0bd3f7330541bb1a6)
1## Test some relocation types for REL format.
2# RUN: yaml2obj -DMACHINE=AARCH64 -DR0=R_AARCH64_ABS64 -DR1=R_AARCH64_PREL32 -DR2=R_AARCH64_PREL64 %s -o %t.o
3# RUN: ld.lld %t.o -o /dev/null
4# RUN: yaml2obj -DMACHINE=PPC -DBITS=32 -DR0=R_PPC_ADDR32 -DR1=R_PPC_REL32 %s -o %t.o
5# RUN: ld.lld %t.o -o /dev/null
6# RUN: yaml2obj -DMACHINE=PPC64 -DR0=R_PPC64_ADDR64 -DR1=R_PPC64_REL32 -DR2=R_PPC64_REL64 %s -o %t.o
7# RUN: ld.lld %t.o -o /dev/null
8
9--- !ELF
10FileHeader:
11  Class:   ELFCLASS[[BITS=64]]
12  Data:    ELFDATA2LSB
13  Type:    ET_REL
14  Machine: EM_[[MACHINE]]
15Sections:
16  - Name:  .text
17    Type:  SHT_PROGBITS
18    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
19    Size:  24
20  - Name:  .data
21    Type:  SHT_PROGBITS
22    Flags: [ SHF_WRITE, SHF_ALLOC ]
23  - Name:  .rel.text
24    Type:  SHT_REL
25    Info:  .text
26    Relocations:
27      - Symbol: .data
28        Type:   [[R0]]
29      - Offset: 8
30        Symbol: .data
31        Type:   [[R1=0]]
32      - Offset: 16
33        Symbol: .data
34        Type:   [[R2=0]]
35Symbols:
36  - Name:    .data
37    Type:    STT_SECTION
38    Section: .data
39  - Name:    _start
40    Section: .text
41    Binding: STB_GLOBAL
42...
43