aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-01-04 23:32:34 +0000
committerMaciej W. Rozycki <macro@imgtec.com>2016-01-04 23:32:34 +0000
commita3dc0a7f65bd4cfcfad6afee8b11657972e5a8de (patch)
tree01bf04ca1a110327086bea5d4d671e69b50953ac /bfd
parentd537eeb527bb80fb791d22a7eedec245856b9d35 (diff)
downloadgdb-a3dc0a7f65bd4cfcfad6afee8b11657972e5a8de.zip
gdb-a3dc0a7f65bd4cfcfad6afee8b11657972e5a8de.tar.gz
gdb-a3dc0a7f65bd4cfcfad6afee8b11657972e5a8de.tar.bz2
MIPS/BFD: Factor out ABI flag merging
Factor out the parts of `_bfd_mips_elf_merge_private_bfd_data' responsible for ABI flag merging to `mips_elf_merge_obj_abiflags'. No functional change. bfd/ * elfxx-mips.c (mips_elf_merge_obj_abiflags): New function, factored out from... (_bfd_mips_elf_merge_private_bfd_data): ... here.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elfxx-mips.c53
2 files changed, 39 insertions, 20 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5a2c3bd..974b5ab 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2016-01-04 Maciej W. Rozycki <macro@imgtec.com>
+ * elfxx-mips.c (mips_elf_merge_obj_abiflags): New function,
+ factored out from...
+ (_bfd_mips_elf_merge_private_bfd_data): ... here.
+
+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.
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 63c7d7e..4ece819 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -15209,6 +15209,38 @@ mips_elf_merge_obj_attributes (bfd *ibfd, bfd *obfd)
return _bfd_elf_merge_object_attributes (ibfd, obfd);
}
+/* Merge object ABI flags from IBFD into OBFD. Raise an error if
+ there are conflicting settings. */
+
+static bfd_boolean
+mips_elf_merge_obj_abiflags (bfd *ibfd, bfd *obfd)
+{
+ obj_attribute *out_attr = elf_known_obj_attributes (obfd)[OBJ_ATTR_GNU];
+ struct mips_elf_obj_tdata *out_tdata = mips_elf_tdata (obfd);
+ struct mips_elf_obj_tdata *in_tdata = mips_elf_tdata (ibfd);
+
+ /* Update the output abiflags fp_abi using the computed fp_abi. */
+ out_tdata->abiflags.fp_abi = out_attr[Tag_GNU_MIPS_ABI_FP].i;
+
+#define max(a, b) ((a) > (b) ? (a) : (b))
+ /* Merge abiflags. */
+ out_tdata->abiflags.isa_level = max (out_tdata->abiflags.isa_level,
+ in_tdata->abiflags.isa_level);
+ out_tdata->abiflags.isa_rev = max (out_tdata->abiflags.isa_rev,
+ in_tdata->abiflags.isa_rev);
+ out_tdata->abiflags.gpr_size = max (out_tdata->abiflags.gpr_size,
+ in_tdata->abiflags.gpr_size);
+ out_tdata->abiflags.cpr1_size = max (out_tdata->abiflags.cpr1_size,
+ in_tdata->abiflags.cpr1_size);
+ out_tdata->abiflags.cpr2_size = max (out_tdata->abiflags.cpr2_size,
+ in_tdata->abiflags.cpr2_size);
+#undef max
+ out_tdata->abiflags.ases |= in_tdata->abiflags.ases;
+ out_tdata->abiflags.flags1 |= in_tdata->abiflags.flags1;
+
+ return TRUE;
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -15219,7 +15251,6 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
struct mips_elf_obj_tdata *in_tdata;
bfd_boolean null_input_bfd = TRUE;
asection *sec;
- obj_attribute *out_attr;
bfd_boolean ok;
/* Check if we have the same endianness. */
@@ -15356,25 +15387,7 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *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];
- out_tdata->abiflags.fp_abi = out_attr[Tag_GNU_MIPS_ABI_FP].i;
-
-#define max(a,b) ((a) > (b) ? (a) : (b))
- /* Merge abiflags. */
- out_tdata->abiflags.isa_level = max (out_tdata->abiflags.isa_level,
- in_tdata->abiflags.isa_level);
- out_tdata->abiflags.isa_rev = max (out_tdata->abiflags.isa_rev,
- in_tdata->abiflags.isa_rev);
- out_tdata->abiflags.gpr_size = max (out_tdata->abiflags.gpr_size,
- in_tdata->abiflags.gpr_size);
- out_tdata->abiflags.cpr1_size = max (out_tdata->abiflags.cpr1_size,
- in_tdata->abiflags.cpr1_size);
- out_tdata->abiflags.cpr2_size = max (out_tdata->abiflags.cpr2_size,
- in_tdata->abiflags.cpr2_size);
-#undef max
- out_tdata->abiflags.ases |= in_tdata->abiflags.ases;
- out_tdata->abiflags.flags1 |= in_tdata->abiflags.flags1;
+ ok = mips_elf_merge_obj_abiflags (ibfd, obfd) && ok;
if (!ok)
{