[clang] ee80615 - [clang][driver][AIX] Set compiler-rt as default rtlib
David Tenty via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 16:45:51 PDT 2020
Author: David Tenty
Date: 2020-09-28T19:45:43-04:00
New Revision: ee80615b5c1c5b15c90a92d6954007b3a82825b0
URL: https://github.com/llvm/llvm-project/commit/ee80615b5c1c5b15c90a92d6954007b3a82825b0
DIFF: https://github.com/llvm/llvm-project/commit/ee80615b5c1c5b15c90a92d6954007b3a82825b0.diff
LOG: [clang][driver][AIX] Set compiler-rt as default rtlib
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D88182
Added:
clang/test/Driver/aix-rtlib.c
Modified:
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h
clang/test/Driver/aix-ld.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 0831791c8d06..8991216da676 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -391,6 +391,8 @@ StringRef ToolChain::getOSLibName() const {
return "openbsd";
case llvm::Triple::Solaris:
return "sunos";
+ case llvm::Triple::AIX:
+ return "aix";
default:
return getOS();
}
diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp
index 0d4d7e3dbf9f..b56ddf55cb30 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -156,6 +156,8 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
+ AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
+
// Support POSIX threads if "-pthreads" or "-pthread" is present.
if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
CmdArgs.push_back("-lpthreads");
@@ -228,6 +230,10 @@ ToolChain::CXXStdlibType AIX::GetDefaultCXXStdlibType() const {
return ToolChain::CST_Libcxx;
}
+ToolChain::RuntimeLibType AIX::GetDefaultRuntimeLibType() const {
+ return ToolChain::RLT_CompilerRT;
+}
+
auto AIX::buildAssembler() const -> Tool * { return new aix::Assembler(*this); }
auto AIX::buildLinker() const -> Tool * { return new aix::Linker(*this); }
diff --git a/clang/lib/Driver/ToolChains/AIX.h b/clang/lib/Driver/ToolChains/AIX.h
index f63b20da969e..d4e593255736 100644
--- a/clang/lib/Driver/ToolChains/AIX.h
+++ b/clang/lib/Driver/ToolChains/AIX.h
@@ -72,6 +72,8 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
CXXStdlibType GetDefaultCXXStdlibType() const override;
+ RuntimeLibType GetDefaultRuntimeLibType() const override;
+
protected:
Tool *buildAssembler() const override;
Tool *buildLinker() const override;
diff --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 6dd14dc164df..224e355aac13 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
// Check powerpc-ibm-aix7.1.0.0, 32-bit.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32 %s
// CHECK-LD32-NOT: warning:
// CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
// CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD64 %s
// CHECK-LD64-NOT: warning:
// CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
// CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -pthread \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
// CHECK-LD32-PTHREAD-NOT: warning:
// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
// CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-PTHREAD: "-lpthreads"
// CHECK-LD32-PTHREAD: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -pthreads \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
// CHECK-LD64-PTHREAD-NOT: warning:
// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-PTHREAD-NOT: "-bnso"
@@ -74,17 +85,20 @@
// CHECK-LD64-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-PTHREAD-NOT: "-lc++"
+// CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-PTHREAD: "-lpthreads"
// CHECK-LD64-PTHREAD: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -p \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-PROF %s
// CHECK-LD32-PROF-NOT: warning:
// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-PROF-NOT: "-bnso"
@@ -94,16 +108,19 @@
// CHECK-LD32-PROF-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-PROF-NOT: "-lc++"
+// CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-PROF: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -pg \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD64-GPROF %s
// CHECK-LD64-GPROF-NOT: warning:
// CHECK-LD64-GPROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-GPROF: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-GPROF: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-GPROF: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-GPROF-NOT: "-bnso"
@@ -113,16 +130,19 @@
// CHECK-LD64-GPROF-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-GPROF-NOT: "-lc++"
+// CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-GPROF: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -static \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-STATIC %s
// CHECK-LD32-STATIC-NOT: warning:
// CHECK-LD32-STATIC: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-STATIC: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-STATIC: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-STATIC: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-STATIC: "-bnso"
@@ -132,16 +152,19 @@
// CHECK-LD32-STATIC-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-STATIC-NOT: "-lc++"
+// CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-STATIC: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -L%S/Inputs/aix_ppc_tree/powerpc-ibm-aix7.1.0.0 \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-LIBP %s
// CHECK-LD32-LIBP-NOT: warning:
// CHECK-LD32-LIBP: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-LIBP: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-LIBP: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-LIBP: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-LIBP-NOT: "-bnso"
@@ -152,10 +175,12 @@
// CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
// CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-LIBP-NOT: "-lc++"
+// CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-LIBP: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nostdlib \
// RUN: -pthread \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
@@ -163,6 +188,7 @@
// RUN: | FileCheck --check-prefix=CHECK-LD32-NO-STD-LIB %s
// CHECK-LD32-NO-STD-LIB-NOT: warning:
// CHECK-LD32-NO-STD-LIB: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NO-STD-LIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-NO-STD-LIB: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-NO-STD-LIB: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-NO-STD-LIB-NOT: "-bnso"
@@ -172,11 +198,13 @@
// CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
+// CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
// CHECK-LD32-NO-STD-LIB-NOT: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nodefaultlibs \
// RUN: -pthread \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
@@ -184,6 +212,7 @@
// RUN: | FileCheck --check-prefix=CHECK-LD64-NO-DEFAULT-LIBS %s
// CHECK-LD64-NO-DEFAULT-LIBS-NOT: warning:
// CHECK-LD64-NO-DEFAULT-LIBS: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NO-DEFAULT-LIBS: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-NO-DEFAULT-LIBS: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-NO-DEFAULT-LIBS: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-bnso"
@@ -193,16 +222,19 @@
// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -Wl,-bnocdtors \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
// CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-CXX-ARG-ORDER: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-CXX-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-CXX-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bnso"
@@ -214,14 +246,17 @@
// CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
// CHECK-LD32-CXX-ARG-ORDER: "-lc++"
+// CHECK-LD32-CXX-ARG-ORDER: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-CXX-ARG-ORDER: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. lc++ and lc order.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-LCXX %s
// CHECK-LD32-CXX-ARG-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-CXX-ARG-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-CXX-ARG-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-CXX-ARG-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-CXX-ARG-LCXX: "-b32"
@@ -230,14 +265,17 @@
// CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-CXX-ARG-LCXX: "-lc++"
+// CHECK-LD32-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-CXX-ARG-LCXX: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. lc++ and lc order.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD64-CXX-ARG-LCXX %s
// CHECK-LD64-CXX-ARG-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-CXX-ARG-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-CXX-ARG-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-CXX-ARG-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-CXX-ARG-LCXX: "-b64"
@@ -246,15 +284,18 @@
// CHECK-LD64-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-CXX-ARG-LCXX: "-lc++"
+// CHECK-LD64-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-CXX-ARG-LCXX: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. -nodefaultlibs.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nodefaultlibs \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-NODEFLIB-LCXX %s
// CHECK-LD32-NODEFLIB-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NODEFLIB-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-NODEFLIB-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-NODEFLIB-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-NODEFLIB-LCXX: "-b32"
@@ -263,15 +304,18 @@
// CHECK-LD32-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-NODEFLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-NODEFLIB-LCXX-NOT: "-lc++"
+// CHECK-LD32-NODEFLIB-LCXX-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-NODEFLIB-LCXX-NOT: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nodefaultlibs.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nodefaultlibs \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD64-NODEFLIB-LCXX %s
// CHECK-LD64-NODEFLIB-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NODEFLIB-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-NODEFLIB-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-NODEFLIB-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-NODEFLIB-LCXX: "-b64"
@@ -280,15 +324,18 @@
// CHECK-LD64-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-NODEFLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-NODEFLIB-LCXX-NOT: "-lc++"
+// CHECK-LD64-NODEFLIB-LCXX-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-NODEFLIB-LCXX-NOT: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. -nostdlib.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nostdlib \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-NOSTDLIB-LCXX %s
// CHECK-LD32-NOSTDLIB-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTDLIB-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-NOSTDLIB-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-NOSTDLIB-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-NOSTDLIB-LCXX: "-b32"
@@ -297,15 +344,18 @@
// CHECK-LD32-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-NOSTDLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-NOSTDLIB-LCXX-NOT: "-lc++"
+// CHECK-LD32-NOSTDLIB-LCXX-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-NOSTDLIB-LCXX-NOT: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostdlib.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nostdlib \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD64-NOSTDLIB-LCXX %s
// CHECK-LD64-NOSTDLIB-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTDLIB-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-NOSTDLIB-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-NOSTDLIB-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-NOSTDLIB-LCXX: "-b64"
@@ -314,16 +364,19 @@
// CHECK-LD64-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-NOSTDLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-NOSTDLIB-LCXX-NOT: "-lc++"
+// CHECK-LD64-NOSTDLIB-LCXX-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-NOSTDLIB-LCXX-NOT: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. -nostdlib++.
// Note: crti is still linked for initialization/finalization functionality.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nostdlib++ \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-NOSTDLIBXX-LCXX %s
// CHECK-LD32-NOSTDLIBXX-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTDLIBXX-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-NOSTDLIBXX-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-NOSTDLIBXX-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-NOSTDLIBXX-LCXX: "-b32"
@@ -332,15 +385,18 @@
// CHECK-LD32-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-NOSTDLIBXX-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-NOSTDLIBXX-LCXX-NOT: "-lc++"
+// CHECK-LD32-NOSTDLIBXX-LCXX: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-NOSTDLIBXX-LCXX: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostdlib++.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nostdlib++ \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD64-NOSTDLIBXX-LCXX %s
// CHECK-LD64-NOSTDLIBXX-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTDLIBXX-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-NOSTDLIBXX-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-NOSTDLIBXX-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-NOSTDLIBXX-LCXX: "-b64"
@@ -349,15 +405,18 @@
// CHECK-LD64-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-NOSTDLIBXX-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
+// CHECK-LD64-NOSTDLIBXX-LCXX: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nostartfiles \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
// CHECK-LD32-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
@@ -366,15 +425,18 @@
// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-NOSTARTFILES-LCXX "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -nostartfiles \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
// CHECK-LD64-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
@@ -383,6 +445,7 @@
// CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-NOSTARTFILES-LCXX: "-lc++"
+// CHECK-LD64-NOSTARTFILES-LCXX: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-NOSTARTFILES-LCXX: "-lc"
// Check powerpc-ibm-aix7.1.0.0, 32-bit. -stdlib=libstdc++ invokes fatal error.
@@ -402,11 +465,13 @@
// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -shared.
// RUN: %clangxx -x c++ -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -shared \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD32-SHARED %s
// CHECK-LD32-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD32-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD32-SHARED: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD32-SHARED: "-bM:SRE"
@@ -417,16 +482,18 @@
// CHECK-LD32-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
// CHECK-LD32-SHARED: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD32-SHARED: "-lc++"
+// CHECK-LD32-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
// CHECK-LD32-SHARED: "-lc"
-
// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -shared.
// RUN: %clangxx -x c++ -no-canonical-prefixes %s 2>&1 -### \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: -shared \
// RUN: -target powerpc64-ibm-aix7.1.0.0 \
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
// RUN: | FileCheck --check-prefix=CHECK-LD64-SHARED %s
// CHECK-LD64-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-LD64-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-LD64-SHARED: "{{.*}}ld{{(.exe)?}}"
// CHECK-LD64-SHARED: "-bM:SRE"
@@ -437,4 +504,5 @@
// CHECK-LD64-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti_64.o"
// CHECK-LD64-SHARED: "-L[[SYSROOT]]/usr/lib"
// CHECK-LD64-SHARED: "-lc++"
+// CHECK-LD64-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc64.a"
// CHECK-LD64-SHARED: "-lc"
diff --git a/clang/test/Driver/aix-rtlib.c b/clang/test/Driver/aix-rtlib.c
new file mode 100644
index 000000000000..685700db4295
--- /dev/null
+++ b/clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,10 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc64.a
More information about the cfe-commits
mailing list