1 # Checks that the linker picks the first group in the output file when the file
2 # have some members dont appear in the first group.
6 # .section .text,"axG",%progbits,foo_group,comdat
12 # .section .text,"axG",%progbits,foo_group,comdat
18 #RUN: yaml2obj -format=elf -docnum 1 %s -o %t.group1a.o
19 #RUN: yaml2obj -format=elf -docnum 2 %s -o %t.group1b.o
20 #RUN: lld -flavor gnu -target x86_64 %t.group1a.o %t.group1b.o \
21 #RUN: --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml
22 #RUN: lld -flavor gnu -target x86_64 %t.group1a.o %t.group1b.o \
23 #RUN: --noinhibit-exec -o %t2.out
24 #RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml
25 #RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS
26 #RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS
27 #CHECKGROUP: - name: foo
28 #CHECKGROUP: scope: global
29 #CHECKGROUP: merge: as-weak
30 #CHECKGROUP: section-name: .text
31 #CHECKGROUP: - name: foo_group
32 #CHECKGROUP: scope: global
33 #CHECKGROUP: type: group-comdat
34 #CHECKGROUP: section-choice: custom-required
35 #CHECKGROUP: section-name: .group
36 #CHECKGROUP: permissions: ---
37 #CHECKGROUP: references:
38 #CHECKGROUP: - kind: group-child
39 #CHECKGROUP: offset: 0
40 #CHECKGROUP: target: foo
41 #CHECKGROUPSECTIONS: Section {
42 #CHECKGROUPSECTIONS: Name: .text
43 #CHECKGROUPSECTIONS: Type: SHT_PROGBITS
44 #CHECKGROUPSECTIONS: Flags [ (0x6)
45 #CHECKGROUPSECTIONS: SHF_ALLOC (0x2)
46 #CHECKGROUPSECTIONS: SHF_EXECINSTR (0x4)
47 #CHECKGROUPSECTIONS: ]
48 #CHECKGROUPSECTIONS: Size: 2
49 #CHECKGROUPSECTIONS: AddressAlignment: 1
50 #CHECKGROUPSECTIONS: }
51 #CHECKSYMBOLS: Name: foo
52 #CHECKSYMBOLS: Type: Function
53 #CHECKSYMBOLS: Section: .text
54 #CHECKSYMBOLS-NOT: Name: bar
66 AddressAlign: 0x0000000000000004
69 - SectionOrType: GRP_COMDAT
70 - SectionOrType: .text
73 Flags: [ SHF_WRITE, SHF_ALLOC ]
74 AddressAlign: 0x0000000000000004
78 Flags: [ SHF_WRITE, SHF_ALLOC ]
79 AddressAlign: 0x0000000000000004
83 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
84 AddressAlign: 0x0000000000000001
114 AddressAlign: 0x0000000000000004
117 - SectionOrType: GRP_COMDAT
118 - SectionOrType: .text
121 Flags: [ SHF_WRITE, SHF_ALLOC ]
122 AddressAlign: 0x0000000000000004
126 Flags: [ SHF_WRITE, SHF_ALLOC ]
127 AddressAlign: 0x0000000000000004
131 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
132 AddressAlign: 0x0000000000000001
150 Value: 0x0000000000000002