[PATCH] D107533: [lld-macho] Allow encode up to 4 personality symbols.
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 5 11:13:04 PDT 2021
oontvoo updated this revision to Diff 364558.
oontvoo marked an inline comment as done.
oontvoo added a comment.
Encode the personality index as 0-based
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107533/new/
https://reviews.llvm.org/D107533
Files:
lld/MachO/UnwindInfoSection.cpp
lld/test/MachO/invalid/compact-unwind-personalities.s
lld/test/MachO/valid-personalities-count.s
Index: lld/test/MachO/valid-personalities-count.s
===================================================================
--- lld/test/MachO/valid-personalities-count.s
+++ lld/test/MachO/valid-personalities-count.s
@@ -1,9 +1,9 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %s -o %t.o
-# RUN: not %lld -pie -lSystem -lc++ %t.o -o %t 2>&1 | FileCheck %s --check-prefix=TOO-MANY
-# RUN: not %lld -pie -lSystem %t.o -o %t 2>&1 | FileCheck %s --check-prefix=UNDEF
-# TOO-MANY: error: too many personalities (4) for compact unwind to encode
-# UNDEF: error: undefined symbol: ___gxx_personality_v0
+# RUN: not %lld -pie -lSystem %t.o -o %t 2>&1 | FileCheck %s
+# CHECK-NOT: too many personalities (4)
+
+
.globl _main, _personality_1, _personality_2, _personality_3
Index: lld/test/MachO/invalid/compact-unwind-personalities.s
===================================================================
--- lld/test/MachO/invalid/compact-unwind-personalities.s
+++ lld/test/MachO/invalid/compact-unwind-personalities.s
@@ -2,10 +2,10 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 %s -o %t.o
# RUN: not %lld -pie -lSystem -lc++ %t.o -o %t 2>&1 | FileCheck %s --check-prefix=TOO-MANY
# RUN: not %lld -pie -lSystem %t.o -o %t 2>&1 | FileCheck %s --check-prefix=UNDEF
-# TOO-MANY: error: too many personalities (4) for compact unwind to encode
+# TOO-MANY: error: too many personalities (5) for compact unwind to encode
# UNDEF: error: undefined symbol: ___gxx_personality_v0
-.globl _main, _personality_1, _personality_2, _personality_3
+.globl _main, _personality_1, _personality_2, _personality_3, _personality_4
.text
@@ -30,6 +30,13 @@
retq
.cfi_endproc
+_bas:
+ .cfi_startproc
+ .cfi_personality 155, _personality_4
+ .cfi_def_cfa_offset 16
+ retq
+ .cfi_endproc
+
_main:
.cfi_startproc
.cfi_personality 155, ___gxx_personality_v0
@@ -43,3 +50,5 @@
retq
_personality_3:
retq
+_personality_4:
+ retq
Index: lld/MachO/UnwindInfoSection.cpp
===================================================================
--- lld/MachO/UnwindInfoSection.cpp
+++ lld/MachO/UnwindInfoSection.cpp
@@ -292,9 +292,9 @@
continue;
// Linear search is fast enough for a small array.
auto it = find(personalities, cu->personality);
- uint32_t personalityIndex; // 1-based index
+ uint32_t personalityIndex; // 0-based index
if (it != personalities.end()) {
- personalityIndex = std::distance(personalities.begin(), it) + 1;
+ personalityIndex = std::distance(personalities.begin(), it);
} else {
personalities.push_back(cu->personality);
personalityIndex = personalities.size();
@@ -303,7 +303,8 @@
personalityIndex << countTrailingZeros(
static_cast<compact_unwind_encoding_t>(UNWIND_PERSONALITY_MASK));
}
- if (personalities.size() > 3)
+
+ if (personalities.size() > 4)
error("too many personalities (" + std::to_string(personalities.size()) +
") for compact unwind to encode");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107533.364558.patch
Type: text/x-patch
Size: 3051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210805/215a3c67/attachment.bin>
More information about the llvm-commits
mailing list