* 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.
This commit is contained in:
Maciej W. Rozycki 2012-12-03 16:17:48 +00:00
parent 20696deded
commit 6ae68ba390
24 changed files with 178 additions and 54 deletions

View File

@ -1,3 +1,15 @@
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

View File

@ -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

View File

@ -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

View File

@ -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. */

View File

@ -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;
}
}

View File

@ -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

View File

@ -1,3 +1,23 @@
2012-12-03 Maciej W. Rozycki <macro@codesourcery.com>
* 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.
2012-12-03 Maciej W. Rozycki <macro@codesourcery.com>
* ld-mips-elf/attr-gnu-4-12.d: Adjust the warning expected

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-1.s
#source: attr-gnu-4-2.s
#ld: -r
#warning: Warning: .* uses -mdouble-float, .* uses -msingle-float
#warning: Warning: .* uses -mdouble-float \(set by .*\), .* uses -msingle-float
#target: mips*-*-*

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-1.s
#source: attr-gnu-4-3.s
#ld: -r
#warning: Warning: .* uses hard float, .* uses soft float
#warning: Warning: .* uses -mhard-float \(set by .*\), .* uses -msoft-float
#target: mips*-*-*

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-1.s
#source: attr-gnu-4-4.s
#ld: -r
#warning: Warning: .* uses -mdouble-float, .* uses -mips32r2 -mfp64
#warning: Warning: .* uses -mdouble-float \(set by .*\), .* uses -mips32r2 -mfp64
#target: mips*-*-*

View File

@ -2,7 +2,7 @@
#source: attr-gnu-4-5.s
#ld: -r
#readelf: -A
#warning: Warning: .* uses unknown floating point ABI 5
#warning: Warning: .* uses -mdouble-float \(set by .*\), .* uses unknown floating point ABI 5
#target: mips*-*-*
Attribute Section: gnu

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-2.s
#source: attr-gnu-4-1.s
#ld: -r
#warning: Warning: .* uses -msingle-float, .* uses -mdouble-float
#warning: Warning: .* uses -msingle-float \(set by .*\), .* uses -mdouble-float
#target: mips*-*-*

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-2.s
#source: attr-gnu-4-3.s
#ld: -r
#warning: Warning: .* uses hard float, .* uses soft float
#warning: Warning: .* uses -mhard-float \(set by .*\), .* uses -msoft-float
#target: mips*-*-*

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-2.s
#source: attr-gnu-4-4.s
#ld: -r
#warning: Warning: .* uses -mips32r2 -mfp64
#warning: Warning: .* uses -msingle-float \(set by .*\), .* uses -mips32r2 -mfp64
#target: mips*-*-*

View File

@ -2,7 +2,7 @@
#source: attr-gnu-4-5.s
#ld: -r
#readelf: -A
#warning: Warning: .* uses unknown floating point ABI 5
#warning: Warning: .* uses -msingle-float \(set by .*\), .* uses unknown floating point ABI 5
#target: mips*-*-*
Attribute Section: gnu

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-3.s
#source: attr-gnu-4-1.s
#ld: -r
#warning: Warning: .* uses soft float, .* uses hard float
#warning: Warning: .* uses -msoft-float \(set by .*\), .* uses -mhard-float
#target: mips*-*-*

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-3.s
#source: attr-gnu-4-2.s
#ld: -r
#warning: Warning: .* uses soft float, .* uses hard float
#warning: Warning: .* uses -msoft-float \(set by .*\), .* uses -mhard-float
#target: mips*-*-*

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-3.s
#source: attr-gnu-4-4.s
#ld: -r
#warning: Warning: .* uses soft float, .* uses hard float
#warning: Warning: .* uses -msoft-float \(set by .*\), .* uses -mhard-float
#target: mips*-*-*

View File

@ -2,7 +2,7 @@
#source: attr-gnu-4-5.s
#ld: -r
#readelf: -A
#warning: Warning: .* uses unknown floating point ABI 5
#warning: Warning: .* uses -msoft-float \(set by .*\), .* uses unknown floating point ABI 5
#target: mips*-*-*
Attribute Section: gnu

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-4.s
#source: attr-gnu-4-1.s
#ld: -r
#warning: Warning: .* uses -mips32r2 -mfp64, .* uses -mdouble-float
#warning: Warning: .* uses -mips32r2 -mfp64 \(set by .*\), .* uses -mdouble-float
#target: mips*-*-*

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-4.s
#source: attr-gnu-4-2.s
#ld: -r
#warning: Warning: .* uses -mips32r2 -mfp64
#warning: Warning: .* uses -mips32r2 -mfp64 \(set by .*\), .* uses -msingle-float
#target: mips*-*-*

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-4.s
#source: attr-gnu-4-3.s
#ld: -r
#warning: Warning: .* uses hard float, .* uses soft float
#warning: Warning: .* uses -mhard-float \(set by .*\), .* uses -msoft-float
#target: mips*-*-*

View File

@ -1,7 +1,7 @@
#source: attr-gnu-4-4.s
#source: attr-gnu-4-5.s
#ld: -r
#warning: Warning: .* uses unknown floating point ABI 5
#warning: Warning: .* uses -mips32r2 -mfp64 \(set by .*\), .* uses unknown floating point ABI 5
#target: mips*-*-*
Attribute Section: gnu

View File

@ -1,5 +1,5 @@
#source: attr-gnu-4-5.s
#source: attr-gnu-4-1.s
#ld: -r
#warning: Warning: .* uses unknown floating point ABI 5
#warning: Warning: .* uses unknown floating point ABI 5 \(set by .*\), .* uses -mdouble-float
#target: mips*-*-*