Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -3998,10 +3998,13 @@ } const llvm::Triple &RawTriple = C.getDefaultToolChain().getTriple(); - if (RawTriple.isOSAIX()) + if (RawTriple.isOSAIX()) { if (Arg *A = C.getArgs().getLastArg(options::OPT_G)) Diag(diag::err_drv_unsupported_opt_for_target) << A->getSpelling() << RawTriple.str(); + if (LTOMode == LTOK_Thin) + Diag(diag::err_drv_clang_unsupported) << "thinLTO on AIX"; + } // Collect the list of architectures. llvm::StringSet<> ArchNames; Index: clang/test/Driver/aix-err-options.c =================================================================== --- clang/test/Driver/aix-err-options.c +++ clang/test/Driver/aix-err-options.c @@ -26,3 +26,10 @@ // CHECK32: error: unsupported option '-G' for target 'powerpc-ibm-aix-xcoff' // CHECK64: error: unsupported option '-G' for target 'powerpc64-ibm-aix-xcoff' + +// RUN: %clang -target powerpc-ibm-aix-xcoff -### -flto=thin 2>&1 %s | \ +// RUN: FileCheck --check-prefix=CHECKTHINLTO %s +// RUN: %clang -target powerpc64-ibm-aix-xcoff -### -flto=thin 2>&1 %s | \ +// RUN: FileCheck --check-prefix=CHECKTHINLTO %s + +// CHECKTHINLTO: error: the clang compiler does not support 'thinLTO on AIX'