aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2012-12-03 16:17:48 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2012-12-03 16:17:48 +0000
commit6ae68ba390f269463c66cdb3d5f2882b11b446ac (patch)
treeaa60920a8e1d0ab94c5435dfe2196bc63d2e7122 /bfd
parent20696deded3ddcf936795f73f53a7a702a6955b1 (diff)
downloadgdb-6ae68ba390f269463c66cdb3d5f2882b11b446ac.zip
gdb-6ae68ba390f269463c66cdb3d5f2882b11b446ac.tar.gz
gdb-6ae68ba390f269463c66cdb3d5f2882b11b446ac.tar.bz2
bfd/
* elf32-mips.c (bfd_elf32_mkobject): New macro. * elf64-mips.c (bfd_elf64_mkobject): Likewise. * elfn32-mips.c (bfd_elf32_mkobject): Likewise. * elfxx-mips.h (_bfd_mips_elf_mkobject): New prototype. * elfxx-mips.c (mips_elf_obj_tdata): New struct. (mips_elf_tdata): New macro. (_bfd_mips_elf_mkobject): New function. (mips_elf_merge_obj_attributes): Report the originating input BFD on attribute conflicts. ld/testsuite/ * ld-mips-elf/attr-gnu-4-12.d: Update the warning message. * ld-mips-elf/attr-gnu-4-13.d: Likewise. * ld-mips-elf/attr-gnu-4-14.d: Likewise. * ld-mips-elf/attr-gnu-4-15.d: Likewise. * ld-mips-elf/attr-gnu-4-21.d: Likewise. * ld-mips-elf/attr-gnu-4-23.d: Likewise. * ld-mips-elf/attr-gnu-4-24.d: Likewise. * ld-mips-elf/attr-gnu-4-25.d: Likewise. * ld-mips-elf/attr-gnu-4-31.d: Likewise. * ld-mips-elf/attr-gnu-4-32.d: Likewise. * ld-mips-elf/attr-gnu-4-34.d: Likewise. * ld-mips-elf/attr-gnu-4-35.d: Likewise. * ld-mips-elf/attr-gnu-4-41.d: Likewise. * ld-mips-elf/attr-gnu-4-42.d: Likewise. * ld-mips-elf/attr-gnu-4-43.d: Likewise. * ld-mips-elf/attr-gnu-4-45.d: Likewise. * ld-mips-elf/attr-gnu-4-51.d: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog12
-rw-r--r--bfd/elf32-mips.c1
-rw-r--r--bfd/elf64-mips.c1
-rw-r--r--bfd/elfn32-mips.c1
-rw-r--r--bfd/elfxx-mips.c161
-rw-r--r--bfd/elfxx-mips.h2
6 files changed, 141 insertions, 37 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index af8d7a0..e1e9087 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,17 @@
2012-12-03 Maciej W. Rozycki <macro@codesourcery.com>
+ * elf32-mips.c (bfd_elf32_mkobject): New macro.
+ * elf64-mips.c (bfd_elf64_mkobject): Likewise.
+ * elfn32-mips.c (bfd_elf32_mkobject): Likewise.
+ * elfxx-mips.h (_bfd_mips_elf_mkobject): New prototype.
+ * elfxx-mips.c (mips_elf_obj_tdata): New struct.
+ (mips_elf_tdata): New macro.
+ (_bfd_mips_elf_mkobject): New function.
+ (mips_elf_merge_obj_attributes): Report the originating input BFD
+ on attribute conflicts.
+
+2012-12-03 Maciej W. Rozycki <macro@codesourcery.com>
+
* elfxx-mips.c (mips_elf_merge_obj_attributes): Correct messages
for the -mdouble-float and -msingle-float cases throughout; make
all the messages report the output file consistently on the
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 61e8b45..c2bc0da 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -2372,6 +2372,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#define bfd_elf32_bfd_print_private_bfd_data \
_bfd_mips_elf_print_private_bfd_data
#define bfd_elf32_bfd_relax_section _bfd_mips_elf_relax_section
+#define bfd_elf32_mkobject _bfd_mips_elf_mkobject
/* Support for SGI-ish mips targets. */
#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vec
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 093c700..f269a21 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -4166,6 +4166,7 @@ const struct elf_size_info mips_elf64_size_info =
#define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
#define bfd_elf64_canonicalize_dynamic_reloc mips_elf64_canonicalize_dynamic_reloc
#define bfd_elf64_bfd_relax_section _bfd_mips_relax_section
+#define bfd_elf64_mkobject _bfd_mips_elf_mkobject
/* MIPS ELF64 archive functions. */
#define bfd_elf64_archive_functions
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index 81d4cf1..7c3ca7d 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -3381,6 +3381,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
#define bfd_elf32_bfd_print_private_bfd_data \
_bfd_mips_elf_print_private_bfd_data
#define bfd_elf32_bfd_relax_section _bfd_mips_relax_section
+#define bfd_elf32_mkobject _bfd_mips_elf_mkobject
/* Support for SGI-ish mips targets using n32 ABI. */
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 7b66c8a..168973e 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -515,6 +515,22 @@ struct mips_htab_traverse_info
bfd_boolean error;
};
+/* MIPS ELF private object data. */
+
+struct mips_elf_obj_tdata
+{
+ /* Generic ELF private object data. */
+ struct elf_obj_tdata root;
+
+ /* Input BFD providing Tag_GNU_MIPS_ABI_FP attribute for output. */
+ bfd *abi_fp_bfd;
+};
+
+/* Get MIPS ELF private object data from BFD's tdata. */
+
+#define mips_elf_tdata(bfd) \
+ ((struct mips_elf_obj_tdata *) (bfd)->tdata.any)
+
#define TLS_RELOC_P(r_type) \
(r_type == R_MIPS_TLS_DTPMOD32 \
|| r_type == R_MIPS_TLS_DTPMOD64 \
@@ -1115,6 +1131,15 @@ mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
return (struct bfd_hash_entry *) ret;
}
+/* Allocate MIPS ELF private object data. */
+
+bfd_boolean
+_bfd_mips_elf_mkobject (bfd *abfd)
+{
+ return bfd_elf_allocate_object (abfd, sizeof (struct mips_elf_obj_tdata),
+ MIPS_ELF_DATA);
+}
+
bfd_boolean
_bfd_mips_elf_new_section_hook (bfd *abfd, asection *sec)
{
@@ -13749,6 +13774,12 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
{
obj_attribute *in_attr;
obj_attribute *out_attr;
+ bfd *abi_fp_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 != 0)
+ mips_elf_tdata (obfd)->abi_fp_bfd = ibfd;
if (!elf_known_obj_attributes_proc (obfd)[0].i)
{
@@ -13764,24 +13795,13 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
/* Check for conflicting Tag_GNU_MIPS_ABI_FP attributes and merge
non-conflicting ones. */
- in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
if (in_attr[Tag_GNU_MIPS_ABI_FP].i != out_attr[Tag_GNU_MIPS_ABI_FP].i)
{
out_attr[Tag_GNU_MIPS_ABI_FP].type = 1;
if (out_attr[Tag_GNU_MIPS_ABI_FP].i == 0)
out_attr[Tag_GNU_MIPS_ABI_FP].i = in_attr[Tag_GNU_MIPS_ABI_FP].i;
- else if (in_attr[Tag_GNU_MIPS_ABI_FP].i == 0)
- ;
- else if (in_attr[Tag_GNU_MIPS_ABI_FP].i > 4)
- _bfd_error_handler
- (_("Warning: %B uses unknown floating point ABI %d"), ibfd,
- in_attr[Tag_GNU_MIPS_ABI_FP].i);
- else if (out_attr[Tag_GNU_MIPS_ABI_FP].i > 4)
- _bfd_error_handler
- (_("Warning: %B uses unknown floating point ABI %d"), obfd,
- out_attr[Tag_GNU_MIPS_ABI_FP].i);
- else
+ else if (in_attr[Tag_GNU_MIPS_ABI_FP].i != 0)
switch (out_attr[Tag_GNU_MIPS_ABI_FP].i)
{
case 1:
@@ -13789,24 +13809,30 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
{
case 2:
_bfd_error_handler
- (_("Warning: %B uses -mdouble-float, %B uses -msingle-float"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd, "-mdouble-float", "-msingle-float");
break;
case 3:
_bfd_error_handler
- (_("Warning: %B uses hard float, %B uses soft float"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
break;
case 4:
_bfd_error_handler
- (_("Warning: %B uses -mdouble-float, %B uses -mips32r2 -mfp64"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd,
+ "-mdouble-float", "-mips32r2 -mfp64");
break;
default:
- abort ();
+ _bfd_error_handler
+ (_("Warning: %B uses %s (set by %B), "
+ "%B uses unknown floating point ABI %d"),
+ obfd, abi_fp_bfd, ibfd,
+ "-mdouble-float", in_attr[Tag_GNU_MIPS_ABI_FP].i);
+ break;
}
break;
@@ -13815,24 +13841,30 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
{
case 1:
_bfd_error_handler
- (_("Warning: %B uses -msingle-float, %B uses -mdouble-float"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd, "-msingle-float", "-mdouble-float");
break;
case 3:
_bfd_error_handler
- (_("Warning: %B uses hard float, %B uses soft float"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
break;
case 4:
_bfd_error_handler
- (_("Warning: %B uses -msingle-float, %B uses -mips32r2 -mfp64"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd,
+ "-msingle-float", "-mips32r2 -mfp64");
break;
default:
- abort ();
+ _bfd_error_handler
+ (_("Warning: %B uses %s (set by %B), "
+ "%B uses unknown floating point ABI %d"),
+ obfd, abi_fp_bfd, ibfd,
+ "-msingle-float", in_attr[Tag_GNU_MIPS_ABI_FP].i);
+ break;
}
break;
@@ -13843,12 +13875,17 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
case 2:
case 4:
_bfd_error_handler
- (_("Warning: %B uses soft float, %B uses hard float"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd, "-msoft-float", "-mhard-float");
break;
default:
- abort ();
+ _bfd_error_handler
+ (_("Warning: %B uses %s (set by %B), "
+ "%B uses unknown floating point ABI %d"),
+ obfd, abi_fp_bfd, ibfd,
+ "-msoft-float", in_attr[Tag_GNU_MIPS_ABI_FP].i);
+ break;
}
break;
@@ -13857,29 +13894,79 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
{
case 1:
_bfd_error_handler
- (_("Warning: %B uses -mips32r2 -mfp64, %B uses -mdouble-float"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd,
+ "-mips32r2 -mfp64", "-mdouble-float");
break;
case 2:
_bfd_error_handler
- (_("Warning: %B uses -mips32r2 -mfp64, %B uses -msingle-float"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd,
+ "-mips32r2 -mfp64", "-msingle-float");
break;
case 3:
_bfd_error_handler
- (_("Warning: %B uses hard float, %B uses soft float"),
- obfd, ibfd);
+ (_("Warning: %B uses %s (set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd, "-mhard-float", "-msoft-float");
break;
default:
- abort ();
+ _bfd_error_handler
+ (_("Warning: %B uses %s (set by %B), "
+ "%B uses unknown floating point ABI %d"),
+ obfd, abi_fp_bfd, ibfd,
+ "-mips32r2 -mfp64", in_attr[Tag_GNU_MIPS_ABI_FP].i);
+ break;
}
break;
default:
- abort ();
+ switch (in_attr[Tag_GNU_MIPS_ABI_FP].i)
+ {
+ case 1:
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d "
+ "(set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd,
+ out_attr[Tag_GNU_MIPS_ABI_FP].i, "-mdouble-float");
+ break;
+
+ case 2:
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d "
+ "(set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd,
+ out_attr[Tag_GNU_MIPS_ABI_FP].i, "-msingle-float");
+ break;
+
+ case 3:
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d "
+ "(set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd,
+ out_attr[Tag_GNU_MIPS_ABI_FP].i, "-msoft-float");
+ break;
+
+ case 4:
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d "
+ "(set by %B), %B uses %s"),
+ obfd, abi_fp_bfd, ibfd,
+ out_attr[Tag_GNU_MIPS_ABI_FP].i, "-mips32r2 -mfp64");
+ break;
+
+ default:
+ _bfd_error_handler
+ (_("Warning: %B uses unknown floating point ABI %d "
+ "(set by %B), %B uses unknown floating point ABI %d"),
+ obfd, abi_fp_bfd, ibfd,
+ out_attr[Tag_GNU_MIPS_ABI_FP].i,
+ in_attr[Tag_GNU_MIPS_ABI_FP].i);
+ break;
+ }
+ break;
}
}
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index 8cb7e3b..589f1ce 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -23,6 +23,8 @@
#include "elf/internal.h"
#include "elf/mips.h"
+extern bfd_boolean _bfd_mips_elf_mkobject
+ (bfd *);
extern bfd_boolean _bfd_mips_elf_new_section_hook
(bfd *, asection *);
extern void _bfd_mips_elf_symbol_processing