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

            Bug ID: 41664
           Summary: RuntimeDyldImpl::emitSection - Accidental clearing of
                    the most significant bits
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Generic Execution Engine Support
          Assignee: unassignedb...@nondot.org
          Reporter: llvm-...@redking.me.uk
                CC: 1101.deb...@gmail.com, lha...@gmail.com,
                    llvm-bugs@lists.llvm.org

Reported in https://www.viva64.com/en/b/0629/

Expected<unsigned>
RuntimeDyldImpl::emitSection(const ObjectFile &Obj,
                             const SectionRef &Section,
                             bool IsCode) {
  ....
  uint64_t DataSize = Section.getSize();
  ....
  if (StubBufSize > 0)
    DataSize &= ~(getStubAlignment() - 1);
  ....
}

getStubAlignment returns an unsigned, meaning the mask won't extend to the full
uint64_t range, incorrectly aligning the datasize.

The article suggests it should be:

DataSize &= ~(static_cast<uint64_t>(getStubAlignment()) - 1);

or

DataSize &= ~(getStubAlignment() - 1ULL);


Last touched by @lhames at rL310517

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to