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

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 08:55:35 PST 2022


jyknight 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;
----------------
oontvoo wrote:
> 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).
> 
@int3: oh, good point! ld64's code is actually making it too large by one byte. I suspect that's by accident, and a mistake which we should not replicate.


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