From b60bf9be01d4b642d5bc669f88af9509a05bd60f Mon Sep 17 00:00:00 2001 From: Chao-ying Fu Date: Mon, 14 Oct 2013 18:43:39 +0000 Subject: 2013-10-14 Chao-ying Fu * 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 | 7 +++++++ bfd/elfxx-mips.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f4dcecb..f9a0575 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2013-10-14 Chao-ying Fu + + * 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 * gen-aout.c (main): Fix formatting. Close file. diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index b443876..1c64ad3 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -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); -- cgit v1.1