mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 15:36:58 +00:00
[ELF] -r: keep sh_entsize for SHF_MERGE sections with relocations
Follow-up to the NFC refactoring 43e3871a327b8e2ff57e16b46d5bc44beb430d91 and test cleanup 3cecf17065919da0a7fa9b38f37592e5462c2f85. SHF_MERGE sections with relocations are handled as InputSection (without duplicate elimination). The output section retains the original sh_entsize in non-relocatable links. This patch ports the behavior for relocatable links as well. https://github.com/ClangBuiltLinux/linux/issues/2057
This commit is contained in:
parent
d6e6478e95
commit
d4bed617f4
@ -904,7 +904,7 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
|
||||
// is acceptable because section merging is optional.
|
||||
if (auto *ms = dyn_cast<MergeInputSection>(s)) {
|
||||
s = makeThreadLocal<InputSection>(ms->file, ms->name, ms->type,
|
||||
ms->flags, ms->addralign, 0,
|
||||
ms->flags, ms->addralign, ms->entsize,
|
||||
ms->contentMaybeDecompress());
|
||||
sections[info] = s;
|
||||
}
|
||||
|
@ -12,9 +12,9 @@
|
||||
# CHECK-NEXT: [ 1] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 4
|
||||
# CHECK-NEXT: [ 2] .rodata.1 PROGBITS 0000000000000000 000040 000004 04 AM 0 0 4
|
||||
# CHECK-NEXT: [ 3] .rodata.2 PROGBITS 0000000000000000 000048 000008 08 AM 0 0 8
|
||||
# CHECK-NEXT: [ 4] .rodata.cst8 PROGBITS 0000000000000000 000050 000010 00 AM 0 0 1
|
||||
# CHECK-NEXT: [ 4] .rodata.cst8 PROGBITS 0000000000000000 000050 000010 08 AM 0 0 1
|
||||
# CHECK-NEXT: [ 5] .rela.rodata.cst8 RELA 0000000000000000 000068 000030 18 I 9 4 8
|
||||
# CHECK-NEXT: [ 6] .cst4 PROGBITS 0000000000000000 000060 000008 00 AM 0 0 1
|
||||
# CHECK-NEXT: [ 6] .cst4 PROGBITS 0000000000000000 000060 000008 04 AM 0 0 1
|
||||
# CHECK-NEXT: [ 7] .rela.cst4 RELA 0000000000000000 000098 000030 18 I 9 6 8
|
||||
|
||||
# OBJDUMP: Contents of section .rodata.1:
|
||||
@ -26,7 +26,7 @@
|
||||
# OBJDUMP: Contents of section .cst4:
|
||||
# OBJDUMP-NEXT: 0000 00000000 00000000 ........
|
||||
|
||||
# CHECK-PDE: [ 2] .cst4 PROGBITS 0000000000200140 000140 000008 00 AM 0 0 1
|
||||
# CHECK-PDE: [ 2] .cst4 PROGBITS 0000000000200140 000140 000008 04 AM 0 0 1
|
||||
|
||||
foo:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user