1 # This tests that comdat weak symbol can be overridden by a global symbol.
3 #------------------------
5 # .section .foo,"axG",@progbits,g1,comdat
16 # .section .foo,"axG",@progbits,g1,comdat
28 #RUN: yaml2obj -format=elf -docnum 1 %s -o %t.comdat1.o
29 #RUN: yaml2obj -format=elf -docnum 2 %s -o %t.comdat2.o
30 #RUN: yaml2obj -format=elf -docnum 3 %s -o %t.g1.o
31 #RUN: lld -flavor gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
32 #RUN: %t.g1.o --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml
33 #RUN: lld -flavor gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
34 #RUN: %t.g1.o --noinhibit-exec -o %t2.out
35 #RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml
36 #RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS
37 #RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS
38 #CHECKGROUP: - name: g2
39 #CHECKGROUP: content: [ 90 ]
40 #CHECKGROUP: section-choice: custom-required
41 #CHECKGROUP: section-name: .foo
42 #CHECKGROUP: - name: g1
43 #CHECKGROUP: scope: global
44 #CHECKGROUP: content: [ 55, 48, 89, E5, 31, C0, 5D, C3 ]
45 #CHECKGROUP: alignment: 2^4
46 #CHECKGROUP: section-name: .text
47 #CHECKGROUPSECTIONS: Name: .text
48 #CHECKGROUPSECTIONS: Type: SHT_PROGBITS
49 #CHECKGROUPSECTIONS: Flags [
50 #CHECKGROUPSECTIONS: SHF_ALLOC
51 #CHECKGROUPSECTIONS: SHF_EXECINSTR
52 #CHECKGROUPSECTIONS: ]
53 #CHECKGROUPSECTIONS: Size: 8
54 #CHECKGROUPSECTIONS: Name: .foo
55 #CHECKGROUPSECTIONS: Type: SHT_PROGBITS
56 #CHECKGROUPSECTIONS: Flags [
57 #CHECKGROUPSECTIONS: SHF_ALLOC
58 #CHECKGROUPSECTIONS: SHF_EXECINSTR
59 #CHECKGROUPSECTIONS: ]
60 #CHECKGROUPSECTIONS: Size: 2
61 #CHECKSYMBOLS: Name: g2
62 #CHECKSYMBOLS: Section: .foo
63 #CHECKSYMBOLS: Name: g1
64 #CHECKSYMBOLS: Section: .text
76 AddressAlign: 0x0000000000000004
79 - SectionOrType: GRP_COMDAT
83 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
84 AddressAlign: 0x0000000000000004
88 Flags: [ SHF_WRITE, SHF_ALLOC ]
89 AddressAlign: 0x0000000000000004
93 Flags: [ SHF_WRITE, SHF_ALLOC ]
94 AddressAlign: 0x0000000000000004
98 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
99 AddressAlign: 0x0000000000000001
118 Value: 0x0000000000000001
134 AddressAlign: 0x0000000000000004
137 - SectionOrType: GRP_COMDAT
138 - SectionOrType: .foo
141 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
142 AddressAlign: 0x0000000000000004
146 Flags: [ SHF_WRITE, SHF_ALLOC ]
147 AddressAlign: 0x0000000000000004
151 Flags: [ SHF_WRITE, SHF_ALLOC ]
152 AddressAlign: 0x0000000000000004
156 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
157 AddressAlign: 0x0000000000000001
178 Value: 0x0000000000000001
190 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
191 AddressAlign: 0x0000000000000010
192 Content: 554889E531C05DC3
195 Flags: [ SHF_WRITE, SHF_ALLOC ]
196 AddressAlign: 0x0000000000000004
200 Flags: [ SHF_WRITE, SHF_ALLOC ]
201 AddressAlign: 0x0000000000000004
205 Flags: [ SHF_MERGE, SHF_STRINGS ]
206 AddressAlign: 0x0000000000000001
207 Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900
208 - Name: .note.GNU-stack
210 AddressAlign: 0x0000000000000001
215 AddressAlign: 0x0000000000000008
216 Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000000800000000410E108602430D0600000000000000
217 - Name: .rela.eh_frame
220 AddressAlign: 0x0000000000000008
223 - Offset: 0x0000000000000020
242 - Name: .note.GNU-stack
244 Section: .note.GNU-stack
252 Size: 0x0000000000000008