summaryrefslogtreecommitdiff
path: root/test/old-elf/sectionGroups
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
parentfb911942f1434f3d1750f83f25f5e42c80e60638 (diff)
Notes
Diffstat (limited to 'test/old-elf/sectionGroups')
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-new-members.test151
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-simple.test144
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-undef-member-other.test156
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-undef-member.test142
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test250
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test236
-rw-r--r--test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test219
7 files changed, 1298 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 0000000000000..dff1a96b07ee5
--- /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
+...
diff --git a/test/old-elf/sectionGroups/sectiongroup-simple.test b/test/old-elf/sectionGroups/sectiongroup-simple.test
new file mode 100644
index 0000000000000..57707f84475e4
--- /dev/null
+++ b/test/old-elf/sectionGroups/sectiongroup-simple.test
@@ -0,0 +1,144 @@
+# 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
+...
diff --git a/test/old-elf/sectionGroups/sectiongroup-undef-member-other.test b/test/old-elf/sectionGroups/sectiongroup-undef-member-other.test
new file mode 100644
index 0000000000000..56595e59d8d6e
--- /dev/null
+++ b/test/old-elf/sectionGroups/sectiongroup-undef-member-other.test
@@ -0,0 +1,156 @@
+# Tests that linker throws an error for an undefined symbol in the section
+# group, which is the same as the signature in the next input file.
+# comdat1.s
+# ------------
+# .section .foo,"axG",@progbits,g1,comdat
+# .word g1
+#comdat2.s
+#-----------
+# .global g1
+# .section .bar,"axG",@progbits,g1,comdat
+#g2:
+# nop
+# .section .car,"axG",@progbits,g1,comdat
+#g3:
+# nop
+#
+#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 -o %t2.out 2>&1 | FileCheck %s
+#CHECK: Undefined symbol: {{.*}} g1
+---
+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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - SectionOrType: .rela.foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '0000'
+ - Name: .rela.foo
+ Type: SHT_RELA
+ Flags: [ SHF_GROUP ]
+ Link: .symtab
+ AddressAlign: 0x0000000000000008
+ Info: .foo
+ Relocations:
+ - Offset: 0x0000000000000000
+ Symbol: g1
+ Type: R_X86_64_16
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ - Name: .group
+ Type: STT_SECTION
+ Section: .group
+ Global:
+ - Name: g1
+...
+---
+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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .bar
+ - SectionOrType: .car
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .bar
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '90'
+ - Name: .car
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '90'
+Symbols:
+ Local:
+ - Name: g2
+ Section: .bar
+ - Name: g3
+ Section: .car
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .bar
+ Type: STT_SECTION
+ Section: .bar
+ - Name: .car
+ Type: STT_SECTION
+ Section: .car
+ - Name: .group
+ Type: STT_SECTION
+ Section: .group
+ Global:
+ - Name: g1
+ Section: .group
+...
diff --git a/test/old-elf/sectionGroups/sectiongroup-undef-member.test b/test/old-elf/sectionGroups/sectiongroup-undef-member.test
new file mode 100644
index 0000000000000..65e9ec7632bfd
--- /dev/null
+++ b/test/old-elf/sectionGroups/sectiongroup-undef-member.test
@@ -0,0 +1,142 @@
+# Tests that linker throws an error for an undefined symbol in the section
+# group.
+#
+#comdata.s
+#------------
+# .section .foo,"axG",@progbits,g1,comdat
+# .word g1
+#
+#comdatb.s
+#------------
+# .global g1
+# .section .foo,"axG",@progbits,g1,comdat
+#g1:
+# nop
+#
+#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 -o %t2.out 2>&1 | FileCheck %s
+#CHECK: Undefined symbol: {{.*}} g1
+---
+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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - SectionOrType: .rela.foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '0000'
+ - Name: .rela.foo
+ Type: SHT_RELA
+ Flags: [ SHF_GROUP ]
+ Link: .symtab
+ AddressAlign: 0x0000000000000008
+ Info: .foo
+ Relocations:
+ - Offset: 0x0000000000000000
+ Symbol: g1
+ Type: R_X86_64_16
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ - Name: .group
+ Type: STT_SECTION
+ Section: .group
+ Global:
+ - Name: g1
+...
+---
+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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '90'
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ - Name: .group
+ Type: STT_SECTION
+ Section: .group
+ Global:
+ - Name: g1
+ Section: .foo
+...
diff --git a/test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test b/test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test
new file mode 100644
index 0000000000000..9f8f80c23605d
--- /dev/null
+++ b/test/old-elf/sectionGroups/sectiongroup-with-globalsymbols.test
@@ -0,0 +1,250 @@
+# This tests that comdat weak symbol can be overridden by a global symbol.
+# comdat1.s
+#------------------------
+# .weak g1
+# .section .foo,"axG",@progbits,g1,comdat
+#g1:
+# nop
+# .global g2
+#g2:
+# nop
+#!
+#
+#comdat2.s << \!
+#-----------------
+# .global g1
+# .section .foo,"axG",@progbits,g1,comdat
+#g1:
+# nop
+# .global g2
+#g2:
+# nop
+#
+#cat > g1.c << \!
+#int g1() {
+# return 0;
+#}
+#
+#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.comdat1.o
+#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.comdat2.o
+#RUN: yaml2obj -format=elf -docnum 3 %s -o %t.g1.o
+#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
+#RUN: %t.g1.o --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml
+#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
+#RUN: %t.g1.o --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: g2
+#CHECKGROUP: content: [ 90 ]
+#CHECKGROUP: section-choice: custom-required
+#CHECKGROUP: section-name: .foo
+#CHECKGROUP: - name: g1
+#CHECKGROUP: scope: global
+#CHECKGROUP: content: [ 55, 48, 89, E5, 31, C0, 5D, C3 ]
+#CHECKGROUP: alignment: 16
+#CHECKGROUP: section-name: .text
+#CHECKGROUPSECTIONS: Name: .text
+#CHECKGROUPSECTIONS: Type: SHT_PROGBITS
+#CHECKGROUPSECTIONS: Flags [
+#CHECKGROUPSECTIONS: SHF_ALLOC
+#CHECKGROUPSECTIONS: SHF_EXECINSTR
+#CHECKGROUPSECTIONS: ]
+#CHECKGROUPSECTIONS: Size: 8
+#CHECKGROUPSECTIONS: Name: .foo
+#CHECKGROUPSECTIONS: Type: SHT_PROGBITS
+#CHECKGROUPSECTIONS: Flags [
+#CHECKGROUPSECTIONS: SHF_ALLOC
+#CHECKGROUPSECTIONS: SHF_EXECINSTR
+#CHECKGROUPSECTIONS: ]
+#CHECKGROUPSECTIONS: Size: 2
+#CHECKSYMBOLS: Name: g2
+#CHECKSYMBOLS: Section: .foo
+#CHECKSYMBOLS: Name: g1
+#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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '9090'
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ Global:
+ - Name: g2
+ Section: .foo
+ Value: 0x0000000000000001
+ Weak:
+ - Name: g1
+ Section: .foo
+...
+---
+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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '9090'
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ Global:
+ - Name: g1
+ Section: .foo
+ - Name: g2
+ Section: .foo
+ Value: 0x0000000000000001
+...
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_GNU
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000010
+ Content: 554889E531C05DC3
+ - 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: .comment
+ Type: SHT_PROGBITS
+ Flags: [ SHF_MERGE, SHF_STRINGS ]
+ AddressAlign: 0x0000000000000001
+ Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900
+ - Name: .note.GNU-stack
+ Type: SHT_PROGBITS
+ AddressAlign: 0x0000000000000001
+ Content: ''
+ - Name: .eh_frame
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ AddressAlign: 0x0000000000000008
+ Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000000800000000410E108602430D0600000000000000
+ - Name: .rela.eh_frame
+ Type: SHT_RELA
+ Link: .symtab
+ AddressAlign: 0x0000000000000008
+ Info: .eh_frame
+ Relocations:
+ - Offset: 0x0000000000000020
+ Symbol: .text
+ Type: R_X86_64_PC32
+Symbols:
+ Local:
+ - Name: g1.c
+ Type: STT_FILE
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .comment
+ Type: STT_SECTION
+ Section: .comment
+ - Name: .note.GNU-stack
+ Type: STT_SECTION
+ Section: .note.GNU-stack
+ - Name: .eh_frame
+ Type: STT_SECTION
+ Section: .eh_frame
+ Global:
+ - Name: g1
+ Type: STT_FUNC
+ Section: .text
+ Size: 0x0000000000000008
+...
diff --git a/test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test b/test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test
new file mode 100644
index 0000000000000..0c5d65ad544ff
--- /dev/null
+++ b/test/old-elf/sectionGroups/sectiongroup-with-undef-external-reference.test
@@ -0,0 +1,236 @@
+# This tests that comdat undef symbol is overridden by a global symbol.
+# comdat1.s
+#------------------------
+# .global g1
+# .section .foo,"axG",@progbits,g1,comdat
+#g1:
+# .word 5
+#
+#comdat2.s << \!
+#-----------------
+# .global g1
+# .section .foo,"axG",@progbits,g1,comdat
+#g1:
+# nop
+#
+#g1.c
+#-----------
+#extern int g1;
+#int fn() { return g1;}
+#
+#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.comdat1.o
+#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.comdat2.o
+#RUN: yaml2obj -format=elf -docnum 3 %s -o %t.g1.o
+#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
+#RUN: %t.g1.o --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml
+#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
+#RUN: %t.g1.o --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: g1
+#CHECKGROUP: scope: global
+#CHECKGROUP: content: [ 05, 00 ]
+#CHECKGROUP: section-name: .foo
+#CHECKGROUPSECTIONS: Section {
+#CHECKGROUPSECTIONS: Name: .foo
+#CHECKGROUPSECTIONS: Type: SHT_PROGBITS
+#CHECKGROUPSECTIONS: Flags [
+#CHECKGROUPSECTIONS: SHF_ALLOC
+#CHECKGROUPSECTIONS: SHF_EXECINSTR
+#CHECKGROUPSECTIONS: ]
+#CHECKGROUPSECTIONS: Size: 2
+#CHECKGROUPSECTIONS: }
+#CHECKSYMBOLS: Name: g1
+#CHECKSYMBOLS: Section: .foo
+#CHECKSYMBOLS: Name: fn
+#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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '0500'
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ Global:
+ - Name: g1
+ Section: .foo
+...
+---
+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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '90'
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ Global:
+ - Name: g1
+ Section: .foo
+...
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_GNU
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000010
+ Content: 554889E58B0425000000005DC3
+ - Name: .rela.text
+ Type: SHT_RELA
+ Link: .symtab
+ AddressAlign: 0x0000000000000008
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000007
+ Symbol: g1
+ Type: R_X86_64_32S
+ - 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: .comment
+ Type: SHT_PROGBITS
+ Flags: [ SHF_MERGE, SHF_STRINGS ]
+ AddressAlign: 0x0000000000000001
+ Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900
+ - Name: .note.GNU-stack
+ Type: SHT_PROGBITS
+ AddressAlign: 0x0000000000000001
+ Content: ''
+ - Name: .eh_frame
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ AddressAlign: 0x0000000000000008
+ Content: 1400000000000000037A5200017810011B0C0708900100001C0000001C000000000000000D00000000410E108602430D0600000000000000
+ - Name: .rela.eh_frame
+ Type: SHT_RELA
+ Link: .symtab
+ AddressAlign: 0x0000000000000008
+ Info: .eh_frame
+ Relocations:
+ - Offset: 0x0000000000000020
+ Symbol: .text
+ Type: R_X86_64_PC32
+Symbols:
+ Local:
+ - Name: global-g1.c
+ Type: STT_FILE
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .comment
+ Type: STT_SECTION
+ Section: .comment
+ - Name: .note.GNU-stack
+ Type: STT_SECTION
+ Section: .note.GNU-stack
+ - Name: .eh_frame
+ Type: STT_SECTION
+ Section: .eh_frame
+ Global:
+ - Name: fn
+ Type: STT_FUNC
+ Section: .text
+ Size: 0x000000000000000D
+ - Name: g1
+...
diff --git a/test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test b/test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test
new file mode 100644
index 0000000000000..83a69a3828b22
--- /dev/null
+++ b/test/old-elf/sectionGroups/sectiongroup-with-undef-signature.test
@@ -0,0 +1,219 @@
+# This tests that comdat undef symbol is overridden by a global symbol.
+# comdat1.s
+#------------------------
+# .section .foo,"axG",@progbits,g1,comdat
+# word g1
+#
+#comdat2.s << \!
+#-----------------
+# .global g1
+# .section .foo,"axG",@progbits,g1,comdat
+#g1:
+# nop
+#
+#global-g1.c
+#-----------
+#int g1=10;
+#
+#RUN: yaml2obj -format=elf -docnum 1 %s -o %t.comdat1.o
+#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.comdat2.o
+#RUN: yaml2obj -format=elf -docnum 3 %s -o %t.g1.o
+#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
+#RUN: %t.g1.o --noinhibit-exec --output-filetype=yaml -o %t2.out.yaml
+#RUN: lld -flavor old-gnu -target x86_64 %t.comdat1.o %t.comdat2.o \
+#RUN: %t.g1.o --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: g1
+#CHECKGROUP: scope: global
+#CHECKGROUP: content: [ 0A, 00, 00, 00 ]
+#CHECKGROUP: section-name: .data
+#CHECKGROUPSECTIONS: Name: .foo
+#CHECKGROUPSECTIONS: Type: SHT_PROGBITS
+#CHECKGROUPSECTIONS: Flags [
+#CHECKGROUPSECTIONS: SHF_ALLOC
+#CHECKGROUPSECTIONS: SHF_EXECINSTR
+#CHECKGROUPSECTIONS: ]
+#CHECKGROUPSECTIONS: Size: 2
+#CHECKGROUPSECTIONS: Name: .data
+#CHECKGROUPSECTIONS: Type: SHT_PROGBITS
+#CHECKGROUPSECTIONS: Flags [
+#CHECKGROUPSECTIONS: SHF_ALLOC
+#CHECKGROUPSECTIONS: SHF_WRITE
+#CHECKGROUPSECTIONS: ]
+#CHECKGROUPSECTIONS: Size: 4
+#CHECKSYMBOLS: Name: g1
+#CHECKSYMBOLS: Section: .data
+---
+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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - SectionOrType: .rela.foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '0000'
+ - Name: .rela.foo
+ Type: SHT_RELA
+ Flags: [ SHF_GROUP ]
+ Link: .symtab
+ AddressAlign: 0x0000000000000008
+ Info: .foo
+ Relocations:
+ - Offset: 0x0000000000000000
+ Symbol: g1
+ Type: R_X86_64_16
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ Global:
+ - Name: g1
+...
+---
+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: g1
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .foo
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - 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: .foo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
+ AddressAlign: 0x0000000000000001
+ Content: '90'
+Symbols:
+ Local:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .foo
+ Type: STT_SECTION
+ Section: .foo
+ Global:
+ - Name: g1
+ Section: .foo
+...
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_GNU
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - Name: .data
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000004
+ Content: 0A000000
+ - Name: .bss
+ Type: SHT_NOBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000004
+ - Name: .comment
+ Type: SHT_PROGBITS
+ Flags: [ SHF_MERGE, SHF_STRINGS ]
+ AddressAlign: 0x0000000000000001
+ Content: 00636C616E672076657273696F6E20332E372E3020287472756E6B203232393535372920286C6C766D2F7472756E6B203232393536332900
+ - Name: .note.GNU-stack
+ Type: SHT_PROGBITS
+ AddressAlign: 0x0000000000000001
+ Content: ''
+Symbols:
+ Local:
+ - Name: global-g1.c
+ Type: STT_FILE
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ - Name: .data
+ Type: STT_SECTION
+ Section: .data
+ - Name: .bss
+ Type: STT_SECTION
+ Section: .bss
+ - Name: .comment
+ Type: STT_SECTION
+ Section: .comment
+ - Name: .note.GNU-stack
+ Type: STT_SECTION
+ Section: .note.GNU-stack
+ Global:
+ - Name: g1
+ Type: STT_OBJECT
+ Section: .data
+ Size: 0x0000000000000004
+...