1 # This tests that comdat undef symbol is overridden by a global symbol.
3 #------------------------
4 # .section .foo,"axG",@progbits,g1,comdat
10 # .section .foo,"axG",@progbits,g1,comdat
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
59 AddressAlign: 0x0000000000000004
62 - SectionOrType: GRP_COMDAT
64 - SectionOrType: .rela.foo
67 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
68 AddressAlign: 0x0000000000000004
72 Flags: [ SHF_WRITE, SHF_ALLOC ]
73 AddressAlign: 0x0000000000000004
77 Flags: [ SHF_WRITE, SHF_ALLOC ]
78 AddressAlign: 0x0000000000000004
82 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
83 AddressAlign: 0x0000000000000001
89 AddressAlign: 0x0000000000000008
92 - Offset: 0x0000000000000000
123 AddressAlign: 0x0000000000000004
126 - SectionOrType: GRP_COMDAT
127 - SectionOrType: .foo
130 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
131 AddressAlign: 0x0000000000000004
135 Flags: [ SHF_WRITE, SHF_ALLOC ]
136 AddressAlign: 0x0000000000000004
140 Flags: [ SHF_WRITE, SHF_ALLOC ]
141 AddressAlign: 0x0000000000000004
145 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
146 AddressAlign: 0x0000000000000001
176 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
177 AddressAlign: 0x0000000000000004
181 Flags: [ SHF_WRITE, SHF_ALLOC ]
182 AddressAlign: 0x0000000000000004
186 Flags: [ SHF_WRITE, SHF_ALLOC ]
187 AddressAlign: 0x0000000000000004
191 Flags: [ SHF_MERGE, SHF_STRINGS ]
192 AddressAlign: 0x0000000000000001
193 Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900
194 - Name: .note.GNU-stack
196 AddressAlign: 0x0000000000000001
214 - Name: .note.GNU-stack
216 Section: .note.GNU-stack
221 Size: 0x0000000000000004