From 5c294fee9abb6bb259519d9cf164c34b81b83312 Mon Sep 17 00:00:00 2001 From: Terry Guo Date: Thu, 25 Dec 2014 09:50:48 +0800 Subject: ARM: Add support for value 3 of Tag_ABI_VFP_args attribute *** bfd/ChangeLog *** 2014-12-25 Thomas Preud'homme * 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 * readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible". *** gdb/ChangeLog *** 2014-12-25 Thomas Preud'homme * 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 * 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 * arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum values. *** ld/testsuite/ChangeLog *** 2014-12-25 Thomas Preud'homme * 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. --- bfd/ChangeLog | 8 ++++++++ bfd/elf32-arm.c | 12 ++++++++---- binutils/ChangeLog | 4 ++++ binutils/readelf.c | 2 +- gdb/ChangeLog | 6 ++++++ gdb/arm-tdep.c | 15 +++++++++++---- gold/ChangeLog | 8 ++++++++ gold/arm.cc | 14 +++++++++++--- include/elf/ChangeLog | 4 ++++ include/elf/arm.h | 17 +++++++++++++++++ ld/testsuite/ChangeLog | 13 +++++++++++++ ld/testsuite/ld-arm/attr-merge-2.attr | 1 + ld/testsuite/ld-arm/attr-merge-2a.s | 1 + ld/testsuite/ld-arm/attr-merge-2b.s | 1 + ld/testsuite/ld-arm/attr-merge-4.attr | 2 ++ ld/testsuite/ld-arm/attr-merge-4a.s | 3 +++ ld/testsuite/ld-arm/attr-merge-4b.s | 3 +++ ld/testsuite/ld-arm/attr-merge-6.attr | 1 + ld/testsuite/ld-arm/attr-merge-6a.s | 2 ++ ld/testsuite/ld-arm/attr-merge-6b.s | 2 ++ 20 files changed, 107 insertions(+), 12 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c85bd07..8bfb260 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2014-12-25 Thomas Preud'homme + + * 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 * pei-x86_64.c (pex64_bfd_print_pdata_section): Add cast to diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 5b2f66f..09c5aa4 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -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; diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 6eae516..cf2cc03 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2014-12-25 Thomas Preud'homme + + * readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible". + 2014-12-24 Alexander Cherepanov PR binutils/17671 diff --git a/binutils/readelf.c b/binutils/readelf.c index d9ddb35..8a53248 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -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[] = diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dc1cb15..d7373cd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2014-12-25 Thomas Preud'homme + + * 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 * ada-lang.c (user_select_syms): Only fetch symtab if symbol is diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index a4f99c5..e12ae6e 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -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; } diff --git a/gold/ChangeLog b/gold/ChangeLog index 457fa6b..f4983cb 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,11 @@ +2014-12-25 Thomas Preud'homme + + * 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 * powerpc.cc (Target_powerpc::relocate): Fix overflow check. diff --git a/gold/arm.cc b/gold/arm.cc index 6c472bb..4186a2a 100644 --- a/gold/arm.cc +++ b/gold/arm.cc @@ -10056,7 +10056,7 @@ Target_arm::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::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); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index f4f7107..942923d 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,7 @@ +2014-12-25 Thomas Preud'homme + + * arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum values. + 2014-12-06 Eric Botcazou * common.h (EM_VISIUM): Define. diff --git a/include/elf/arm.h b/include/elf/arm.h index 34afdfd..e85536b 100644 --- a/include/elf/arm.h +++ b/include/elf/arm.h @@ -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. */ diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index d987267..a8c5a79 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2014-12-25 Thomas Preud'homme + + * 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 * ld/testsuite/ld-avr/relax-elf-flags-02.d: Add -mno-link-relax diff --git a/ld/testsuite/ld-arm/attr-merge-2.attr b/ld/testsuite/ld-arm/attr-merge-2.attr index 578333b..9f63df4 100644 --- a/ld/testsuite/ld-arm/attr-merge-2.attr +++ b/ld/testsuite/ld-arm/attr-merge-2.attr @@ -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 diff --git a/ld/testsuite/ld-arm/attr-merge-2a.s b/ld/testsuite/ld-arm/attr-merge-2a.s index 0303163..8a7260c 100644 --- a/ld/testsuite/ld-arm/attr-merge-2a.s +++ b/ld/testsuite/ld-arm/attr-merge-2a.s @@ -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" diff --git a/ld/testsuite/ld-arm/attr-merge-2b.s b/ld/testsuite/ld-arm/attr-merge-2b.s index 047890a..a22776b 100644 --- a/ld/testsuite/ld-arm/attr-merge-2b.s +++ b/ld/testsuite/ld-arm/attr-merge-2b.s @@ -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" diff --git a/ld/testsuite/ld-arm/attr-merge-4.attr b/ld/testsuite/ld-arm/attr-merge-4.attr index 75fd063..f74b024 100644 --- a/ld/testsuite/ld-arm/attr-merge-4.attr +++ b/ld/testsuite/ld-arm/attr-merge-4.attr @@ -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 diff --git a/ld/testsuite/ld-arm/attr-merge-4a.s b/ld/testsuite/ld-arm/attr-merge-4a.s index b5b77bf..9282fa2 100644 --- a/ld/testsuite/ld-arm/attr-merge-4a.s +++ b/ld/testsuite/ld-arm/attr-merge-4a.s @@ -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 diff --git a/ld/testsuite/ld-arm/attr-merge-4b.s b/ld/testsuite/ld-arm/attr-merge-4b.s index d2eb6de..2cf68df 100644 --- a/ld/testsuite/ld-arm/attr-merge-4b.s +++ b/ld/testsuite/ld-arm/attr-merge-4b.s @@ -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 diff --git a/ld/testsuite/ld-arm/attr-merge-6.attr b/ld/testsuite/ld-arm/attr-merge-6.attr index 0af32f7..1ee5d40 100644 --- a/ld/testsuite/ld-arm/attr-merge-6.attr +++ b/ld/testsuite/ld-arm/attr-merge-6.attr @@ -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 diff --git a/ld/testsuite/ld-arm/attr-merge-6a.s b/ld/testsuite/ld-arm/attr-merge-6a.s index 056d8c8..0423bbf 100644 --- a/ld/testsuite/ld-arm/attr-merge-6a.s +++ b/ld/testsuite/ld-arm/attr-merge-6a.s @@ -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" diff --git a/ld/testsuite/ld-arm/attr-merge-6b.s b/ld/testsuite/ld-arm/attr-merge-6b.s index b9ef4d2..9383bcc 100644 --- a/ld/testsuite/ld-arm/attr-merge-6b.s +++ b/ld/testsuite/ld-arm/attr-merge-6b.s @@ -1,3 +1,5 @@ .cpu cortex-a9 .fpu softvfp + .eabi_attribute 23, 3 + .eabi_attribute 28, 3 .file "attr-merge-6b.s" -- cgit v1.1