[PATCH] D105404: [lld/mac] Fix function offset on 1st-level unwind table sentinel

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 4 15:10:41 PDT 2021


This revision was automatically updated to reflect the committed changes.
thakis marked an inline comment as done.
Closed by commit rG9e24979d73f1: [lld/mac] Fix function offset on 1st-level unwind table sentinel (authored by thakis).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D105404?vs=356363&id=356404#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105404

Files:
  lld/MachO/UnwindInfoSection.cpp
  lld/test/MachO/compact-unwind.s


Index: lld/test/MachO/compact-unwind.s
===================================================================
--- lld/test/MachO/compact-unwind.s
+++ lld/test/MachO/compact-unwind.s
@@ -43,10 +43,14 @@
 # CHECK:        Personality functions: (count = 2)
 # CHECK-DAG:     personality[{{[0-9]+}}]: 0x{{0*}}[[#MY_PERSONALITY-BASE]]
 # CHECK-DAG:     personality[{{[0-9]+}}]: 0x{{0*}}[[#GXX_PERSONALITY-BASE]]
+# CHECK:      Top level indices: (count = 2)
+# CHECK-DAG:    [0]: function offset={{.*}}, 2nd level page offset=0x[[#%x,PAGEOFF:]],
+# CHECK-DAG:    [1]: function offset={{.*}}, 2nd level page offset=0x00000000,
 # CHECK:        LSDA descriptors:
 # CHECK-DAG:     function offset=0x[[#%.8x,FOO-BASE]],  LSDA offset=0x[[#%.8x,EXCEPTION0-BASE]]
 # CHECK-DAG:     function offset=0x[[#%.8x,MAIN-BASE]], LSDA offset=0x[[#%.8x,EXCEPTION1-BASE]]
 # CHECK:        Second level indices:
+# CHECK-NEXT:   Second level index[0]: offset in section=0x[[#%.8x,PAGEOFF]]
 # CHECK-DAG:     function offset=0x[[#%.8x,MAIN-BASE]], encoding
 # CHECK-DAG:     function offset=0x[[#%.8x,FOO-BASE]], encoding
 # CHECK-DAG:     function offset=0x[[#%.8x,BAZ-BASE]], encoding
Index: lld/MachO/UnwindInfoSection.cpp
===================================================================
--- lld/MachO/UnwindInfoSection.cpp
+++ lld/MachO/UnwindInfoSection.cpp
@@ -571,8 +571,10 @@
     l2PagesOffset += SECOND_LEVEL_PAGE_BYTES;
   }
   // Level-1 sentinel
-  const CompactUnwindEntry<Ptr> &cuEnd = cuVector.back();
-  iep->functionOffset = cuEnd.functionAddress + cuEnd.functionLength;
+  const CompactUnwindEntry<Ptr> &cuEnd = *cuPtrVector.back();
+  assert(cuEnd.functionAddress != TombstoneValue<Ptr>);
+  iep->functionOffset =
+      cuEnd.functionAddress - in.header->addr + cuEnd.functionLength;
   iep->secondLevelPagesSectionOffset = 0;
   iep->lsdaIndexArraySectionOffset =
       lsdaOffset +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105404.356404.patch
Type: text/x-patch
Size: 1882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210704/a1e67305/attachment.bin>


More information about the llvm-commits mailing list