summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDouglas Yung <douglas.yung@sony.com>2018-05-12 00:06:59 +0000
committerDouglas Yung <douglas.yung@sony.com>2018-05-12 00:06:59 +0000
commitdde9de7cf943ace41ac69589df661b2ab54dd76b (patch)
tree0d035e91adb07f02d2e25e8bcd21a80baf18a363 /clang
parent79a736136772fab259f5e28ff2581fd37f97e43f (diff)
downloadbcm5719-llvm-dde9de7cf943ace41ac69589df661b2ab54dd76b.tar.gz
bcm5719-llvm-dde9de7cf943ace41ac69589df661b2ab54dd76b.zip
Force the PS4 clang ABI version to 6.
The PS4 requires clang ABI version 6 for compatibility reasons. This change forces this and if the user specifies a different version when the PS4 target is specified, the compiler emits a warning that the specified version is being ignored. Reviewers: probinson Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46767 llvm-svn: 332160
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/DiagnosticDriverKinds.td3
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp10
-rw-r--r--clang/test/CodeGenCXX/alignment.cpp3
-rw-r--r--clang/test/Driver/clang-abi-compat.cpp6
4 files changed, 22 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 003450d951e..21e00ed2b18 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -150,6 +150,9 @@ def warn_drv_unknown_argument_clang_cl : Warning<
def warn_drv_unknown_argument_clang_cl_with_suggestion : Warning<
"unknown argument ignored in clang-cl '%0' (did you mean '%1'?)">,
InGroup<UnknownArgument>;
+def warn_drv_ignored_clang_abi_version : Warning<
+ "target requires clang ABI version %0, ignoring requested version">,
+ InGroup<UnusedCommandLineArgument>;
def warn_drv_ycyu_no_arg_clang_cl : Warning<
"support for '%0' without a filename not implemented yet; flag ignored">,
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 05e5196e32d..b8e05b523ef 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2751,6 +2751,16 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
<< A->getAsString(Args) << A->getValue();
}
}
+ // The PS4 requires version 6 of the clang ABI.
+ if (T.isPS4()) {
+ // Issue a warning if another version of the ABI was requested.
+ if (Args.getLastArg(OPT_fclang_abi_compat_EQ) &&
+ Opts.getClangABICompat() != LangOptions::ClangABI::Ver6) {
+ Diags.Report(diag::warn_drv_ignored_clang_abi_version)
+ << 6;
+ }
+ Opts.setClangABICompat(LangOptions::ClangABI::Ver6);
+ }
}
static bool isStrictlyPreprocessorAction(frontend::ActionKind Action) {
diff --git a/clang/test/CodeGenCXX/alignment.cpp b/clang/test/CodeGenCXX/alignment.cpp
index 2549afda882..6956637aaef 100644
--- a/clang/test/CodeGenCXX/alignment.cpp
+++ b/clang/test/CodeGenCXX/alignment.cpp
@@ -1,5 +1,8 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOCOMPAT
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 -fclang-abi-compat=6.0 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT
+// Check that the PS4 target uses the 6.0 compat settings.
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-scei-ps4 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-scei-ps4 -fclang-abi-compat=latest | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-V6COMPAT
extern int int_source();
extern void int_sink(int x);
diff --git a/clang/test/Driver/clang-abi-compat.cpp b/clang/test/Driver/clang-abi-compat.cpp
new file mode 100644
index 00000000000..9f1789867b2
--- /dev/null
+++ b/clang/test/Driver/clang-abi-compat.cpp
@@ -0,0 +1,6 @@
+// PS4 target requires clang ABI version 6, check that a warning is emitted when a version other than 6 is requested.
+// RUN: %clang -S --target=x86_64-scei-ps4 -fclang-abi-compat=4 %s 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING
+// RUN: %clang -S --target=x86_64-scei-ps4 -fclang-abi-compat=latest %s 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING
+
+// CHECK-WARNING: warning: target requires clang ABI version 6, ignoring requested version
+
OpenPOWER on IntegriCloud