[PATCH] D129363: [lld][MachO] Fix compact unwind output for 32 bit builds

David Spickett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 04:50:03 PDT 2022


DavidSpickett created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
DavidSpickett requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This test was failing on our 32 bit build bot:
https://lab.llvm.org/buildbot/#/builders/178/builds/2463

This happened because in UnwindInfoSectionImpl::finalize
a decision is made whether to write out regular or compressed
unwind info.

One check in this does:
if (cuPtr->functionAddress >= functionAddressMax) {

  break;

Where cuPtr->functionAddress was uint64_t and functionAddressMax
was uintptr_t, which is 4 bytes on a 32 bit system.

Using uint64_t for functionAddressMax fixes this problem.
Presumably because at only 4 bytes, the max is much lower than
we expect. We're targetting 64 bit though so the size of the max
should match the size of the addresses.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129363

Files:
  lld/MachO/UnwindInfoSection.cpp


Index: lld/MachO/UnwindInfoSection.cpp
===================================================================
--- lld/MachO/UnwindInfoSection.cpp
+++ lld/MachO/UnwindInfoSection.cpp
@@ -506,7 +506,7 @@
     secondLevelPages.emplace_back();
     SecondLevelPage &page = secondLevelPages.back();
     page.entryIndex = i;
-    uintptr_t functionAddressMax =
+    uint64_t functionAddressMax =
         cuEntries[idx].functionAddress + COMPRESSED_ENTRY_FUNC_OFFSET_MASK;
     size_t n = commonEncodings.size();
     size_t wordsRemaining =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129363.443207.patch
Type: text/x-patch
Size: 534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220708/96d2c809/attachment.bin>


More information about the llvm-commits mailing list