[PATCH] D121327: Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 13:43:30 PST 2022


delcypher accepted this revision.
delcypher added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetPassConfig.cpp:900
+  // __cxa_atexit calls to avoid emitting the deprecated __mod_term_func.
+  if (TM->getTargetTriple().isOSBinFormatMachO())
+    addPass(createLowerGlobalDtorsLegacyPass());
----------------
Random thought. Do we want to support the legacy way of calling destructors, rather than removing it entirely? If we were to do such a thing I'd suspect we'd guard using the legacy way on the OS deployment target.

Just to be clear. I'm happy with the patch the way it is. I'm just wondering if we should consider allowing the legacy way as well. I can't see an obvious use case for it because the new way should work on older OSs too but maybe there's a use case I haven't thought about?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121327



More information about the llvm-commits mailing list