[ELF] - Do not merge sections from SHT_GROUP when -relocatable
This is PR34506.
Imagine we have 2 sections the same name but different COMDAT groups:
.section .foo,"axG",@progbits,bar,comdat
.section .foo,"axG",@progbits,zed,comdat
When linking relocatable we do not merge SHT_GROUP sections. But still would merge
both input sections .foo into single output section .foo.
As a result we will have 2 different SHT_GROUPs containing the same section, what
is wrong.
Patch fixes the issue, preventing merging SHF_GROUP sections with any others.
Differential revision: https://reviews.llvm.org/D37574
llvm-svn: 313621
2017-09-19 09:40:31 +00:00
|
|
|
# REQUIRES: x86
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
|
|
|
# RUN: ld.lld -r %t.o -o %t
|
2019-05-01 05:49:01 +00:00
|
|
|
# RUN: llvm-readobj --elf-section-groups -S %t | FileCheck %s
|
[ELF] - Do not merge sections from SHT_GROUP when -relocatable
This is PR34506.
Imagine we have 2 sections the same name but different COMDAT groups:
.section .foo,"axG",@progbits,bar,comdat
.section .foo,"axG",@progbits,zed,comdat
When linking relocatable we do not merge SHT_GROUP sections. But still would merge
both input sections .foo into single output section .foo.
As a result we will have 2 different SHT_GROUPs containing the same section, what
is wrong.
Patch fixes the issue, preventing merging SHF_GROUP sections with any others.
Differential revision: https://reviews.llvm.org/D37574
llvm-svn: 313621
2017-09-19 09:40:31 +00:00
|
|
|
|
|
|
|
## Check .foo was not merged.
|
|
|
|
# CHECK: Sections [
|
|
|
|
# CHECK: Name: .foo
|
|
|
|
# CHECK: Name: .foo
|
|
|
|
# CHECK: Name: .foo
|
|
|
|
|
|
|
|
# CHECK: Groups {
|
|
|
|
# CHECK-NEXT: Group {
|
|
|
|
# CHECK-NEXT: Name: .group
|
|
|
|
# CHECK-NEXT: Index: 2
|
2018-08-29 07:27:09 +00:00
|
|
|
# CHECK-NEXT: Link: 8
|
2018-03-13 00:07:53 +00:00
|
|
|
# CHECK-NEXT: Info: 1
|
[ELF] - Do not merge sections from SHT_GROUP when -relocatable
This is PR34506.
Imagine we have 2 sections the same name but different COMDAT groups:
.section .foo,"axG",@progbits,bar,comdat
.section .foo,"axG",@progbits,zed,comdat
When linking relocatable we do not merge SHT_GROUP sections. But still would merge
both input sections .foo into single output section .foo.
As a result we will have 2 different SHT_GROUPs containing the same section, what
is wrong.
Patch fixes the issue, preventing merging SHF_GROUP sections with any others.
Differential revision: https://reviews.llvm.org/D37574
llvm-svn: 313621
2017-09-19 09:40:31 +00:00
|
|
|
# CHECK-NEXT: Type: COMDAT
|
|
|
|
# CHECK-NEXT: Signature: bar
|
|
|
|
# CHECK-NEXT: Section(s) in group [
|
|
|
|
# CHECK-NEXT: .foo (3)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Group {
|
|
|
|
# CHECK-NEXT: Name: .group
|
|
|
|
# CHECK-NEXT: Index: 4
|
2018-08-29 07:27:09 +00:00
|
|
|
# CHECK-NEXT: Link: 8
|
2018-03-13 00:07:53 +00:00
|
|
|
# CHECK-NEXT: Info: 2
|
[ELF] - Do not merge sections from SHT_GROUP when -relocatable
This is PR34506.
Imagine we have 2 sections the same name but different COMDAT groups:
.section .foo,"axG",@progbits,bar,comdat
.section .foo,"axG",@progbits,zed,comdat
When linking relocatable we do not merge SHT_GROUP sections. But still would merge
both input sections .foo into single output section .foo.
As a result we will have 2 different SHT_GROUPs containing the same section, what
is wrong.
Patch fixes the issue, preventing merging SHF_GROUP sections with any others.
Differential revision: https://reviews.llvm.org/D37574
llvm-svn: 313621
2017-09-19 09:40:31 +00:00
|
|
|
# CHECK-NEXT: Type: COMDAT
|
|
|
|
# CHECK-NEXT: Signature: zed
|
|
|
|
# CHECK-NEXT: Section(s) in group [
|
|
|
|
# CHECK-NEXT: .foo (5)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
|
|
|
|
.section .foo,"axG",@progbits,bar,comdat
|
|
|
|
.section .foo,"axG",@progbits,zed,comdat
|
|
|
|
.section .foo,"ax",@progbits
|