diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-10-21 20:52:45 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-10-21 20:52:45 +0000 |
commit | 0841ff09cd03445bb3d29b045deca06bf6a8750e (patch) | |
tree | 54c0316256c8d45004dc0c308b53432b0559ba07 /gnu | |
parent | 8d87917fec622d5163d76303e8ff7b349641ae5f (diff) |
When merging sections into the output, lld tries to adjust the alignment of
the section to be at least as large as the entry size of the section.
This causes a later check that validates the alignment to fail if the
entry size isn't a power of two. This happens when building some of the
java support code in ports gcc. Fix this by sticking to the original
alignment if the entry size isn't a power of two.
ok guenther@, naddy@
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/llvm/tools/lld/ELF/SyntheticSections.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp b/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp index 4dd16a2ae24..415c58bde3d 100644 --- a/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp +++ b/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp @@ -2512,7 +2512,9 @@ void elf::mergeSections() { continue; StringRef OutsecName = getOutputSectionName(MS); - uint32_t Alignment = std::max<uint32_t>(MS->Alignment, MS->Entsize); + uint32_t Alignment = MS->Alignment; + if (isPowerOf2_32(MS->Entsize)) + Alignment = std::max<uint32_t>(Alignment, MS->Entsize); auto I = llvm::find_if(MergeSections, [=](MergeSyntheticSection *Sec) { // While we could create a single synthetic section for two different |