* bfd/elf32-arm.c (elf32_arm_merge_eabi_attributes): Add support for
authorMatthew Gretton-Dann <matthew.gretton-dann@arm.com>
Thu, 18 Feb 2010 10:56:28 +0000 (10:56 +0000)
committerMatthew Gretton-Dann <matthew.gretton-dann@arm.com>
Thu, 18 Feb 2010 10:56:28 +0000 (10:56 +0000)
merging Tag_DIV_use, Tag_MPextension_use, and
Tag_MPextension_use_legacy tags.
* binutils/readelf.c (arm_attr_tag_Advanced_SIMD_arch): Add
description of newly permitted attribute values.
(arm_attr_tag_Virtualization_use): Likewise.
(arm_attr_tag_DIV_use): Add description of new attribute.
(arm_attr_tag_MPextension_use_legacy): Likewise.
* gas/config/tc-arm.c (arm_convert_symbolic_attribute):
Add Tag_DIV_use.
* gas/doc/c-arm.texi: Likewise.
* gas/testsuite/gas/arm/attr-order.d: Fix test for new names for
attribute values.
* include/elf/arm.h (Tag_MPextension_use): Renumber.
(Tag_DIV_use): Add.
(Tag_MPextension_use_legacy): Likewise.
* ld/testsuite/ld-arm/attr-merge-3.attr: Fix test for new attribute
values.
* ld/testsuite/ld-arm/attr-merge-3b.s: Likewise.
* ld/testsuite/ld-arm/attr-merge-unknown-1.d: Fix test now that 42
is a recognised attribute ID.
* ld/testsuite/ld-arm/attr-merge-unknown-1.s: Likewise.
* ld/testsuite/ld-arm/attr-merge-6.attr: New test.
* ld/testsuite/ld-arm/attr-merge-6a.s: Likewise.
* ld/testsuite/ld-arm/attr-merge-6b.s: Likewise.
* ld/testsuite/ld-arm/attr-merge-7.attr: Likewise.
* ld/testsuite/ld-arm/attr-merge-7a.s: Likewise.
* ld/testsuite/ld-arm/attr-merge-7b.s: Likewise.
* ld/testsuite/ld-arm/arm-elf.exp: Run the new tests.

22 files changed:
bfd/ChangeLog
bfd/elf32-arm.c
binutils/ChangeLog
binutils/readelf.c
gas/ChangeLog
gas/config/tc-arm.c
gas/doc/c-arm.texi
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/attr-order.d
include/elf/ChangeLog
include/elf/arm.h
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-elf.exp
ld/testsuite/ld-arm/attr-merge-3.attr
ld/testsuite/ld-arm/attr-merge-3b.s
ld/testsuite/ld-arm/attr-merge-6a.s [new file with mode: 0644]
ld/testsuite/ld-arm/attr-merge-6b.s [new file with mode: 0644]
ld/testsuite/ld-arm/attr-merge-7.attr [new file with mode: 0644]
ld/testsuite/ld-arm/attr-merge-7a.s [new file with mode: 0644]
ld/testsuite/ld-arm/attr-merge-7b.s [new file with mode: 0644]
ld/testsuite/ld-arm/attr-merge-unknown-1.d
ld/testsuite/ld-arm/attr-merge-unknown-1.s

index 60d0ecc424f1d744dcec693cedeb61d899452c9f..8e0e2ddbb02d91730948f40ada57035a57701912 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-18  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+       * elf32-arm.c (elf32_arm_merge_eabi_attributes): Add support for
+       merging Tag_DIV_use, Tag_MPextension_use, and
+       Tag_MPextension_use_legacy tags.
+
 2010-02-18  Alan Modra  <amodra@gmail.com>
 
        * elf.c (bfd_elf_set_group_contents): Revert accidental 2009-01-15
index 06613692e71db0678bf13c20356fd97add478c76..a0694c10e0b5d7679cd3664801e63c8dd7e2319c 100644 (file)
@@ -9812,11 +9812,33 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
       /* This is the first object.  Copy the attributes.  */
       _bfd_elf_copy_obj_attributes (ibfd, obfd);
 
+      out_attr = elf_known_obj_attributes_proc (obfd);
+
       /* Use the Tag_null value to indicate the attributes have been
         initialized.  */
-      elf_known_obj_attributes_proc (obfd)[0].i = 1;
+      out_attr[0].i = 1;
 
-      return TRUE;
+      /* We do not output objects with Tag_MPextension_use_legacy - we move
+        the attribute's value to Tag_MPextension_use.  */
+      if (out_attr[Tag_MPextension_use_legacy].i != 0)
+       {
+         if (out_attr[Tag_MPextension_use].i != 0
+             && out_attr[Tag_MPextension_use_legacy].i
+               != out_attr[Tag_MPextension_use].i)
+           {
+             _bfd_error_handler
+               (_("Error: %B has both the current and legacy "
+                  "Tag_MPextension_use attributes"), ibfd);
+             result = FALSE;
+           }
+
+         out_attr[Tag_MPextension_use] =
+           out_attr[Tag_MPextension_use_legacy];
+         out_attr[Tag_MPextension_use_legacy].type = 0;
+         out_attr[Tag_MPextension_use_legacy].i = 0;
+       }
+
+      return result;
     }
 
   in_attr = elf_known_obj_attributes_proc (ibfd);
@@ -10151,6 +10173,52 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
            out_attr[i].i = in_attr[i].i;
          break;
 
+       case Tag_DIV_use:
+         /* This tag is set to zero if we can use UDIV and SDIV in Thumb
+            mode on a v7-M or v7-R CPU; to one if we can not use UDIV or
+            SDIV at all; and to two if we can use UDIV or SDIV on a v7-A
+            CPU.  We will merge as follows: If the input attribute's value
+            is one then the output attribute's value remains unchanged.  If
+            the input attribute's value is zero or two then if the output
+            attribute's value is one the output value is set to the input
+            value, otherwise the output value must be the same as the
+            inputs.  */ 
+         if (in_attr[i].i != 1 && out_attr[i].i != 1) 
+           { 
+             if (in_attr[i].i != out_attr[i].i)
+               {
+                 _bfd_error_handler
+                   (_("DIV usage mismatch between %B and %B"),
+                    ibfd, obfd); 
+                 result = FALSE;
+               }
+           } 
+
+         if (in_attr[i].i != 1)
+           out_attr[i].i = in_attr[i].i; 
+         
+         break;
+
+       case Tag_MPextension_use_legacy:
+         /* We don't output objects with Tag_MPextension_use_legacy - we
+            move the value to Tag_MPextension_use.  */
+         if (in_attr[i].i != 0 && in_attr[Tag_MPextension_use].i != 0)
+           {
+             if (in_attr[Tag_MPextension_use].i != in_attr[i].i)
+               {
+                 _bfd_error_handler
+                   (_("%B has has both the current and legacy "
+                      "Tag_MPextension_use attributes"), 
+                    ibfd);
+                 result = FALSE;
+               }
+           }
+
+         if (in_attr[i].i > out_attr[Tag_MPextension_use].i)
+           out_attr[Tag_MPextension_use] = in_attr[i];
+
+         break;
+
        case Tag_nodefaults:
          /* This tag is set if it exists, but the value is unused (and is
             typically zero).  We don't actually need to do anything here -
index 75e04e8078a8251b9c60028131d16a764d560290..c494961c1107d2b992f27065738eafe7bb248c02 100644 (file)
@@ -1,3 +1,11 @@
+2010-02-18  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+       * readelf.c (arm_attr_tag_Advanced_SIMD_arch): Add description of
+       newly permitted attribute values.
+       (arm_attr_tag_Virtualization_use): Likewise.
+       (arm_attr_tag_DIV_use): Add description of new attribute.
+       (arm_attr_tag_MPextension_use_legacy): Likewise.
+
 2010-02-15  Nick Clifton  <nickc@redhat.com>
 
        * po/vi.po: Updated Vietnamese translation.
index 6994289522e77c99b5fb152bea1626bfa9180324..b5d766f9294d5706f5e270a009138045f1081dce 100644 (file)
@@ -9071,7 +9071,8 @@ static const char * arm_attr_tag_THUMB_ISA_use[] =
 static const char * arm_attr_tag_VFP_arch[] =
   {"No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16", "VFPv4", "VFPv4-D16"};
 static const char * arm_attr_tag_WMMX_arch[] = {"No", "WMMXv1", "WMMXv2"};
-static const char * arm_attr_tag_Advanced_SIMD_arch[] = {"No", "NEONv1"};
+static const char * arm_attr_tag_Advanced_SIMD_arch[] = 
+  {"No", "NEONv1", "NEONv1 with Fused-MAC"};
 static const char * arm_attr_tag_PCS_config[] =
   {"None", "Bare platform", "Linux application", "Linux DSO", "PalmOS 2004",
    "PalmOS (reserved)", "SymbianOS 2004", "SymbianOS (reserved)"};
@@ -9114,10 +9115,17 @@ static const char * arm_attr_tag_VFP_HP_extension[] =
   {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_ABI_FP_16bit_format[] =
   {"None", "IEEE 754", "Alternative Format"};
+static const char * arm_attr_tag_MPextension_use[] = 
+  {"Not Allowed", "Allowed"};
+static const char * arm_attr_tag_DIV_use[] =
+  {"Allowed in Thumb-ISA, v7-R or v7-M", "Not allowed", 
+    "Allowed in v7-A with integer division extension"};
 static const char * arm_attr_tag_T2EE_use[] = {"Not Allowed", "Allowed"};
 static const char * arm_attr_tag_Virtualization_use[] =
+  {"Not Allowed", "TrustZone", "Virtualization Extensions", 
+    "TrustZone and Virtualization Extensions"};
+static const char * arm_attr_tag_MPextension_use_legacy[] = 
   {"Not Allowed", "Allowed"};
-static const char * arm_attr_tag_MPextension_use[] = {"Not Allowed", "Allowed"};
 
 #define LOOKUP(id, name) \
   {id, #name, 0x80 | ARRAY_SIZE(arm_attr_tag_##name), arm_attr_tag_##name}
@@ -9155,12 +9163,14 @@ static arm_attr_public_tag arm_attr_public_tags[] =
   LOOKUP(34, CPU_unaligned_access),
   LOOKUP(36, VFP_HP_extension),
   LOOKUP(38, ABI_FP_16bit_format),
+  LOOKUP(42, MPextension_use),
+  LOOKUP(44, DIV_use),
   {64, "nodefaults", 0, NULL},
   {65, "also_compatible_with", 0, NULL},
   LOOKUP(66, T2EE_use),
   {67, "conformance", 1, NULL},
   LOOKUP(68, Virtualization_use),
-  LOOKUP(70, MPextension_use)
+  LOOKUP(70, MPextension_use_legacy)
 };
 #undef LOOKUP
 
index 9532e7cf27d667bcdffcdc17c118a46c0aa60508..6258c3db777147a11af048d0780d97d641753c2b 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-18  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+       * config/tc-arm.c (arm_convert_symbolic_attribute): Add Tag_DIV_use.
+       * doc/c-arm.texi: Likewise.
+
 2010-02-12  Daniel Gutson <dgutson@codesourcery.com>
 
        * config/tc-arm.c (asm_opcode): operands type
index 47066007b310af2a2d1527405aa24a60a7ae5f69..04b3f703248fec08b8f2fcbba2d673e1e2ce0a5d 100644 (file)
@@ -23043,12 +23043,14 @@ arm_convert_symbolic_attribute (const char *name)
       T (Tag_CPU_unaligned_access),
       T (Tag_VFP_HP_extension),
       T (Tag_ABI_FP_16bit_format),
+      T (Tag_MPextension_use),
+      T (Tag_DIV_use),
       T (Tag_nodefaults),
       T (Tag_also_compatible_with),
       T (Tag_conformance),
       T (Tag_T2EE_use),
       T (Tag_Virtualization_use),
-      T (Tag_MPextension_use)
+      /* We deliberately do not include Tag_MPextension_use_legacy.  */
 #undef T
     };
   unsigned int i;
index 69ed6b63a89879c01488456058bc2b0382bee76d..11d7215be63fcf8a49f5a90b715c0af45117c024 100644 (file)
@@ -587,9 +587,10 @@ The @var{tag} is either an attribute number, or one of the following:
 @code{Tag_ABI_optimization_goals}, @code{Tag_ABI_FP_optimization_goals},
 @code{Tag_compatibility}, @code{Tag_CPU_unaligned_access},
 @code{Tag_VFP_HP_extension}, @code{Tag_ABI_FP_16bit_format},
+@code{Tag_MPextension_use}, @code{Tag_DIV_use},
 @code{Tag_nodefaults}, @code{Tag_also_compatible_with},
 @code{Tag_conformance}, @code{Tag_T2EE_use},
-@code{Tag_Virtualization_use}, @code{Tag_MPextension_use}
+@code{Tag_Virtualization_use}
 
 The @var{value} is either a @code{number}, @code{"string"}, or
 @code{number, "string"} depending on the tag.
index ff4268fe063180c2a96af392fa3efca664a3aa8e..c42426388db910cf313479cb2fca898e517135d2 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-18  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+       * gas/arm/attr-order.d: Fix test for new names for attribute 
+       values.
+
 2010-02-12  Daniel Gutson  <dgutson@codesourcery.com>
 
        * gas/arm/sp-pc-validations-bad.d: New testcase.
index 3f10867fe172417029a65e0abde08fe579419a0c..83f9f68bffbef780358415613d54dff922339891 100644 (file)
@@ -16,4 +16,4 @@ File Attributes
   Tag_unknown_63: "val"
   Tag_also_compatible_with: v6-M
   Tag_T2EE_use: Allowed
-  Tag_Virtualization_use: Allowed
+  Tag_Virtualization_use: TrustZone
index 6ebc8965ae43d8cd0a6cac4079360ffd59b4e96d..52e4c371b3dc7e31bbe86d6af405339a78e7d5c9 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-18  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+       * arm.h (Tag_MPextension_use): Renumber.
+       (Tag_DIV_use): Add.
+       (Tag_MPextension_use_legacy): Likewise.
+
 2010-02-09  Michael Holzheu  <holzheu@de.ibm.com>
 
        * common.h (NT_S390_TIMER, NT_S390_TODCMP, NT_S390_TODPREG,
index 6011780e6b8428c30d3ac6c47cad10f9bfec735f..94c44d4120e7e45f4632cb11dc99edf11807acd5 100644 (file)
@@ -288,13 +288,18 @@ enum
   Tag_undefined37,
   Tag_ABI_FP_16bit_format,
   Tag_undefined39,
+  Tag_undefined40,
+  Tag_undefined41,
+  Tag_MPextension_use,
+  Tag_undefined_43,
+  Tag_DIV_use,
   Tag_nodefaults = 64,
   Tag_also_compatible_with,
   Tag_T2EE_use,
   Tag_conformance,
   Tag_Virtualization_use,
   Tag_undefined69,
-  Tag_MPextension_use
+  Tag_MPextension_use_legacy
 };
 
 #endif
index ee43b158e205c0c292ec6de26c8f2ff8c9747afd..229fbfd8207cde3dd4d280fc36048182ec3045eb 100644 (file)
@@ -1,3 +1,18 @@
+2010-02-18  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+       * ld-arm/attr-merge-3.attr: Fix test for new attribute values.
+       * ld-arm/attr-merge-3b.s: Likewise.
+       * ld-arm/attr-merge-unknown-1.d: Fix test now that 42 is a recognised
+       attribute ID.
+       * ld-arm/attr-merge-unknown-1.s: Likewise.
+       * ld-arm/attr-merge-6.attr: New test.
+       * ld-arm/attr-merge-6a.s: Likewise.
+       * ld-arm/attr-merge-6b.s: Likewise.
+       * ld-arm/attr-merge-7.attr: Likewise.
+       * ld-arm/attr-merge-7a.s: Likewise.
+       * ld-arm/attr-merge-7b.s: Likewise.
+       * ld-arm/arm-elf.exp: Run the new tests.
+
 2010-02-15  Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
 
        * ld-arm/jump-reloc-veneers-long.d: Correct testcase for
index a207a79a9592ea762648c667c852937225436965..ed9cb7430a4311a50f23ebf53ef6420d23755023 100644 (file)
@@ -296,6 +296,15 @@ set armeabitests {
      {"EABI attribute merging 5" "-r" "" {attr-merge-5.s attr-merge-5.s}
       {{readelf -A attr-merge-5.attr}}
       "attr-merge-5"}
+     {"EABI attribute merging 6" "-r" "" {attr-merge-6a.s attr-merge-6b.s}
+      {{readelf -A attr-merge-6.attr}}
+      "attr-merge-6"}
+     {"EABI attribute merging 6 reversed" "-r" "" {attr-merge-6b.s attr-merge-6a.s}
+      {{readelf -A attr-merge-6.attr}}
+      "attr-merge-6r"}
+     {"EABI attribute merging 7" "-r" "" {attr-merge-7a.s attr-merge-7b.s}
+      {{readelf -A attr-merge-7.attr}}
+      "attr-merge-7"}
      {"EABI attribute arch merging 1" "-r" "" {arch-v6k.s arch-v6t2.s}
       {{readelf -A attr-merge-arch-1.attr}}
       "attr-merge-arch-1"}
index e4e06e19838866050ac34f7b94140d8a08dd5c9c..b8651815fbe15460a4b0a9aace836b091fbb701e 100644 (file)
@@ -26,6 +26,6 @@ File Attributes
   Tag_ABI_VFP_args: VFP registers
   Tag_CPU_unaligned_access: v6
   Tag_VFP_HP_extension: Allowed
-  Tag_T2EE_use: Allowed
-  Tag_Virtualization_use: Allowed
   Tag_MPextension_use: Allowed
+  Tag_T2EE_use: Allowed
+  Tag_Virtualization_use: TrustZone
index b8584821f8f0f9c3f3aeb2c91d9566d7207a91c4..73d65907e9845b0ba5c9b94f2f1bc44f0259b5f4 100644 (file)
@@ -33,6 +33,6 @@
        .eabi_attribute Tag_nodefaults, 1
        @ .eabi_attribute Tag_also_compatible_with,
        .eabi_attribute Tag_T2EE_use, 1
-       .eabi_attribute Tag_conformance, "2.07"
+       .eabi_attribute Tag_conformance, "2.08"
        .eabi_attribute Tag_Virtualization_use, 1
        .eabi_attribute Tag_MPextension_use, 1
diff --git a/ld/testsuite/ld-arm/attr-merge-6a.s b/ld/testsuite/ld-arm/attr-merge-6a.s
new file mode 100644 (file)
index 0000000..056d8c8
--- /dev/null
@@ -0,0 +1,4 @@
+       .cpu cortex-a9
+       .fpu softvfp
+       .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
new file mode 100644 (file)
index 0000000..b9ef4d2
--- /dev/null
@@ -0,0 +1,3 @@
+       .cpu cortex-a9
+       .fpu softvfp
+       .file   "attr-merge-6b.s"
diff --git a/ld/testsuite/ld-arm/attr-merge-7.attr b/ld/testsuite/ld-arm/attr-merge-7.attr
new file mode 100644 (file)
index 0000000..e996c93
--- /dev/null
@@ -0,0 +1,9 @@
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "CORTEX-A9"
+  Tag_CPU_arch: v7
+  Tag_CPU_arch_profile: Application
+  Tag_ARM_ISA_use: Yes
+  Tag_THUMB_ISA_use: Thumb-2
+  Tag_MPextension_use: Allowed
+
diff --git a/ld/testsuite/ld-arm/attr-merge-7a.s b/ld/testsuite/ld-arm/attr-merge-7a.s
new file mode 100644 (file)
index 0000000..d875d28
--- /dev/null
@@ -0,0 +1,4 @@
+       .cpu cortex-a9
+       .fpu softvfp
+       .eabi_attribute 70, 1
+       .file   "attr-merge-7a.s"
diff --git a/ld/testsuite/ld-arm/attr-merge-7b.s b/ld/testsuite/ld-arm/attr-merge-7b.s
new file mode 100644 (file)
index 0000000..2e83e71
--- /dev/null
@@ -0,0 +1,4 @@
+       .cpu cortex-a9
+       .fpu softvfp
+       .eabi_attribute Tag_MPextension_use, 1
+       .file   "attr-merge-7b.s"
index 395d2b67e249d975274526b29105b488ba84a364..38acff9521a7aba1173fb6bf5ad19d703068d0ab 100644 (file)
@@ -2,4 +2,4 @@
 #source: blank.s
 #as:
 #ld:
-#error: Unknown mandatory EABI object attribute 42
+#error: Unknown mandatory EABI object attribute 40
index 298c67396dca33efaead127602ef63c9c2c5651d..d2cff1f31714cb4aeef771b9494044fa2ef5f1ed 100644 (file)
@@ -1,3 +1,3 @@
        @ This attrubute is supposed to be unknown.
        @ If this number should become known, change it.
-       .eabi_attribute  42, 1
+       .eabi_attribute  40, 1