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

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 14:45:04 PST 2022


yln 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());
----------------
delcypher wrote:
> 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?
Having a way to explicitly request the old behavior sounds like a good idea.  I will look into it.


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