diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1209,6 +1209,9 @@ /// when the module is unloaded. void CodeGenModule::AddGlobalDtor(llvm::Function *Dtor, int Priority) { if (CodeGenOpts.RegisterGlobalDtorsWithAtExit) { + if (getContext().getTargetInfo().getTriple().isOSAIX()) + llvm::report_fatal_error( + "register global dtors with atexit() is not supported on AIX yet"); DtorsUsingAtExit[Priority].push_back(Dtor); return; } diff --git a/clang/test/CodeGenCXX/aix-sinit-register-global-dtors-with-atexit.cpp b/clang/test/CodeGenCXX/aix-sinit-register-global-dtors-with-atexit.cpp new file mode 100644 --- /dev/null +++ b/clang/test/CodeGenCXX/aix-sinit-register-global-dtors-with-atexit.cpp @@ -0,0 +1,14 @@ +// RUN: not %clang_cc1 -triple powerpc-ibm-aix-xcoff -S -emit-llvm -x c++ \ +// RUN: -fregister-global-dtors-with-atexit < %s 2>&1 | \ +// RUN: FileCheck %s + +// RUN: not %clang_cc1 -triple powerpc64-ibm-aix-xcoff -S -emit-llvm -x c++ \ +// RUN: -fregister-global-dtors-with-atexit < %s 2>&1 | \ +// RUN: FileCheck %s + +struct T{ + T(); + ~T(); +} t; + +// CHECK: error in backend: register global dtors with atexit() is not supported on AIX yet 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 @@ -36,6 +36,7 @@ // RUN: FileCheck --check-prefix=WITHATEXIT %s // RUN: %clang -target x86_64-apple-darwin -c -mkernel -### %s 2>&1 | \ // RUN: FileCheck --check-prefix=WITHOUTATEXIT %s + // RUN: %clang -target x86_64-pc-linux-gnu -fregister-global-dtors-with-atexit -fno-register-global-dtors-with-atexit -c -### %s 2>&1 | \ // RUN: FileCheck --check-prefix=WITHOUTATEXIT %s // RUN: %clang -target x86_64-pc-linux-gnu -fno-register-global-dtors-with-atexit -fregister-global-dtors-with-atexit -c -### %s 2>&1 | \ @@ -43,5 +44,18 @@ // RUN: %clang -target x86_64-pc-linux-gnu -c -### %s 2>&1 | \ // RUN: FileCheck --check-prefix=WITHOUTATEXIT %s +// RUN: %clang -target powerpc-ibm-aix-xcoff -fregister-global-dtors-with-atexit -fno-register-global-dtors-with-atexit -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=WITHOUTATEXIT %s +// RUN: %clang -target powerpc-ibm-aix-xcoff -fno-register-global-dtors-with-atexit -fregister-global-dtors-with-atexit -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=WITHATEXIT %s +// RUN: %clang -target powerpc-ibm-aix-xcoff -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=WITHOUTATEXIT %s +// RUN: %clang -target powerpc64-ibm-aix-xcoff -fregister-global-dtors-with-atexit -fno-register-global-dtors-with-atexit -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=WITHOUTATEXIT %s +// RUN: %clang -target powerpc64-ibm-aix-xcoff -fno-register-global-dtors-with-atexit -fregister-global-dtors-with-atexit -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=WITHATEXIT %s +// RUN: %clang -target powerpc64-ibm-aix-xcoff -c -### %s 2>&1 | \ +// RUN: FileCheck --check-prefix=WITHOUTATEXIT %s + // WITHATEXIT: -fregister-global-dtors-with-atexit // WITHOUTATEXIT-NOT: -fregister-global-dtors-with-atexit