[clang] db013b2 - [PS5] Defaults for -fdeclspec, -ffunction/data-sections
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 28 10:03:53 PDT 2022
Author: Paul Robinson
Date: 2022-04-28T10:03:46-07:00
New Revision: db013b28c3d4a92cc007c878eb4d6585ba86dd1a
URL: https://github.com/llvm/llvm-project/commit/db013b28c3d4a92cc007c878eb4d6585ba86dd1a
DIFF: https://github.com/llvm/llvm-project/commit/db013b28c3d4a92cc007c878eb4d6585ba86dd1a.diff
LOG: [PS5] Defaults for -fdeclspec, -ffunction/data-sections
Added:
clang/test/Driver/ps4-ps5-toolchain.c
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 4c22d331be03..8c68473e56a7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6441,9 +6441,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.addOptInFlag(CmdArgs, options::OPT_fborland_extensions,
options::OPT_fno_borland_extensions);
- // -fno-declspec is default, except for PS4.
+ // -fno-declspec is default, except for PS4/PS5.
if (Args.hasFlag(options::OPT_fdeclspec, options::OPT_fno_declspec,
- RawTriple.isPS4()))
+ RawTriple.isPS()))
CmdArgs.push_back("-fdeclspec");
else if (Args.hasArg(options::OPT_fno_declspec))
CmdArgs.push_back("-fno-declspec"); // Explicitly disabling __declspec.
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 03a887a7527b..b646a1ddaf03 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -486,9 +486,9 @@ llvm::StringRef tools::getLTOParallelism(const ArgList &Args, const Driver &D) {
return LtoJobsArg->getValue();
}
-// CloudABI uses -ffunction-sections and -fdata-sections by default.
+// CloudABI and PS4/PS5 use -ffunction-sections and -fdata-sections by default.
bool tools::isUseSeparateSections(const llvm::Triple &Triple) {
- return Triple.getOS() == llvm::Triple::CloudABI;
+ return Triple.getOS() == llvm::Triple::CloudABI || Triple.isPS();
}
void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
diff --git a/clang/test/Driver/ps4-ps5-toolchain.c b/clang/test/Driver/ps4-ps5-toolchain.c
new file mode 100644
index 000000000000..308b80c6774b
--- /dev/null
+++ b/clang/test/Driver/ps4-ps5-toolchain.c
@@ -0,0 +1,7 @@
+// PS4/PS5 miscellaneous toolchain defaults.
+
+// RUN: %clang -c %s -### -target x86_64-scei-ps4 2>&1 | FileCheck %s
+// RUN: %clang -c %s -### -target x86_64-sie-ps5 2>&1 | FileCheck %s
+// CHECK-DAG: "-ffunction-sections"
+// CHECK-DAG: "-fdata-sections"
+// CHECK-DAG: "-fdeclspec"
More information about the cfe-commits
mailing list