ARM: Add support for value 3 of Tag_ABI_VFP_args attribute
authorTerry Guo <terry.guo@arm.com>
Thu, 25 Dec 2014 01:50:48 +0000 (09:50 +0800)
committerTerry Guo <terry.guo@arm.com>
Thu, 25 Dec 2014 01:55:03 +0000 (09:55 +0800)
*** bfd/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new
Tag_ABI_VFP_args value and replace hardcoded values by enum
values.
(elf32_arm_post_process_headers): Set e_flags in ELF header
as hard float only when Tag_ABI_VFP_args is 1, using new enum
value AEABI_VFP_args_vfp to check that.

*** binutils/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible".

*** gdb/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* arm-tdep.c (arm_gdbarch_init): Explicitely handle value 3 of
Tag_ABI_VFP_args. Also replace hardcoded values by enum values
in the switch handling the different values of Tag_ABI_VFP_args.

*** gold/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF
header as hard float only when Tag_ABI_VFP_args is 1, using new
enum value AEABI_VFP_args_vfp to check that.
(Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
value and replace hardcoded values by enum values.

*** include/elf/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum
values.

*** ld/testsuite/ChangeLog ***

2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>

* ld-arm/attr-merge-2a.s: Add Tag_ABI_VFP_args.
* ld-arm/attr-merge-2b.s: Likewise.
* ld-arm/attr-merge-2.attr: Likewise.
* ld-arm/attr-merge-4a.s: Add Tag_ABI_FP_number_model and
Tag_ABI_VFP_args.
* ld-arm/attr-merge-4b.s: Likewise.
* ld-arm/attr-merge-4.attr: Likewise.
* ld-arm/attr-merge-6a.s: Likewise.
* ld-arm/attr-merge-6b.s: Likewise.
* ld-arm/attr-merge-6.attr: Add Tag_ABI_FP_number_model.

20 files changed:
bfd/ChangeLog
bfd/elf32-arm.c
binutils/ChangeLog
binutils/readelf.c
gdb/ChangeLog
gdb/arm-tdep.c
gold/ChangeLog
gold/arm.cc
include/elf/ChangeLog
include/elf/arm.h
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/attr-merge-2.attr
ld/testsuite/ld-arm/attr-merge-2a.s
ld/testsuite/ld-arm/attr-merge-2b.s
ld/testsuite/ld-arm/attr-merge-4.attr
ld/testsuite/ld-arm/attr-merge-4a.s
ld/testsuite/ld-arm/attr-merge-4b.s
ld/testsuite/ld-arm/attr-merge-6.attr
ld/testsuite/ld-arm/attr-merge-6a.s
ld/testsuite/ld-arm/attr-merge-6b.s

index c85bd07e7f5314522fd5c70595f3552a9be17f28..8bfb2600e609f69e9016ef133709d4e774cc5c48 100644 (file)
@@ -1,3 +1,11 @@
+2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new
+       Tag_ABI_VFP_args value and replace hardcoded values by enum values.
+       (elf32_arm_post_process_headers): Set e_flags in ELF header as hard
+       float only when Tag_ABI_VFP_args is 1, using new enum value
+       AEABI_VFP_args_vfp to check that.
+
 2014-12-24  H.J. Lu  <hongjiu.lu@intel.com>
 
        * pei-x86_64.c (pex64_bfd_print_pdata_section): Add cast to
index 5b2f66f0f910cee507396bd908ea5a422b733d8c..09c5aa44df85d819b02b90c5d03ab31ac2008a60 100644 (file)
@@ -11753,10 +11753,14 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
   /* This needs to happen before Tag_ABI_FP_number_model is merged.  */
   if (in_attr[Tag_ABI_VFP_args].i != out_attr[Tag_ABI_VFP_args].i)
     {
-      /* Ignore mismatches if the object doesn't use floating point.  */
-      if (out_attr[Tag_ABI_FP_number_model].i == 0)
+      /* Ignore mismatches if the object doesn't use floating point or is
+        floating point ABI independent.  */
+      if (out_attr[Tag_ABI_FP_number_model].i == AEABI_FP_number_model_none
+         || (in_attr[Tag_ABI_FP_number_model].i != AEABI_FP_number_model_none
+             && out_attr[Tag_ABI_VFP_args].i == AEABI_VFP_args_compatible))
        out_attr[Tag_ABI_VFP_args].i = in_attr[Tag_ABI_VFP_args].i;
-      else if (in_attr[Tag_ABI_FP_number_model].i != 0)
+      else if (in_attr[Tag_ABI_FP_number_model].i != AEABI_FP_number_model_none
+              && in_attr[Tag_ABI_VFP_args].i != AEABI_VFP_args_compatible)
        {
          _bfd_error_handler
            (_("error: %B uses VFP register arguments, %B does not"),
@@ -14719,7 +14723,7 @@ elf32_arm_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATT
       && ((i_ehdrp->e_type == ET_DYN) || (i_ehdrp->e_type == ET_EXEC)))
     {
       int abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_PROC, Tag_ABI_VFP_args);
-      if (abi)
+      if (abi == AEABI_VFP_args_vfp)
        i_ehdrp->e_flags |= EF_ARM_ABI_FLOAT_HARD;
       else
        i_ehdrp->e_flags |= EF_ARM_ABI_FLOAT_SOFT;
index 6eae51655b32b7cc84298ffae3691f826e18ff4c..cf2cc031fe5415424fc2e22e5cd83149edb12c94 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible".
+
 2014-12-24  Alexander Cherepanov  <cherepan@mccme.ru>
 
        PR binutils/17671
index d9ddb35b86c4ffd4bc9221a546926ab2a6ad7439..8a532487eab03424521129bc67f75b56302e5ae0 100644 (file)
@@ -12213,7 +12213,7 @@ static const char * arm_attr_tag_ABI_enum_size[] =
 static const char * arm_attr_tag_ABI_HardFP_use[] =
   {"As Tag_FP_arch", "SP only", "DP only", "SP and DP"};
 static const char * arm_attr_tag_ABI_VFP_args[] =
-  {"AAPCS", "VFP registers", "custom"};
+  {"AAPCS", "VFP registers", "custom", "compatible"};
 static const char * arm_attr_tag_ABI_WMMX_args[] =
   {"AAPCS", "WMMX registers", "custom"};
 static const char * arm_attr_tag_ABI_optimization_goals[] =
index dc1cb15f1a373bfae7775d68d5b86f51f83e8049..d7373cd3dd9aa6fec655941e871adad385fc9ad8 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * arm-tdep.c (arm_gdbarch_init): Explicitely handle value 3 of
+       Tag_ABI_VFP_args. Also replace hardcoded values by enum values in the
+       switch handling the different values of Tag_ABI_VFP_args.
+
 2014-12-23  Doug Evans  <xdje42@gmail.com>
 
        * ada-lang.c (user_select_syms): Only fetch symtab if symbol is
index a4f99c58fb5c6b4b2fc26e149b2ced6d46fe88a9..e12ae6e633e7ee8fe9f48000175978e6327670ee 100644 (file)
@@ -9968,27 +9968,34 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
                                                        OBJ_ATTR_PROC,
                                                        Tag_ABI_VFP_args))
                        {
-                       case 0:
+                       case (int) AEABI_VFP_args_base:
                          /* "The user intended FP parameter/result
                             passing to conform to AAPCS, base
                             variant".  */
                          fp_model = ARM_FLOAT_SOFT_VFP;
                          break;
-                       case 1:
+                       case (int) AEABI_VFP_args_vfp:
                          /* "The user intended FP parameter/result
                             passing to conform to AAPCS, VFP
                             variant".  */
                          fp_model = ARM_FLOAT_VFP;
                          break;
-                       case 2:
+                       case (int) AEABI_VFP_args_toolchain:
                          /* "The user intended FP parameter/result
                             passing to conform to tool chain-specific
                             conventions" - we don't know any such
                             conventions, so leave it as "auto".  */
                          break;
+                       case (int) AEABI_VFP_args_compatible:
+                         /* "Code is compatible with both the base
+                            and VFP variants; the user did not permit
+                            non-variadic functions to pass FP
+                            parameters/results" - leave it as
+                            "auto".  */
+                         break;
                        default:
                          /* Attribute value not mentioned in the
-                            October 2008 ABI, so leave it as
+                            November 2012 ABI, so leave it as
                             "auto".  */
                          break;
                        }
index 457fa6b87b9b86e591e69b84609daa1845ecdcf5..f4983cba130f51534f7ce920a3cde87f6780f747 100644 (file)
@@ -1,3 +1,11 @@
+2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
+       as hard float only when Tag_ABI_VFP_args is 1, using new enum value
+       AEABI_VFP_args_vfp to check that.
+       (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
+       value and replace hardcoded values by enum values.
+
 2014-12-22  Cary Coutant  <ccoutant@google.com>
 
        * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
index 6c472bb469451ce38a3d2e2b1b0b41bc6ce401c7..4186a2a7fd587d5ff240f26480ee1e7ac1efe51b 100644 (file)
@@ -10056,7 +10056,7 @@ Target_arm<big_endian>::do_adjust_elf_header(
     if (type == elfcpp::ET_EXEC || type == elfcpp::ET_DYN)
       {
        Object_attribute* attr = this->get_aeabi_object_attribute(elfcpp::Tag_ABI_VFP_args);
-       if (attr->int_value())
+       if (attr->int_value() == AEABI_VFP_args_vfp)
          flags |= elfcpp::EF_ARM_ABI_FLOAT_HARD;
        else
          flags |= elfcpp::EF_ARM_ABI_FLOAT_SOFT;
@@ -10493,10 +10493,18 @@ Target_arm<big_endian>::merge_object_attributes(
       != out_attr[elfcpp::Tag_ABI_VFP_args].int_value())
     {
       // Ignore mismatches if the object doesn't use floating point.  */
-      if (out_attr[elfcpp::Tag_ABI_FP_number_model].int_value() == 0)
+      if (out_attr[elfcpp::Tag_ABI_FP_number_model].int_value()
+         == AEABI_FP_number_model_none
+         || (in_attr[elfcpp::Tag_ABI_FP_number_model].int_value()
+             != AEABI_FP_number_model_none
+             && out_attr[elfcpp::Tag_ABI_VFP_args].int_value()
+                == AEABI_VFP_args_compatible))
        out_attr[elfcpp::Tag_ABI_VFP_args].set_int_value(
            in_attr[elfcpp::Tag_ABI_VFP_args].int_value());
-      else if (in_attr[elfcpp::Tag_ABI_FP_number_model].int_value() != 0
+      else if (in_attr[elfcpp::Tag_ABI_FP_number_model].int_value()
+              != AEABI_FP_number_model_none
+              && in_attr[elfcpp::Tag_ABI_VFP_args].int_value()
+                 != AEABI_VFP_args_compatible
               && parameters->options().warn_mismatch())
        gold_error(_("%s uses VFP register arguments, output does not"),
                   name);
index f4f71077c0f46ba7ce14ec541756a4efe0fca0e9..942923dc6dd8a7a69aba972eabb6c505a2a4e257 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum values.
+
 2014-12-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        * common.h (EM_VISIUM): Define.
index 34afdfd9f4d4ec38a83912709c3b49e5d5bbaf1c..e85536b7e238251911b6550147ab90df7d4d565c 100644 (file)
@@ -319,6 +319,23 @@ enum
   Tag_VFP_HP_extension = Tag_FP_HP_extension
 };
 
+/* Values for Tag_ABI_FP_number_model.  */
+enum
+{
+  AEABI_FP_number_model_none = 0,
+  AEABI_FP_number_model_ieee754_number = 1,
+  AEABI_FP_number_model_rtabi = 2,
+  AEABI_FP_number_model_ieee754_all = 3
+};
+
+/* Values for Tag_ABI_VFP_args.  */
+enum
+{
+  AEABI_VFP_args_base = 0,
+  AEABI_VFP_args_vfp = 1,
+  AEABI_VFP_args_toolchain = 2,
+  AEABI_VFP_args_compatible = 3
+};
 #endif
 
 /* The name of the note section used to identify arm variants.  */
index d987267775ce06a5aa42df2e0362802ebe83086e..a8c5a79487b459eafe1ff13852dcb7bae2ac2055 100644 (file)
@@ -1,3 +1,16 @@
+2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * ld-arm/attr-merge-2a.s: Add Tag_ABI_VFP_args.
+       * ld-arm/attr-merge-2b.s: Likewise.
+       * ld-arm/attr-merge-2.attr: Likewise.
+       * ld-arm/attr-merge-4a.s: Add Tag_ABI_FP_number_model and
+       Tag_ABI_VFP_args.
+       * ld-arm/attr-merge-4b.s: Likewise.
+       * ld-arm/attr-merge-4.attr: Likewise.
+       * ld-arm/attr-merge-6a.s: Likewise.
+       * ld-arm/attr-merge-6b.s: Likewise.
+       * ld-arm/attr-merge-6.attr: Add Tag_ABI_FP_number_model.
+
 2014-12-24  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * ld/testsuite/ld-avr/relax-elf-flags-02.d: Add -mno-link-relax
index 578333b26336ae73b77a3b36e4fb75954c1ce98b..9f63df460049af8227902219726d44a2bb7bd456 100644 (file)
@@ -11,4 +11,5 @@ File Attributes
   Tag_ABI_align_needed: 8-byte
   Tag_ABI_align_preserved: 8-byte, except leaf SP
   Tag_ABI_enum_size: small
+  Tag_ABI_VFP_args: VFP registers
   Tag_ABI_optimization_goals: Aggressive Debug
index 03031634b00ab048a1459fd023df12bc807d5751..8a7260cec65c24393798c8827bed632cfbd949e2 100644 (file)
@@ -6,5 +6,6 @@
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 1
+       .eabi_attribute 28, 3
        .eabi_attribute 30, 6
        .file   "attr-merge-2a.s"
index 047890a04d1302f9331bd7fd6a924c4cea1f3e0b..a22776b71e7707576643ea6553850fe249b86455 100644 (file)
@@ -6,6 +6,7 @@
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 1
+       .eabi_attribute 28, 1
        .eabi_attribute 30, 6
        .eabi_attribute 18, 4
        .file   "attr-merge-2b.s"
index 75fd063117dbf44c284222f839da67366bb1e7ac..f74b02411d823809596b2fe87105ec4d57a5831b 100644 (file)
@@ -5,4 +5,6 @@ File Attributes
   Tag_CPU_arch_profile: Microcontroller
   Tag_ARM_ISA_use: Yes
   Tag_THUMB_ISA_use: Thumb-1
+  Tag_ABI_FP_number_model: IEEE 754
+  Tag_ABI_VFP_args: compatible
   Tag_also_compatible_with: v6-M
index b5b77bf136eccab2e50d57b49a20f1d94c3768f1..9282fa217fe490ebe507c12a2ffe6b0cae2d31e8 100644 (file)
@@ -5,3 +5,6 @@
 
        @ Tag_also_compatible_with = v6-M
        .eabi_attribute Tag_also_compatible_with, "\006\013"
+
+       .eabi_attribute Tag_ABI_FP_number_model, 3
+       .eabi_attribute Tag_ABI_VFP_args, 3
index d2eb6de681dc7feecd30971df0d49aaa848c5848..2cf68df2577e1401b20e990b4e25a507a0da13e0 100644 (file)
@@ -5,3 +5,6 @@
 
        @ Tag_also_compatible_with = v4T
        .eabi_attribute Tag_also_compatible_with, "\006\002"
+
+       .eabi_attribute Tag_ABI_FP_number_model, 0
+       .eabi_attribute Tag_ABI_VFP_args, 0
index 0af32f7751d14d0221a6b31484555ffb395ac352..1ee5d40114bf1fb23e050060963d519516cd5dd0 100644 (file)
@@ -5,5 +5,6 @@ File Attributes
   Tag_CPU_arch_profile: Application
   Tag_ARM_ISA_use: Yes
   Tag_THUMB_ISA_use: Thumb-2
+  Tag_ABI_FP_number_model: IEEE 754
   Tag_MPextension_use: Allowed
   Tag_Virtualization_use: TrustZone
index 056d8c833a5e4caab54fb90afc4148fb2b4cbe31..0423bbf3b21a8106804b12a186f9b3c56839d33e 100644 (file)
@@ -1,4 +1,6 @@
        .cpu cortex-a9
        .fpu softvfp
+       .eabi_attribute 23, 3
+       .eabi_attribute 28, 0
        .eabi_attribute 70, 1
        .file   "attr-merge-6a.s"
index b9ef4d27995daa073e6285ceb1a4501d4e1c24d9..9383bcc3383f41e79b4b65c76fbc2f383b205c57 100644 (file)
@@ -1,3 +1,5 @@
        .cpu cortex-a9
        .fpu softvfp
+       .eabi_attribute 23, 3
+       .eabi_attribute 28, 3
        .file   "attr-merge-6b.s"