[PATCH] D25761: Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

2016-10-25 Thread Stephen Hines via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285127: Use linker flag --fix-cortex-a53-843419 on Android 
ARM64 compilation. (authored by srhines).

Changed prior to commit:
  https://reviews.llvm.org/D25761?vs=75174=75801#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25761

Files:
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/android-aarch64-link.cpp


Index: cfe/trunk/test/Driver/android-aarch64-link.cpp
===
--- cfe/trunk/test/Driver/android-aarch64-link.cpp
+++ cfe/trunk/test/Driver/android-aarch64-link.cpp
@@ -0,0 +1,17 @@
+// Check that we automatically add relevant linker flags for Android aarch64.
+
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=GENERIC-ARM < %t %s
+//
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -mcpu=cortex-a53 -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=CORTEX-A53 < %t %s
+//
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -mcpu=cortex-a57 -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=CORTEX-A57 < %t %s
+//
+// GENERIC-ARM: --fix-cortex-a53-843419
+// CORTEX-A53: --fix-cortex-a53-843419
+// CORTEX-A57-NOT: --fix-cortex-a53-843419
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -9712,6 +9712,14 @@
   if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb)
 arm::appendEBLinkFlags(Args, CmdArgs, Triple);
 
+  // Most Android ARM64 targets should enable the linker fix for erratum
+  // 843419. Only non-Cortex-A53 devices are allowed to skip this flag.
+  if (Arch == llvm::Triple::aarch64 && isAndroid) {
+std::string CPU = getCPUName(Args, Triple);
+if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+  CmdArgs.push_back("--fix-cortex-a53-843419");
+  }
+
   for (const auto  : ToolChain.ExtraOpts)
 CmdArgs.push_back(Opt.c_str());
 


Index: cfe/trunk/test/Driver/android-aarch64-link.cpp
===
--- cfe/trunk/test/Driver/android-aarch64-link.cpp
+++ cfe/trunk/test/Driver/android-aarch64-link.cpp
@@ -0,0 +1,17 @@
+// Check that we automatically add relevant linker flags for Android aarch64.
+
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=GENERIC-ARM < %t %s
+//
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -mcpu=cortex-a53 -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=CORTEX-A53 < %t %s
+//
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -mcpu=cortex-a57 -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=CORTEX-A57 < %t %s
+//
+// GENERIC-ARM: --fix-cortex-a53-843419
+// CORTEX-A53: --fix-cortex-a53-843419
+// CORTEX-A57-NOT: --fix-cortex-a53-843419
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -9712,6 +9712,14 @@
   if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb)
 arm::appendEBLinkFlags(Args, CmdArgs, Triple);
 
+  // Most Android ARM64 targets should enable the linker fix for erratum
+  // 843419. Only non-Cortex-A53 devices are allowed to skip this flag.
+  if (Arch == llvm::Triple::aarch64 && isAndroid) {
+std::string CPU = getCPUName(Args, Triple);
+if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+  CmdArgs.push_back("--fix-cortex-a53-843419");
+  }
+
   for (const auto  : ToolChain.ExtraOpts)
 CmdArgs.push_back(Opt.c_str());
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25761: Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

2016-10-19 Thread Stephen Hines via cfe-commits
srhines updated this revision to Diff 75174.
srhines added a comment.

Added a test for this behavior.

I missed that "-### -v" was actually working correctly last night. Tests added
so I am more satisfied that this won't break accidentally in the future.


https://reviews.llvm.org/D25761

Files:
  lib/Driver/Tools.cpp
  test/Driver/android-aarch64-link.cpp


Index: test/Driver/android-aarch64-link.cpp
===
--- /dev/null
+++ test/Driver/android-aarch64-link.cpp
@@ -0,0 +1,17 @@
+// Check that we automatically add relevant linker flags for Android aarch64.
+
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=GENERIC-ARM < %t %s
+//
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -mcpu=cortex-a53 -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=CORTEX-A53 < %t %s
+//
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -mcpu=cortex-a57 -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=CORTEX-A57 < %t %s
+//
+// GENERIC-ARM: --fix-cortex-a53-843419
+// CORTEX-A53: --fix-cortex-a53-843419
+// CORTEX-A57-NOT: --fix-cortex-a53-843419
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9677,6 +9677,14 @@
   if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb)
 arm::appendEBLinkFlags(Args, CmdArgs, Triple);
 
+  // Most Android ARM64 targets should enable the linker fix for erratum
+  // 843419. Only non-Cortex-A53 devices are allowed to skip this flag.
+  if (Arch == llvm::Triple::aarch64 && isAndroid) {
+std::string CPU = getCPUName(Args, Triple);
+if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+  CmdArgs.push_back("--fix-cortex-a53-843419");
+  }
+
   for (const auto  : ToolChain.ExtraOpts)
 CmdArgs.push_back(Opt.c_str());
 


Index: test/Driver/android-aarch64-link.cpp
===
--- /dev/null
+++ test/Driver/android-aarch64-link.cpp
@@ -0,0 +1,17 @@
+// Check that we automatically add relevant linker flags for Android aarch64.
+
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=GENERIC-ARM < %t %s
+//
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -mcpu=cortex-a53 -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=CORTEX-A53 < %t %s
+//
+// RUN: %clang -target aarch64-none-linux-android \
+// RUN:   -mcpu=cortex-a57 -### -v %s 2> %t
+// RUN: FileCheck -check-prefix=CORTEX-A57 < %t %s
+//
+// GENERIC-ARM: --fix-cortex-a53-843419
+// CORTEX-A53: --fix-cortex-a53-843419
+// CORTEX-A57-NOT: --fix-cortex-a53-843419
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9677,6 +9677,14 @@
   if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb)
 arm::appendEBLinkFlags(Args, CmdArgs, Triple);
 
+  // Most Android ARM64 targets should enable the linker fix for erratum
+  // 843419. Only non-Cortex-A53 devices are allowed to skip this flag.
+  if (Arch == llvm::Triple::aarch64 && isAndroid) {
+std::string CPU = getCPUName(Args, Triple);
+if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+  CmdArgs.push_back("--fix-cortex-a53-843419");
+  }
+
   for (const auto  : ToolChain.ExtraOpts)
 CmdArgs.push_back(Opt.c_str());
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25761: Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

2016-10-19 Thread Renato Golin via cfe-commits
rengolin added a comment.

In https://reviews.llvm.org/D25761#573903, @srhines wrote:

> > I think "clang -v" will show the linker invocation, with all its flags.
>
> But is there a way to get a dry-run of the linker? I don't want to run 
> /usr/bin/ld for ARM targets. It seems like all of the other linker 
> flag-related tests in tests/Driver/ only work for x86.


I think the combination of -v and -### does that, no?


https://reviews.llvm.org/D25761



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25761: Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

2016-10-19 Thread Stephen Hines via cfe-commits
srhines added a comment.

In https://reviews.llvm.org/D25761#573902, @rengolin wrote:

> In https://reviews.llvm.org/D25761#573892, @srhines wrote:
>
> > From what I can tell, there is no nice way to generate tests for Clang's 
> > driver when producing linker flags. -### only works for the -cc1 command 
> > line (which won't see this flag, since it is only for linking, and not 
> > compilation). If there is a suggestion for how to automatically test this, 
> > I am listening, but all my local tests looked fine (for 
> > generating/suppressing the flag). :)
>
>
> I think "clang -v" will show the linker invocation, with all its flags.


But is there a way to get a dry-run of the linker? I don't want to run 
/usr/bin/ld for ARM targets. It seems like all of the other linker flag-related 
tests in tests/Driver/ only work for x86.


https://reviews.llvm.org/D25761



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25761: Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

2016-10-19 Thread Renato Golin via cfe-commits
rengolin added a comment.

In https://reviews.llvm.org/D25761#573892, @srhines wrote:

> From what I can tell, there is no nice way to generate tests for Clang's 
> driver when producing linker flags. -### only works for the -cc1 command line 
> (which won't see this flag, since it is only for linking, and not 
> compilation). If there is a suggestion for how to automatically test this, I 
> am listening, but all my local tests looked fine (for generating/suppressing 
> the flag). :)


I think "clang -v" will show the linker invocation, with all its flags.


https://reviews.llvm.org/D25761



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25761: Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

2016-10-19 Thread Stephen Hines via cfe-commits
srhines added a comment.

From what I can tell, there is no nice way to generate tests for Clang's driver 
when producing linker flags. -### only works for the -cc1 command line (which 
won't see this flag, since it is only for linking, and not compilation). If 
there is a suggestion for how to automatically test this, I am listening, but 
all my local tests looked fine (for generating/suppressing the flag). :)


https://reviews.llvm.org/D25761



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25761: Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

2016-10-19 Thread James Molloy via cfe-commits
jmolloy accepted this revision.
jmolloy added a reviewer: jmolloy.
jmolloy added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D25761



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25761: Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

2016-10-19 Thread Stephen Hines via cfe-commits
srhines created this revision.
srhines added a reviewer: cfe-commits.
srhines added subscribers: danalbert, pirama.
Herald added subscribers: tberghammer, rengolin, aemerson.

This is only forced on if there is no non-Cortex-A53 CPU specified as
well. Android's platform and NDK builds need to assume that the code can
be run on Cortex-A53 devices, so we always enable the fix unless we know
specifically that the code is only running on a different kind of CPU.


https://reviews.llvm.org/D25761

Files:
  lib/Driver/Tools.cpp


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9677,6 +9677,14 @@
   if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb)
 arm::appendEBLinkFlags(Args, CmdArgs, Triple);
 
+  // Most Android ARM64 targets should enable the linker fix for erratum
+  // 843419. Only non-Cortex-A53 devices are allowed to skip this flag.
+  if (Arch == llvm::Triple::aarch64 && isAndroid) {
+std::string CPU = getCPUName(Args, Triple);
+if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+  CmdArgs.push_back("--fix-cortex-a53-843419");
+  }
+
   for (const auto  : ToolChain.ExtraOpts)
 CmdArgs.push_back(Opt.c_str());
 


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9677,6 +9677,14 @@
   if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb)
 arm::appendEBLinkFlags(Args, CmdArgs, Triple);
 
+  // Most Android ARM64 targets should enable the linker fix for erratum
+  // 843419. Only non-Cortex-A53 devices are allowed to skip this flag.
+  if (Arch == llvm::Triple::aarch64 && isAndroid) {
+std::string CPU = getCPUName(Args, Triple);
+if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+  CmdArgs.push_back("--fix-cortex-a53-843419");
+  }
+
   for (const auto  : ToolChain.ExtraOpts)
 CmdArgs.push_back(Opt.c_str());
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits