[PATCH] D107533: Handle encoding personalities of same names but different kinds.

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 18 18:56:37 PDT 2021


int3 added a comment.

Fair enough, let's support it then :)

I think we can have a considerably simpler implementation though, by handling this case as part of `UnwindInfoSectionImpl<Ptr>::prepareRelocations`. In particular, we already have logic that special-cases the personality relocation in order to handle section relocations: https://github.com/llvm/llvm-project/blob/main/lld/MachO/UnwindInfoSection.cpp#L212. We could add something that replaces local defined symbols with dylib symbols of the same name. Also, I would guess that it's pretty rare for personality symbols to be local, so we can skip the expensive string hash in the common case.

(Worth checking: what happens if we have local defined + global defined? Presumably the same sort of replacement happens?)



================
Comment at: lld/MachO/UnwindInfoSection.cpp:306-307
+          (sym->kind() == Symbol::DefinedKind && sym->getFile() == nullptr)) {
+        // If we've never seen this symbol, or if it's one of those synthetic
+        // <internal> defined ones, then record it.
+        personalities.push_back(cu->personality);
----------------
do we really need to care about `<internal>` symbols?


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