[PATCH] D107533: [lld-macho] Allow encode up to 4 personality symbols.

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 22:01:35 PDT 2021


oontvoo created this revision.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.
oontvoo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Details:

In our use case, we can see up to 4 valid personalities, eg.,
__ZN4base3mac21CxxPersonalityRoutineEi14_Unwind_ActionyP17_Unwind_ExceptionP15_Unwind_Context
___gxx_personality_v0
___objc_personality_v0
__gcc_personality_v0

PR51262


Repository:
  rG LLVM Github Monorepo

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
@@ -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.364343.patch
Type: text/x-patch
Size: 2518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210805/8d21016c/attachment.bin>


More information about the llvm-commits mailing list