gold: Fix missing armv8 from may_use_v5t_interworking()

Message ID CAPEANKshMmrhidSgKA4vkv+WOXsyhHL5NxT=fN1U=9-P=WKggw@mail.gmail.com
State New
Headers show
Series
  • gold: Fix missing armv8 from may_use_v5t_interworking()
Related show

Commit Message

Jordan Rupprecht via binutils July 17, 2019, 5:40 p.m.
Hello,

As reported in the bug
https://sourceware.org/bugzilla/show_bug.cgi?id=24642, in arm.cc the
code that permits v5t interworking instructions is missing a case for
TAG_CPU_ARCH_V8 and the various V8_M mainline and baseline. This
results in less efficient code in armv8 cpus to use v4t stubs. This
patch is an effort to fix it and change the condition to allow any cpu
architectures above armv7.

----------------------

Comments

Jordan Rupprecht via binutils July 18, 2019, 4:16 p.m. | #1
Also, the patch is tested on Android NDK and Chrome OS.

On Wed, Jul 17, 2019 at 10:40 AM Tiancong Wang <tcwang@google.com> wrote:
>

> Hello,

>

> As reported in the bug

> https://sourceware.org/bugzilla/show_bug.cgi?id=24642, in arm.cc the

> code that permits v5t interworking instructions is missing a case for

> TAG_CPU_ARCH_V8 and the various V8_M mainline and baseline. This

> results in less efficient code in armv8 cpus to use v4t stubs. This

> patch is an effort to fix it and change the condition to allow any cpu

> architectures above armv7.

>

> ----------------------

> diff --git a/gold/arm.cc b/gold/arm.cc

> index 55b8d31368..8258ca5c9e 100644

> --- a/gold/arm.cc

> +++ b/gold/arm.cc

> @@ -2216,10 +2216,8 @@ class Target_arm : public Sized_target<32, big_endian>

>      int arch = attr->int_value();

>      if (parameters->options().fix_arm1176())

>        return (arch == elfcpp::TAG_CPU_ARCH_V6T2

> -             || arch == elfcpp::TAG_CPU_ARCH_V7

> -             || arch == elfcpp::TAG_CPU_ARCH_V6_M

> -             || arch == elfcpp::TAG_CPU_ARCH_V6S_M

> -             || arch == elfcpp::TAG_CPU_ARCH_V7E_M);

> +              || (arch >= elfcpp::TAG_CPU_ARCH_V7

> +                  && arch <= elfcpp::MAX_TAG_CPU_ARCH));

>      else

>        return (arch != elfcpp::TAG_CPU_ARCH_PRE_V4

>               && arch != elfcpp::TAG_CPU_ARCH_V4

Patch

diff --git a/gold/arm.cc b/gold/arm.cc
index 55b8d31368..8258ca5c9e 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -2216,10 +2216,8 @@  class Target_arm : public Sized_target<32, big_endian>
     int arch = attr->int_value();
     if (parameters->options().fix_arm1176())
       return (arch == elfcpp::TAG_CPU_ARCH_V6T2
-             || arch == elfcpp::TAG_CPU_ARCH_V7
-             || arch == elfcpp::TAG_CPU_ARCH_V6_M
-             || arch == elfcpp::TAG_CPU_ARCH_V6S_M
-             || arch == elfcpp::TAG_CPU_ARCH_V7E_M);
+              || (arch >= elfcpp::TAG_CPU_ARCH_V7
+                  && arch <= elfcpp::MAX_TAG_CPU_ARCH));
     else
       return (arch != elfcpp::TAG_CPU_ARCH_PRE_V4
              && arch != elfcpp::TAG_CPU_ARCH_V4