summaryrefslogtreecommitdiff
path: root/lld/ELF/InputFiles.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2024-11-23 14:32:32 -0800
committerFangrui Song <i@maskray.me>2024-11-23 14:32:32 -0800
commitd4bed617f4378873d7ddf4b53c041e7b39d1a9ca (patch)
tree54491681d8492a25815b1179f38ad8c610c1b6de /lld/ELF/InputFiles.cpp
parentd6e6478e95d7b20a5c742112c425ea06b85922c4 (diff)
[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
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
-rw-r--r--lld/ELF/InputFiles.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index b89faa57985c..14131dd9f765 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -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;
}