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

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 13:19:11 PST 2022


yln added a comment.

I wanted to check in to get your feedback on the overall approach while I am working on adding tests for the behavior change.

On Darwin (MachO really) we want to transition away from the deprecated `__mod_term_funcs` section (relevant: D45578 <https://reviews.llvm.org/D45578>).  However, currently @llvm.global_dtors <https://llvm.org/docs/LangRef.html#the-llvm-global-dtors-global-variable>, i.e., `llvm::appendToGlobalDtors` callers, are lowered to it.
Here I am trying to reuse an existing lowering pass for WebAssembly (which doesn't have a destructor section, D41211 <https://reviews.llvm.org/D41211>) to transform `@llvm.global_dtors` into functions registered as constructors (`@llvm.global_ctors`) that then call `__cxa_atexit ` to register the destructor.


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