summaryrefslogtreecommitdiff
path: root/test/old-elf/sectionGroups/sectiongroup-new-members.test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:57:38 +0000
commit5a5c549fe9a3fef595297bd21d36bed8409dc37d (patch)
treea964c8f5ac85b7b641cac022c5f9bf4eed3d2b9b /test/old-elf/sectionGroups/sectiongroup-new-members.test
parentfb911942f1434f3d1750f83f25f5e42c80e60638 (diff)
downloadsrc-test2-5a5c549fe9a3fef595297bd21d36bed8409dc37d.tar.gz
src-test2-5a5c549fe9a3fef595297bd21d36bed8409dc37d.zip
Notes
Diffstat (limited to 'test/old-elf/sectionGroups/sectiongroup-new-members.test')
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-new-members.test151
1 files changed, 151 insertions, 0 deletions
diff --git a/test/old-elf/sectionGroups/sectiongroup-new-members.test b/test/old-elf/sectionGroups/sectiongroup-new-members.test
new file mode 100644
index 000000000000..dff1a96b07ee
--- /dev/null
+++ b/test/old-elf/sectionGroups/sectiongroup-new-members.test
@@ -0,0 +1,151 @@
+# 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 foo
+# .global bar
+#foo:
+# .word 0
+#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
+#CHECKSYMBOLS-NOT: Name: bar
+---
+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: '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
+ Global:
+ - Name: bar
+ Section: .text
+ Value: 0x0000000000000002
+ - Name: foo
+ Section: .text
+...