[PATCH] D138320: [lld-macho] Fix bug in CUE folding that resulted in wrong unwind table.

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 21:18:30 PST 2022


oontvoo marked 5 inline comments as done.
oontvoo added inline comments.


================
Comment at: lld/MachO/UnwindInfoSection.cpp:659
   const CompactUnwindEntry &cuEnd = cuEntries[cuIndices.back()];
-  iep->functionOffset =
-      cuEnd.functionAddress - in.header->addr + cuEnd.functionLength;
+  iep->functionOffset = finalEndingAddress - in.header->addr;
   iep->secondLevelPagesSectionOffset = 0;
----------------
int3 wrote:
> jyknight wrote:
> > int3 wrote:
> > > I'm not entirely sure why, but this is what ld64 does
> > Adding 1 does make sense. This value is the start of the "next function", so it's an exclusive bound, and you want the final byte of the function to actually be included in the range.
> > 
> That was my initial thought too, but shouldn't adding the length already make it an exclusive bound?
hmm yeah, looks like LD64 does add 1. (here and a couple of lines up in the secondLevelPages loop too).



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138320/new/

https://reviews.llvm.org/D138320



More information about the llvm-commits mailing list