[all-commits] [llvm/llvm-project] 9c542a: Lower `@llvm.global_dtors` using `__cxa_atexit` on...

Julian Lettner via All-commits all-commits at lists.llvm.org
Mon Mar 14 17:51:51 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c542a5a4e1ba36c24e48185712779df52b7f7a6
      https://github.com/llvm/llvm-project/commit/9c542a5a4e1ba36c24e48185712779df52b7f7a6
  Author: Julian Lettner <julian.lettner at apple.com>
  Date:   2022-03-14 (Mon, 14 Mar 2022)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    M llvm/docs/Passes.rst
    M llvm/include/llvm/CodeGen/CommandFlags.h
    M llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
    M llvm/include/llvm/InitializePasses.h
    M llvm/include/llvm/LinkAllPasses.h
    M llvm/include/llvm/Target/TargetOptions.h
    M llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h
    M llvm/include/llvm/Transforms/Utils.h
    A llvm/include/llvm/Transforms/Utils/LowerGlobalDtors.h
    M llvm/lib/CodeGen/CodeGen.cpp
    M llvm/lib/CodeGen/CommandFlags.cpp
    M llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    M llvm/lib/CodeGen/TargetPassConfig.cpp
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/lib/Target/WebAssembly/CMakeLists.txt
    M llvm/lib/Target/WebAssembly/WebAssembly.h
    R llvm/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
    M llvm/lib/Transforms/Utils/CMakeLists.txt
    A llvm/lib/Transforms/Utils/LowerGlobalDtors.cpp
    M llvm/test/CodeGen/ARM/ctors_dtors.ll
    M llvm/test/CodeGen/X86/2011-08-29-InitOrder.ll
    A llvm/test/Transforms/LowerGlobalDestructors/lower-global-dtors.ll

  Log Message:
  -----------
  Lower `@llvm.global_dtors` using `__cxa_atexit` on MachO

For MachO, lower `@llvm.global_dtors` into `@llvm_global_ctors` with
`__cxa_atexit` calls to avoid emitting the deprecated `__mod_term_func`.

Reuse the existing `WebAssemblyLowerGlobalDtors.cpp` to accomplish this.

Enable fallback to the old behavior via Clang driver flag
(`-fregister-global-dtors-with-atexit`) or llc / code generation flag
(`-lower-global-dtors-via-cxa-atexit`).  This escape hatch will be
removed in the future.

Differential Revision: https://reviews.llvm.org/D121327




More information about the All-commits mailing list