]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/elf/sectionGroups/sectiongroup-with-undef-signature.test
Vendor import of lld trunk r233088:
[FreeBSD/FreeBSD.git] / test / elf / sectionGroups / sectiongroup-with-undef-signature.test
1 # This tests that comdat undef symbol is overridden by a global symbol.
2 # comdat1.s
3 #------------------------
4 # .section .foo,"axG",@progbits,g1,comdat
5 # word g1
6 #
7 #comdat2.s << \!
8 #-----------------
9 #    .global g1
10 #    .section .foo,"axG",@progbits,g1,comdat
11 #g1:
12 #        nop
13 #
14 #global-g1.c
15 #-----------
16 #int g1=10;
17 #
18 #RUN: yaml2obj -format=elf -docnum 1 %s -o %t.comdat1.o
19 #RUN: yaml2obj -format=elf -docnum 2 %s -o %t.comdat2.o
20 #RUN: yaml2obj -format=elf -docnum 3 %s -o %t.g1.o
21 #RUN: lld -flavor gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
22 #RUN: %t.g1.o --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml
23 #RUN: lld -flavor gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
24 #RUN: %t.g1.o --noinhibit-exec -o %t2.out
25 #RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml
26 #RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS
27 #RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS
28 #CHECKGROUP:  - name:            g1
29 #CHECKGROUP:    scope:           global
30 #CHECKGROUP:    content:         [ 0A, 00, 00, 00 ]
31 #CHECKGROUP:    section-name:    .data
32 #CHECKGROUPSECTIONS:    Name: .foo
33 #CHECKGROUPSECTIONS:    Type: SHT_PROGBITS
34 #CHECKGROUPSECTIONS:    Flags [
35 #CHECKGROUPSECTIONS:      SHF_ALLOC
36 #CHECKGROUPSECTIONS:      SHF_EXECINSTR
37 #CHECKGROUPSECTIONS:    ]
38 #CHECKGROUPSECTIONS:    Size: 2
39 #CHECKGROUPSECTIONS:    Name: .data
40 #CHECKGROUPSECTIONS:    Type: SHT_PROGBITS
41 #CHECKGROUPSECTIONS:    Flags [
42 #CHECKGROUPSECTIONS:      SHF_ALLOC
43 #CHECKGROUPSECTIONS:      SHF_WRITE
44 #CHECKGROUPSECTIONS:    ]
45 #CHECKGROUPSECTIONS:    Size: 4
46 #CHECKSYMBOLS:    Name: g1
47 #CHECKSYMBOLS:    Section: .data
48 ---
49 FileHeader:
50   Class:           ELFCLASS64
51   Data:            ELFDATA2LSB
52   OSABI:           ELFOSABI_GNU
53   Type:            ET_REL
54   Machine:         EM_X86_64
55 Sections:
56   - Name:            .group
57     Type:            SHT_GROUP
58     Link:            .symtab
59     AddressAlign:    0x0000000000000004
60     Info:            g1
61     Members:
62       - SectionOrType:   GRP_COMDAT
63       - SectionOrType:   .foo
64       - SectionOrType:   .rela.foo
65   - Name:            .text
66     Type:            SHT_PROGBITS
67     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
68     AddressAlign:    0x0000000000000004
69     Content:         ''
70   - Name:            .data
71     Type:            SHT_PROGBITS
72     Flags:           [ SHF_WRITE, SHF_ALLOC ]
73     AddressAlign:    0x0000000000000004
74     Content:         ''
75   - Name:            .bss
76     Type:            SHT_NOBITS
77     Flags:           [ SHF_WRITE, SHF_ALLOC ]
78     AddressAlign:    0x0000000000000004
79     Content:         ''
80   - Name:            .foo
81     Type:            SHT_PROGBITS
82     Flags:           [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
83     AddressAlign:    0x0000000000000001
84     Content:         '0000'
85   - Name:            .rela.foo
86     Type:            SHT_RELA
87     Flags:           [ SHF_GROUP ]
88     Link:            .symtab
89     AddressAlign:    0x0000000000000008
90     Info:            .foo
91     Relocations:
92       - Offset:          0x0000000000000000
93         Symbol:          g1
94         Type:            R_X86_64_16
95 Symbols:
96   Local:
97     - Name:            .text
98       Type:            STT_SECTION
99       Section:         .text
100     - Name:            .data
101       Type:            STT_SECTION
102       Section:         .data
103     - Name:            .bss
104       Type:            STT_SECTION
105       Section:         .bss
106     - Name:            .foo
107       Type:            STT_SECTION
108       Section:         .foo
109   Global:
110     - Name:            g1
111 ...
112 ---
113 FileHeader:
114   Class:           ELFCLASS64
115   Data:            ELFDATA2LSB
116   OSABI:           ELFOSABI_GNU
117   Type:            ET_REL
118   Machine:         EM_X86_64
119 Sections:
120   - Name:            .group
121     Type:            SHT_GROUP
122     Link:            .symtab
123     AddressAlign:    0x0000000000000004
124     Info:            g1
125     Members:
126       - SectionOrType:   GRP_COMDAT
127       - SectionOrType:   .foo
128   - Name:            .text
129     Type:            SHT_PROGBITS
130     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
131     AddressAlign:    0x0000000000000004
132     Content:         ''
133   - Name:            .data
134     Type:            SHT_PROGBITS
135     Flags:           [ SHF_WRITE, SHF_ALLOC ]
136     AddressAlign:    0x0000000000000004
137     Content:         ''
138   - Name:            .bss
139     Type:            SHT_NOBITS
140     Flags:           [ SHF_WRITE, SHF_ALLOC ]
141     AddressAlign:    0x0000000000000004
142     Content:         ''
143   - Name:            .foo
144     Type:            SHT_PROGBITS
145     Flags:           [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
146     AddressAlign:    0x0000000000000001
147     Content:         '90'
148 Symbols:
149   Local:
150     - Name:            .text
151       Type:            STT_SECTION
152       Section:         .text
153     - Name:            .data
154       Type:            STT_SECTION
155       Section:         .data
156     - Name:            .bss
157       Type:            STT_SECTION
158       Section:         .bss
159     - Name:            .foo
160       Type:            STT_SECTION
161       Section:         .foo
162   Global:
163     - Name:            g1
164       Section:         .foo
165 ...
166 ---
167 FileHeader:
168   Class:           ELFCLASS64
169   Data:            ELFDATA2LSB
170   OSABI:           ELFOSABI_GNU
171   Type:            ET_REL
172   Machine:         EM_X86_64
173 Sections:
174   - Name:            .text
175     Type:            SHT_PROGBITS
176     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
177     AddressAlign:    0x0000000000000004
178     Content:         ''
179   - Name:            .data
180     Type:            SHT_PROGBITS
181     Flags:           [ SHF_WRITE, SHF_ALLOC ]
182     AddressAlign:    0x0000000000000004
183     Content:         0A000000
184   - Name:            .bss
185     Type:            SHT_NOBITS
186     Flags:           [ SHF_WRITE, SHF_ALLOC ]
187     AddressAlign:    0x0000000000000004
188     Content:         ''
189   - Name:            .comment
190     Type:            SHT_PROGBITS
191     Flags:           [ SHF_MERGE, SHF_STRINGS ]
192     AddressAlign:    0x0000000000000001
193     Content:         00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900
194   - Name:            .note.GNU-stack
195     Type:            SHT_PROGBITS
196     AddressAlign:    0x0000000000000001
197     Content:         ''
198 Symbols:
199   Local:
200     - Name:            global-g1.c
201       Type:            STT_FILE
202     - Name:            .text
203       Type:            STT_SECTION
204       Section:         .text
205     - Name:            .data
206       Type:            STT_SECTION
207       Section:         .data
208     - Name:            .bss
209       Type:            STT_SECTION
210       Section:         .bss
211     - Name:            .comment
212       Type:            STT_SECTION
213       Section:         .comment
214     - Name:            .note.GNU-stack
215       Type:            STT_SECTION
216       Section:         .note.GNU-stack
217   Global:
218     - Name:            g1
219       Type:            STT_OBJECT
220       Section:         .data
221       Size:            0x0000000000000004
222 ...