]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/elf/X86_64/dynamicvars.test
Vendor import of lld trunk r233088:
[FreeBSD/FreeBSD.git] / test / elf / X86_64 / dynamicvars.test
1 # Tests that the dynamic variables created by the linker are set to the right
2 # values.
3
4 #RUN: yaml2obj --format elf -docnum 1 %s -o %t.o
5 #RUN: lld -flavor gnu  -target x86_64 -e main %t.o -o %t1 --noinhibit-exec
6 #RUN: llvm-readobj -sections -symbols %t1 | FileCheck -check-prefix CHECKSYMS %s
7
8
9 #CHECKSYMS:    Name: .dynamic
10 #CHECKSYMS:    Type: SHT_DYNAMIC
11 #CHECKSYMS:    Address: [[TARGETA:[0xa-fA-f0-9]+]]
12 #CHECKSYMS:    Name: .got.plt
13 #CHECKSYMS:    Type: SHT_PROGBITS
14 #CHECKSYMS:    Address: [[TARGETB:[0xa-fA-f0-9]+]]
15 #CHECKSYMS:    Name: _DYNAMIC
16 #CHECKSYMS:    Value: [[TARGETA]]
17 #CHECKSYMS:    Section: .dynamic
18 #CHECKSYMS:    Name: _GLOBAL_OFFSET_TABLE_
19 #CHECKSYMS:    Value: [[TARGETB]]
20 #CHECKSYMS:    Section: .got.plt
21
22 ---
23 FileHeader:
24   Class:           ELFCLASS64
25   Data:            ELFDATA2LSB
26   OSABI:           ELFOSABI_GNU
27   Type:            ET_REL
28   Machine:         EM_X86_64
29 Sections:
30   - Name:            .text
31     Type:            SHT_PROGBITS
32     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
33     AddressAlign:    0x0000000000000010
34     Content:         554889E54883EC10488B0500000000C745FC00000000C7000A000000E80000000031C98945F889C84883C4105DC36690554889E531C05DC3
35   - Name:            .rela.text
36     Type:            SHT_RELA
37     Link:            .symtab
38     AddressAlign:    0x0000000000000008
39     Info:            .text
40     Relocations:
41       - Offset:          0x000000000000000B
42         Symbol:          a
43         Type:            R_X86_64_GOTPCREL
44         Addend:          -4
45       - Offset:          0x000000000000001D
46         Symbol:          foo
47         Type:            R_X86_64_PLT32
48         Addend:          -4
49   - Name:            .data
50     Type:            SHT_PROGBITS
51     Flags:           [ SHF_WRITE, SHF_ALLOC ]
52     AddressAlign:    0x0000000000000004
53     Content:         ''
54   - Name:            .bss
55     Type:            SHT_NOBITS
56     Flags:           [ SHF_WRITE, SHF_ALLOC ]
57     AddressAlign:    0x0000000000000004
58     Content:         ''
59   - Name:            .comment
60     Type:            SHT_PROGBITS
61     Flags:           [ SHF_MERGE, SHF_STRINGS ]
62     AddressAlign:    0x0000000000000001
63     Content:         00636C616E672076657273696F6E20332E362E302000
64   - Name:            .note.GNU-stack
65     Type:            SHT_PROGBITS
66     AddressAlign:    0x0000000000000001
67     Content:         ''
68   - Name:            .eh_frame
69     Type:            SHT_PROGBITS
70     Flags:           [ SHF_ALLOC ]
71     AddressAlign:    0x0000000000000008
72     Content:         1400000000000000037A5200017810011B0C070890010000180000001C000000000000002E00000000410E108602430D060000001800000038000000000000000800000000410E108602430D06000000
73   - Name:            .rela.eh_frame
74     Type:            SHT_RELA
75     Link:            .symtab
76     AddressAlign:    0x0000000000000008
77     Info:            .eh_frame
78     Relocations:
79       - Offset:          0x0000000000000020
80         Symbol:          .text
81         Type:            R_X86_64_PC32
82         Addend:          0
83       - Offset:          0x000000000000003C
84         Symbol:          .text
85         Type:            R_X86_64_PC32
86         Addend:          48
87 Symbols:
88   Local:
89     - Name:            1.c
90       Type:            STT_FILE
91     - Name:            .text
92       Type:            STT_SECTION
93       Section:         .text
94     - Name:            .data
95       Type:            STT_SECTION
96       Section:         .data
97     - Name:            .bss
98       Type:            STT_SECTION
99       Section:         .bss
100     - Name:            .comment
101       Type:            STT_SECTION
102       Section:         .comment
103     - Name:            .note.GNU-stack
104       Type:            STT_SECTION
105       Section:         .note.GNU-stack
106     - Name:            .eh_frame
107       Type:            STT_SECTION
108       Section:         .eh_frame
109   Global:
110     - Name:            a
111       Type:            STT_OBJECT
112       Value:           0x0000000000000004
113       Size:            0x0000000000000004
114     - Name:            foo
115       Type:            STT_FUNC
116       Section:         .text
117       Value:           0x0000000000000030
118       Size:            0x0000000000000008
119     - Name:            main
120       Type:            STT_FUNC
121       Section:         .text
122       Size:            0x000000000000002E
123     - Name:            _GLOBAL_OFFSET_TABLE_
124 ...