]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2013-10-14 Chao-ying Fu <Chao-ying.Fu@imgtec.com>
authorChao-ying Fu <fu@mips.com>
Mon, 14 Oct 2013 18:43:39 +0000 (18:43 +0000)
committerChao-ying Fu <fu@mips.com>
Mon, 14 Oct 2013 18:43:39 +0000 (18:43 +0000)
* elfxx-mips.c (mips_elf_obj_tdata): Add abi_msa_bfd.
(mips_elf_merge_obj_attributes): Set abi_msa_bfd to the first object
file that has a Tag_GNU_MIPS_ABI_MSA attribute.
Merge Tag_GNU_MIPS_ABI_MSA attributes.

bfd/ChangeLog
bfd/elfxx-mips.c

index f4dcecbc736d9730f7f7ac1e330b66ce81085a45..f9a0575befebc21e4b182ab13fd535dd0b0e492f 100644 (file)
@@ -1,3 +1,10 @@
+2013-10-14  Chao-ying Fu  <Chao-ying.Fu@imgtec.com>
+
+       * elfxx-mips.c (mips_elf_obj_tdata): Add abi_msa_bfd.
+       (mips_elf_merge_obj_attributes): Set abi_msa_bfd to the first object
+       file that has a Tag_GNU_MIPS_ABI_MSA attribute.
+       Merge Tag_GNU_MIPS_ABI_MSA attributes.
+
 2013-10-14  Nick Clifton  <nickc@redhat.com>
 
        * gen-aout.c (main): Fix formatting.  Close file.
index b4438765d156c010573c51ac8daf8a6e475b20db..1c64ad35d83366daf895b45613e594ed7dd18652 100644 (file)
@@ -542,6 +542,9 @@ struct mips_elf_obj_tdata
   /* Input BFD providing Tag_GNU_MIPS_ABI_FP attribute for output.  */
   bfd *abi_fp_bfd;
 
+  /* Input BFD providing Tag_GNU_MIPS_ABI_MSA attribute for output.  */
+  bfd *abi_msa_bfd;
+
   /* The GOT requirements of input bfds.  */
   struct mips_got_info *got;
 
@@ -14328,12 +14331,18 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
   obj_attribute *in_attr;
   obj_attribute *out_attr;
   bfd *abi_fp_bfd;
+  bfd *abi_msa_bfd;
 
   abi_fp_bfd = mips_elf_tdata (obfd)->abi_fp_bfd;
   in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
   if (!abi_fp_bfd && in_attr[Tag_GNU_MIPS_ABI_FP].i != Val_GNU_MIPS_ABI_FP_ANY)
     mips_elf_tdata (obfd)->abi_fp_bfd = ibfd;
 
+  abi_msa_bfd = mips_elf_tdata (obfd)->abi_msa_bfd;
+  if (!abi_msa_bfd
+      && in_attr[Tag_GNU_MIPS_ABI_MSA].i != Val_GNU_MIPS_ABI_MSA_ANY)
+    mips_elf_tdata (obfd)->abi_msa_bfd = ibfd;
+
   if (!elf_known_obj_attributes_proc (obfd)[0].i)
     {
       /* This is the first object.  Copy the attributes.  */
@@ -14523,6 +14532,47 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
          }
     }
 
+  /* Check for conflicting Tag_GNU_MIPS_ABI_MSA attributes and merge
+     non-conflicting ones.  */
+  if (in_attr[Tag_GNU_MIPS_ABI_MSA].i != out_attr[Tag_GNU_MIPS_ABI_MSA].i)
+    {
+      out_attr[Tag_GNU_MIPS_ABI_MSA].type = 1;
+      if (out_attr[Tag_GNU_MIPS_ABI_MSA].i == Val_GNU_MIPS_ABI_MSA_ANY)
+       out_attr[Tag_GNU_MIPS_ABI_MSA].i = in_attr[Tag_GNU_MIPS_ABI_MSA].i;
+      else if (in_attr[Tag_GNU_MIPS_ABI_MSA].i != Val_GNU_MIPS_ABI_MSA_ANY)
+       switch (out_attr[Tag_GNU_MIPS_ABI_MSA].i)
+         {
+         case Val_GNU_MIPS_ABI_MSA_128:
+           _bfd_error_handler
+             (_("Warning: %B uses %s (set by %B), "
+                "%B uses unknown MSA ABI %d"),
+              obfd, abi_msa_bfd, ibfd,
+              "-mmsa", in_attr[Tag_GNU_MIPS_ABI_MSA].i);
+           break;
+
+         default:
+           switch (in_attr[Tag_GNU_MIPS_ABI_MSA].i)
+             {
+             case Val_GNU_MIPS_ABI_MSA_128:
+               _bfd_error_handler
+                 (_("Warning: %B uses unknown MSA ABI %d "
+                    "(set by %B), %B uses %s"),
+                    obfd, abi_msa_bfd, ibfd,
+                    out_attr[Tag_GNU_MIPS_ABI_MSA].i, "-mmsa");
+                 break;
+
+             default:
+               _bfd_error_handler
+                 (_("Warning: %B uses unknown MSA ABI %d "
+                    "(set by %B), %B uses unknown MSA ABI %d"),
+                  obfd, abi_msa_bfd, ibfd,
+                  out_attr[Tag_GNU_MIPS_ABI_MSA].i,
+                  in_attr[Tag_GNU_MIPS_ABI_MSA].i);
+               break;
+             }
+         }
+    }
+
   /* Merge Tag_compatibility attributes and any common GNU ones.  */
   _bfd_elf_merge_object_attributes (ibfd, obfd);