[llvm-bugs] [Bug 39044] New: elf::mergeSections doesn't set alignment to the power of 2

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 21 19:58:22 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39044

            Bug ID: 39044
           Summary: elf::mergeSections doesn't set alignment to the power
                    of 2
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: csong at cs.ucr.edu
                CC: llvm-bugs at lists.llvm.org

In elf::mergeSections (ELF/SyntheticSections.cpp), Alignment is calculated as

  uint32_t Alignment = std::max<uint32_t>(MS->Alignment, MS->Entsize);

When MS->Entsize is larger and is not aligned to power of 2 (seems not
required?), the new alignment will fail the check in
InputSectionBase::InputSectionBase (ELF/InputSection.cpp)

  uint32_t V = std::max<uint64_t>(Alignment, 1);
  if (!isPowerOf2_64(V))
    fatal(toString(File) + ": section sh_addralign is not a power of 2");

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180922/954b0f08/attachment.html>


More information about the llvm-bugs mailing list