1## Show that yaml2obj uses the correct set of symbols for relocation sections
2## referencing the dynamic symbol table.
3
4# RUN: yaml2obj %s -o %t
5# RUN: llvm-readelf -r %t | FileCheck %s
6
7# CHECK:      Relocation section '.rela.dyn' at offset {{.*}} contains 2 entries:
8# CHECK-NEXT:     Offset             Info             Type      Symbol's Value  Symbol's Name
9# CHECK-NEXT: 0000000000000000  0000000100000000 R_X86_64_NONE 0000000012345678 dynamic
10# CHECK-NEXT: 0000000000000008  0000000200000000 R_X86_64_NONE 0000000087654321 both
11# CHECK-EMPTY:
12# CHECK-NEXT: Relocation section '.rela.data' at offset {{.*}} contains 2 entries:
13# CHECK-NEXT:     Offset             Info             Type      Symbol's Value  Symbol's Name
14# CHECK-NEXT: 0000000000000010  0000000200000000 R_X86_64_NONE 0000000011223344 static
15# CHECK-NEXT: 0000000000000018  0000000100000000 R_X86_64_NONE 0000000088776655 both
16
17!ELF
18FileHeader:
19  Class:   ELFCLASS64
20  Data:    ELFDATA2LSB
21  Type:    ET_DYN
22  Machine: EM_X86_64
23Sections:
24  - Name: .data
25    Type: SHT_PROGBITS
26  - Name: .rela.dyn
27    Type: SHT_REL
28    Link: .dynsym
29    Info: .data
30    Relocations:
31      - Type: R_X86_64_NONE
32        Symbol: dynamic
33      - Offset: 8
34        Type: R_X86_64_NONE
35        Symbol: both
36  - Name: .rela.data
37    Type: SHT_REL
38    Link: .symtab
39    Info: .data
40    Relocations:
41      - Offset: 16
42        Type: R_X86_64_NONE
43        Symbol: static
44      - Offset: 24
45        Type: R_X86_64_NONE
46        Symbol: both
47Symbols:
48    - Name: both
49      Section: .data
50      Value: 0x88776655
51      Binding: STB_GLOBAL
52    - Name: static
53      Section: .data
54      Value: 0x11223344
55      Binding: STB_GLOBAL
56DynamicSymbols:
57    - Name: dynamic
58      Section: .data
59      Value: 0x12345678
60      Binding: STB_GLOBAL
61    - Name: both
62      Section: .data
63      Value: 0x87654321
64      Binding: STB_GLOBAL
65