diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/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); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/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())) || diff --git a/clang/test/CodeGenCXX/aix-static-init.cpp b/clang/test/CodeGenCXX/aix-static-init.cpp --- a/clang/test/CodeGenCXX/aix-static-init.cpp +++ b/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 { diff --git a/clang/test/Driver/cxa-atexit.cpp b/clang/test/Driver/cxa-atexit.cpp --- a/clang/test/Driver/cxa-atexit.cpp +++ b/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