[PATCH] D82136: [AIX] Default AIX to using -fno-use-cxa-atexit

Xiangling Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 19 05:54:13 PDT 2020


This revision was automatically updated to reflect the committed changes.
Xiangling_L marked 2 inline comments as done.
Closed by commit rG3f2e61c1fe42: [AIX] Default AIX to using -fno-use-cxa-atexit (authored by Xiangling_L).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D82136?vs=271885&id=272036#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82136

Files:
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGenCXX/aix-static-init.cpp
  clang/test/Driver/cxa-atexit.cpp


Index: clang/test/Driver/cxa-atexit.cpp
===================================================================
--- clang/test/Driver/cxa-atexit.cpp
+++ clang/test/Driver/cxa-atexit.cpp
@@ -17,6 +17,8 @@
 // RUN: %clang -### -target mips-unknown-none-gnu -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-MIPS
 // RUN: %clang -### -target mips-mti-none-gnu -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-MIPS
 // RUN: %clang -### -target sparc-sun-solaris -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-SOLARIS
+// RUN: %clang -### -target powerpc-ibm-aix-xcoff -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-AIX
+// RUN: %clang -### -target powerpc64-ibm-aix-xcoff -c %s -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-AIX
 
 // CHECK-WINDOWS: "-fno-use-cxa-atexit"
 // CHECK-SOLARIS-NOT: "-fno-use-cxa-atexit"
@@ -24,6 +26,7 @@
 // CHECK-XCORE: "-fno-use-cxa-atexit"
 // CHECK-MTI: "-fno-use-cxa-atexit"
 // CHECK-MIPS-NOT: "-fno-use-cxa-atexit"
+// CHECK-AIX: "-fno-use-cxa-atexit"
 
 // RUN: %clang -target x86_64-apple-darwin -fregister-global-dtors-with-atexit -fno-register-global-dtors-with-atexit -c -### %s 2>&1 | \
 // RUN: FileCheck --check-prefix=WITHOUTATEXIT %s
Index: clang/test/CodeGenCXX/aix-static-init.cpp
===================================================================
--- clang/test/CodeGenCXX/aix-static-init.cpp
+++ clang/test/CodeGenCXX/aix-static-init.cpp
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -S -emit-llvm -x c++ \
-// RUN:     -fno-use-cxa-atexit -std=c++2a < %s | \
+// RUN:     -std=c++2a < %s | \
 // RUN:   FileCheck --check-prefixes=CHECK,CHECK32 %s
 
 // RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -S -emit-llvm -x c++ \
-// RUN:     -fno-use-cxa-atexit -std=c++2a < %s | \
+// RUN:     -std=c++2a < %s | \
 // RUN:   FileCheck --check-prefixes=CHECK,CHECK64 %s
 
 namespace test1 {
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5498,7 +5498,7 @@
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
           options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-          !RawTriple.isOSWindows() &&
+          !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
               TC.getArch() != llvm::Triple::xcore &&
               ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
                RawTriple.hasEnvironment())) ||
Index: clang/lib/CodeGen/ItaniumCXXABI.cpp
===================================================================
--- clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -4528,8 +4528,6 @@
   // Create __dtor function for the var decl.
   llvm::Function *dtorStub = CGF.createAtExitStub(D, dtor, addr);
 
-  if (CGM.getCodeGenOpts().CXAAtExit)
-    llvm::report_fatal_error("using __cxa_atexit unsupported on AIX");
   // Register above __dtor with atexit().
   CGF.registerGlobalDtorWithAtExit(dtorStub);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82136.272036.patch
Type: text/x-patch
Size: 3064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200619/83f4a9f6/attachment.bin>


More information about the cfe-commits mailing list