llvm-project/lld/test/old-elf/sectionGroups/sectiongroup-simple.test

145 lines
4.5 KiB
Plaintext

# Checks that the linker picks the first group in the output file when the file
# have some members dont appear in the first group.
# 1a.s
# ------
# .section .text,"axG",%progbits,foo_group,comdat
# .weak foo
#foo:
# .word 0
# 1b.s
# -----
# .section .text,"axG",%progbits,foo_group,comdat
# .global bar
#bar:
#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.group1a.o
#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.group1b.o
#RUN: lld -flavor old-gnu -target x86_64 %t.group1a.o %t.group1b.o \
#RUN: --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml
#RUN: lld -flavor old-gnu -target x86_64 %t.group1a.o %t.group1b.o \
#RUN: --noinhibit-exec -o %t2.out
#RUN: FileCheck %s -check-prefix=CHECKGROUP < %t2.out.yaml
#RUN: llvm-readobj -sections %t2.out | FileCheck %s -check-prefix=CHECKGROUPSECTIONS
#RUN: llvm-readobj -symbols %t2.out | FileCheck %s -check-prefix=CHECKSYMBOLS
#CHECKGROUP: - name: foo
#CHECKGROUP: scope: global
#CHECKGROUP: merge: as-weak
#CHECKGROUP: section-name: .text
#CHECKGROUP: - name: foo_group
#CHECKGROUP: scope: global
#CHECKGROUP: type: group-comdat
#CHECKGROUP: section-choice: custom-required
#CHECKGROUP: section-name: .group
#CHECKGROUP: permissions: ---
#CHECKGROUP: references:
#CHECKGROUP: - kind: group-child
#CHECKGROUP: offset: 0
#CHECKGROUP: target: foo
#CHECKGROUPSECTIONS: Section {
#CHECKGROUPSECTIONS: Name: .text
#CHECKGROUPSECTIONS: Type: SHT_PROGBITS
#CHECKGROUPSECTIONS: Flags [ (0x6)
#CHECKGROUPSECTIONS: SHF_ALLOC (0x2)
#CHECKGROUPSECTIONS: SHF_EXECINSTR (0x4)
#CHECKGROUPSECTIONS: ]
#CHECKGROUPSECTIONS: Size: 2
#CHECKGROUPSECTIONS: AddressAlignment: 1
#CHECKGROUPSECTIONS: }
#CHECKSYMBOLS: Name: foo
#CHECKSYMBOLS: Type: Function
#CHECKSYMBOLS: Section: .text
---
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
OSABI: ELFOSABI_GNU
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .group
Type: SHT_GROUP
Link: .symtab
AddressAlign: 0x0000000000000004
Info: foo_group
Members:
- SectionOrType: GRP_COMDAT
- SectionOrType: .text
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
AddressAlign: 0x0000000000000001
Content: '0000'
Symbols:
Local:
- Name: foo_group
Section: .group
- Name: .text
Type: STT_SECTION
Section: .text
- Name: .data
Type: STT_SECTION
Section: .data
- Name: .bss
Type: STT_SECTION
Section: .bss
Weak:
- Name: foo
Section: .text
...
---
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
OSABI: ELFOSABI_GNU
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .group
Type: SHT_GROUP
Link: .symtab
AddressAlign: 0x0000000000000004
Info: foo_group
Members:
- SectionOrType: GRP_COMDAT
- SectionOrType: .text
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
AddressAlign: 0x0000000000000001
Content: ''
Symbols:
Local:
- Name: foo_group
Section: .group
- Name: .text
Type: STT_SECTION
Section: .text
- Name: .data
Type: STT_SECTION
Section: .data
- Name: .bss
Type: STT_SECTION
Section: .bss
Global:
- Name: bar
Section: .text
...