[PATCH] D107533: [lld-macho] Handle encoding personalities of same names but different kinds

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 16 23:06:21 PDT 2021


int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

Thanks!



================
Comment at: lld/MachO/UnwindInfoSection.cpp:195
+        //
+        // (See discussions/alternatives already  considered on D107533)
+        if (!defined->isExternal())
----------------



================
Comment at: lld/MachO/UnwindInfoSection.cpp:200
+      }
       if (auto *undefined = dyn_cast<Undefined>(s)) {
         treatUndefinedSymbol(*undefined);
----------------
`symtab->find` will never return an Undefined, so we can use `else if` here


================
Comment at: lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s:17
+## check that we can link with 4 personalities without crashing:
+## ___gxx_personality_v0 (libc++.tbd) ___gxx_personality_v0(local), _personality_1 and _personality_2
+# RUN: %lld -pie  -lSystem -lc++  %t/user_2.o %t/combined.o -o %t/a.out
----------------
let's try to be consistent with commas and spaces :) (same for the lines below)


================
Comment at: lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s:18
+## ___gxx_personality_v0 (libc++.tbd) ___gxx_personality_v0(local), _personality_1 and _personality_2
+# RUN: %lld -pie  -lSystem -lc++  %t/user_2.o %t/combined.o -o %t/a.out
+## ___gxx_personality_v0 (global) ___gxx_personality_v0(libc++.tbd), _personality_1 and _personality_2
----------------
`-pie` is enabled by default


================
Comment at: lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s:35
+# A-NEXT: address                    index name
+# A-DAG:  0x[[#%x,GXX_PERSONALITY_LOW:]] [[#]] ___gxx_personality_v0
+# A-DAG:  0x[[#%x,GXX_PERSONALITY_HI:]]  [[#]] ___gxx_personality_v0        
----------------
suggestion: instead of `_LOW` and `_HI`, how about `GXX_PERSONALITY_DYLIB` and `GXX_PERSONALITY`?


================
Comment at: lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s:56
+## Error cases.
+## Check that dylib symbols are picked (which means withouth libc++, we'd get an undefined symbol error.
+# RUN:  not %lld -pie  -lSystem %t/user_2.o %t/combined.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERRORCHECK
----------------



================
Comment at: lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s:57
+## Check that dylib symbols are picked (which means withouth libc++, we'd get an undefined symbol error.
+# RUN:  not %lld -pie  -lSystem %t/user_2.o %t/combined.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERRORCHECK
+# ERRORCHECK: {{.*}} undefined symbol: ___gxx_personality_v0
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107533



More information about the llvm-commits mailing list