[clang] 699089f - [AIX][Clang][Driver] Add handling of nostartfiles option
David Tenty via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 21 07:42:52 PDT 2020
Author: David Tenty
Date: 2020-09-21T10:42:46-04:00
New Revision: 699089f2a9702baa987dc2dbe915a2c845c7027f
URL: https://github.com/llvm/llvm-project/commit/699089f2a9702baa987dc2dbe915a2c845c7027f
DIFF: https://github.com/llvm/llvm-project/commit/699089f2a9702baa987dc2dbe915a2c845c7027f.diff
LOG: [AIX][Clang][Driver] Add handling of nostartfiles option
Reviewed By: jasonliu
Differential Revision: https://reviews.llvm.org/D87904
Added:
Modified:
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Driver/aix-ld.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp
index bc130a5557e9..e492cd7d196f 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -123,7 +123,7 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
return IsArch32Bit ? "crt0.o" : "crt0_64.o";
};
- if (!Args.hasArg(options::OPT_nostdlib)) {
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
CmdArgs.push_back(
Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename())));
}
diff --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 7b3710ca21ef..695260bbe2bd 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -331,6 +331,38 @@
// CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
// CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x10000000" "-bpD:0x20000000"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-NOSTARTFILES-LCXX "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x100000000" "-bpD:0x110000000"
+// CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crt0_64.o"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc++"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc"
+
// Check powerpc-ibm-aix7.1.0.0, 32-bit. -stdlib=libstdc++ invokes fatal error.
// RUN: not --crash %clangxx -no-canonical-prefixes %s 2>&1 -### \
// RUN: -target powerpc-ibm-aix7.1.0.0 \
More information about the cfe-commits
mailing list