summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-01-04 23:00:24 +0000
committerMaciej W. Rozycki <macro@imgtec.com>2016-01-04 23:00:24 +0000
commit23ba6f1807299311717df4d48b5f68d534ab6c47 (patch)
treebd5b0f8c34364bd741758b64eed2bcee60a2c935 /bfd
parentcf8502c1314287df100e44f81c4e3cf32c198353 (diff)
MIPS/BFD: Suppress attribute checks for null input
We currently special-case the handling of attribute checks on input objects and make them even before we check a given input object actually contains any sections. This does not add value as empty objects do not cause a compatibility concern and we already make this observation for other properties such as ELF file header flags. Moreover the attributes themselves are stored in a `.gnu.attributes' section so the absence of any section (except from a few special cases) implies there have been no attributes provided either. Therefore it is safe to move the attribute checks later on, after the null-section check has been made. bfd/ * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Suppress attribute checks for null input.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfxx-mips.c30
2 files changed, 20 insertions, 15 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7d0fdb87cb..06dc3b3d7e 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): Suppress
+ attribute checks for null input.
+
+2016-01-04 Maciej W. Rozycki <macro@imgtec.com>
+
* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Use local
pointers to target data.
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 39e65d68a0..e502f73c79 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -15056,21 +15056,9 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
return FALSE;
}
- /* Set up the FP ABI attribute from the abiflags if it is not already
- set. */
- if (in_tdata->abiflags_valid)
- {
- obj_attribute *in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
- if (in_attr[Tag_GNU_MIPS_ABI_FP].i == Val_GNU_MIPS_ABI_FP_ANY)
- in_attr[Tag_GNU_MIPS_ABI_FP].i = in_tdata->abiflags.fp_abi;
- }
-
- if (!mips_elf_merge_obj_attributes (ibfd, obfd))
- return FALSE;
-
- /* Check to see if the input BFD actually contains any sections.
- If not, its flags may not have been initialised either, but it cannot
- actually cause any incompatibility. */
+ /* Check to see if the input BFD actually contains any sections. If not,
+ then it has no attributes, and its flags may not have been initialized
+ either, but it cannot actually cause any incompatibility. */
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
{
/* Ignore synthetic sections and empty .text, .data and .bss sections
@@ -15092,6 +15080,18 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
if (null_input_bfd)
return TRUE;
+ /* Set up the FP ABI attribute from the abiflags if it is not already
+ set. */
+ if (in_tdata->abiflags_valid)
+ {
+ obj_attribute *in_attr = elf_known_obj_attributes (ibfd)[OBJ_ATTR_GNU];
+ if (in_attr[Tag_GNU_MIPS_ABI_FP].i == Val_GNU_MIPS_ABI_FP_ANY)
+ in_attr[Tag_GNU_MIPS_ABI_FP].i = in_tdata->abiflags.fp_abi;
+ }
+
+ if (!mips_elf_merge_obj_attributes (ibfd, obfd))
+ return FALSE;
+
/* Populate abiflags using existing information. */
if (!in_tdata->abiflags_valid)
{