summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-01-04 23:30:00 +0000
committerMaciej W. Rozycki <macro@imgtec.com>2016-01-04 23:30:00 +0000
commitd537eeb527bb80fb791d22a7eedec245856b9d35 (patch)
tree662e3b839feee9b1ef630b85561d129bb493c6de
parent43d223b5430a93dc0d777276471128800b9887cf (diff)
downloadbinutils-gdb-d537eeb527bb80fb791d22a7eedec245856b9d35.tar.gz
MIPS/BFD: Move attribute check after ELF file header flag check
We have a problem in that in making compatibility checks while merging private BFD data on the MIPS target we give priority to the attribute check, which may fail and cause the function to abort early on. The problem with this is the ABI compatibility aspect recorded in the attributes is relatively minor compared to aspects recorded in the ELF file header. However the premature exit causes any more important compatibility aspect violated to be masked and not reported to the user once a problem with attributes has been noticed. So move the attribute check after the ELF file header flag check in `_bfd_mips_elf_merge_private_bfd_data', and do not return prematurely there. Take advantage of the resulting grouping of ELF file header handling together and remove the premature success return point for the first input object being handled, letting the code later on figure out output ABI flags even for this object. Update LD test cases according to messages from ELF file header checks now preceding ones from attribute checks. bfd/ * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Move attribute check after ELF file header flag check. ld/ * testsuite/ld-mips-elf/attr-gnu-4-14.d: Update the order of messages expected according to MIPS BFD private data merge changes. * testsuite/ld-mips-elf/attr-gnu-4-24.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-34.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-41.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-42.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-43.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-45.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-46.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-47.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-48.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-49.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-54.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-64.d: Likewise. * testsuite/ld-mips-elf/attr-gnu-4-74.d: Likewise.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfxx-mips.c12
-rw-r--r--ld/ChangeLog19
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-14.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-24.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-34.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-41.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-42.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-43.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-45.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-46.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-47.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-48.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-49.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-54.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-64.d4
-rw-r--r--ld/testsuite/ld-mips-elf/attr-gnu-4-74.d4
17 files changed, 59 insertions, 33 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 85b56a3b624..5a2c3bdb098 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2016-01-04 Maciej W. Rozycki <macro@imgtec.com>
+ * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Move
+ attribute check after ELF file header flag check.
+
+2016-01-04 Maciej W. Rozycki <macro@imgtec.com>
+
* elfxx-mips.c (mips_elf_merge_obj_attributes): Propagate the
return status from `_bfd_elf_merge_object_attributes'.
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index a5d47d69e1e..63c7d7ed5b2 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -15220,6 +15220,7 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
bfd_boolean null_input_bfd = TRUE;
asection *sec;
obj_attribute *out_attr;
+ bfd_boolean ok;
/* Check if we have the same endianness. */
if (! _bfd_generic_verify_endian_match (ibfd, obfd))
@@ -15321,9 +15322,6 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
in_tdata->abiflags_valid = TRUE;
}
- if (!mips_elf_merge_obj_attributes (ibfd, obfd))
- return FALSE;
-
if (!out_tdata->abiflags_valid)
{
/* Copy input abiflags if output abiflags are not already valid. */
@@ -15351,8 +15349,12 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
update_mips_abiflags_isa (obfd, &out_tdata->abiflags);
}
- return TRUE;
+ ok = TRUE;
}
+ else
+ ok = mips_elf_merge_obj_e_flags (ibfd, obfd);
+
+ ok = mips_elf_merge_obj_attributes (ibfd, obfd) && ok;
/* Update the output abiflags fp_abi using the computed fp_abi. */
out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
@@ -15374,7 +15376,7 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
out_tdata->abiflags.ases |= in_tdata->abiflags.ases;
out_tdata->abiflags.flags1 |= in_tdata->abiflags.flags1;
- if (!mips_elf_merge_obj_e_flags (ibfd, obfd))
+ if (!ok)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 64eeded5f67..8a062e1f97c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,22 @@
+2016-01-04 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/ld-mips-elf/attr-gnu-4-14.d: Update the order of
+ messages expected according to MIPS BFD private data merge
+ changes.
+ * testsuite/ld-mips-elf/attr-gnu-4-24.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-34.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-41.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-42.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-43.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-45.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-46.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-47.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-48.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-49.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-54.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-64.d: Likewise.
+ * testsuite/ld-mips-elf/attr-gnu-4-74.d: Likewise.
+
2016-01-01 Alan Modra <amodra@gmail.com>
Update year range in copyright notice of all files.
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-14.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-14.d
index 58cfd245b47..417ad0a9f50 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-14.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-14.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-1.s
#source: attr-gnu-4-4.s -W
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mdouble-float \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
-#error: [^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: [^\n]*: Warning: .* uses -mdouble-float \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-24.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-24.d
index e48e5bbfad4..608ef0e05f3 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-24.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-24.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-2.s
#source: attr-gnu-4-4.s -W
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -msingle-float \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
-#error: [^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: [^\n]*: Warning: .* uses -msingle-float \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-34.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-34.d
index 314515ab9e7..f8328b51e86 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-34.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-34.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-3.s
#source: attr-gnu-4-4.s -W
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -msoft-float \(set by .*\), .* uses -mhard-float\n
-#error: [^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: [^\n]*: Warning: .* uses -msoft-float \(set by .*\), .* uses -mhard-float\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-41.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-41.d
index 7c61365ad02..ff6e6e4635f 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-41.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-41.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-4.s -W
#source: attr-gnu-4-1.s
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mdouble-float\n
-#error: [^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: [^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mdouble-float\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-42.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-42.d
index dad0421a0e8..aa17693832b 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-42.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-42.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-4.s -W
#source: attr-gnu-4-2.s
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -msingle-float\n
-#error: [^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: [^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -msingle-float\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-43.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-43.d
index f30c18eeb3f..ddc01996fdb 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-43.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-43.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-4.s -W
#source: attr-gnu-4-3.s
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mhard-float \(set by .*\), .* uses -msoft-float\n
-#error: [^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: [^\n]*: Warning: .* uses -mhard-float \(set by .*\), .* uses -msoft-float\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-45.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-45.d
index c8716e3b436..b60b9837df2 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-45.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-45.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-4.s -W -mips32r2
#source: attr-gnu-4-5.s
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mfpxx\n
-#error: [^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: [^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mfpxx\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-46.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-46.d
index 9fa1b015419..82dd22b4a3d 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-46.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-46.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-4.s -W -mips32r2
#source: attr-gnu-4-6.s
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mgp32 -mfp64\n
-#error: [^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: [^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mgp32 -mfp64\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-47.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-47.d
index acb736b5670..eda8a27f11f 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-47.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-47.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-4.s -W -mips32r2
#source: attr-gnu-4-7.s
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mgp32 -mfp64 -mno-odd-spreg\n
-#error: [^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: [^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mgp32 -mfp64 -mno-odd-spreg\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-48.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-48.d
index cb4dcb6dd69..084922b61f2 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-48.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-48.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-4.s -W
#source: attr-gnu-4-8.s -W
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses unknown floating point ABI 8\n
-#error: [^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: [^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses unknown floating point ABI 8\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-49.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-49.d
index d03074e0245..24e51453d22 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-49.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-49.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-4.s -W
#source: attr-gnu-4-9.s -W
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses unknown floating point ABI 9\n
-#error: [^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
+#error: [^\n]*: Warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses unknown floating point ABI 9\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-54.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-54.d
index 04155af87cb..70d6b946da5 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-54.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-54.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-5.s
#source: attr-gnu-4-4.s -W -mips32r2
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mfpxx \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
-#error: [^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: [^\n]*: Warning: .* uses -mfpxx \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-64.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-64.d
index 98a3b34bb55..9b4fbd86bdc 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-64.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-64.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-6.s
#source: attr-gnu-4-4.s -W -mips32r2
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mgp32 -mfp64 \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
-#error: [^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: [^\n]*: Warning: .* uses -mgp32 -mfp64 \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-74.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-74.d
index 90eeaff1a9e..e281ae5ce38 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-74.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-74.d
@@ -1,6 +1,6 @@
#source: attr-gnu-4-7.s
#source: attr-gnu-4-4.s -W -mips32r2
#ld: -r
-#error: \A[^\n]*: Warning: .* uses -mgp32 -mfp64 -mno-odd-spreg \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
-#error: [^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: \A[^\n]*: [^\n]* linking -mfp64 module with previous -mfp32 modules\n
+#error: [^\n]*: Warning: .* uses -mgp32 -mfp64 -mno-odd-spreg \(set by .*\), .* uses -mips32r2 -mfp64 \(12 callee-saved\)\n
#error: [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z