aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-12-14 21:49:56 +0000
committerMaciej W. Rozycki <macro@imgtec.com>2016-12-14 22:12:21 +0000
commit5e7fc731f80e0d08385a05ad47dda332a49d9341 (patch)
treef6c5fa7ce09db166b982357e18920de0cb1f070f /bfd
parent8184783a4069e04deb2e43b4ad0d66d80f1ad2df (diff)
downloadfsf-binutils-gdb-5e7fc731f80e0d08385a05ad47dda332a49d9341.zip
fsf-binutils-gdb-5e7fc731f80e0d08385a05ad47dda332a49d9341.tar.gz
fsf-binutils-gdb-5e7fc731f80e0d08385a05ad47dda332a49d9341.tar.bz2
MIPS/opcodes: Also set disassembler's ASE flags from ELF structures
Respect any ASE flags recorded in ELF file structures for the purpose of selecting instructions to be disassembled, preventing code from being hex-dumped even though having been clearly indicated as valid at the assembly time. Use date from the MIPS ABI flags structure if present, and otherwise there may be an MDMX ASE flag set in the ELF file header. For backwards compatibility only set extra flags and do not clear any, preserving all previously set by the architecture selected to be disassembled for. include/ * elf/mips.h (Elf_Internal_ABIFlags_v0): Also declare struct typedef as `elf_internal_abiflags_v0'. bfd/ * bfd-in.h (elf_internal_abiflags_v0): New struct declaration. (bfd_mips_elf_get_abiflags): New prototype. * elfxx-mips.c (bfd_mips_elf_get_abiflags): New function. * bfd-in2.h: Regenerate. opcodes/ * mips-dis.c (mips_convert_abiflags_ases): New function. (set_default_mips_dis_options): Also infer ASE flags from ELF file structures. binutils/ * testsuite/binutils-all/mips/mips-ase-1.d: New test. * testsuite/binutils-all/mips/mips-ase-2.d: New test. * testsuite/binutils-all/mips/mips-ase-3.d: New test. * testsuite/binutils-all/mips/mips-ase-1.s: New test source. * testsuite/binutils-all/mips/mips-ase-2.s: New test source. * testsuite/binutils-all/mips/mips.exp: Run the new tests.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/bfd-in.h4
-rw-r--r--bfd/bfd-in2.h4
-rw-r--r--bfd/elfxx-mips.c10
4 files changed, 25 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 21cbcac..ded152e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2016-12-14 Maciej W. Rozycki <macro@imgtec.com>
+
+ * bfd-in.h (elf_internal_abiflags_v0): New struct declaration.
+ (bfd_mips_elf_get_abiflags): New prototype.
+ * elfxx-mips.c (bfd_mips_elf_get_abiflags): New function.
+ * bfd-in2.h: Regenerate.
+
2016-12-14 Yury Norov <ynorov@caviumnetworks.com>
* bfd/elfnn-aarch64.c: fix TLS relaxations for ilp32 where
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 4b3bcfd..14f55ab 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -1045,3 +1045,7 @@ extern bfd_boolean v850_elf_create_sections
extern bfd_boolean v850_elf_set_note
(bfd *, unsigned int, unsigned int);
+
+/* MIPS ABI flags data access. For the disassembler. */
+struct elf_internal_abiflags_v0;
+extern struct elf_internal_abiflags_v0 *bfd_mips_elf_get_abiflags (bfd *);
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index fdb7878..1c6b70f 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1052,6 +1052,10 @@ extern bfd_boolean v850_elf_create_sections
extern bfd_boolean v850_elf_set_note
(bfd *, unsigned int, unsigned int);
+
+/* MIPS ABI flags data access. For the disassembler. */
+struct elf_internal_abiflags_v0;
+extern struct elf_internal_abiflags_v0 *bfd_mips_elf_get_abiflags (bfd *);
/* Extracted from init.c. */
void bfd_init (void);
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 96317aa..d649676 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -16327,6 +16327,16 @@ _bfd_mips_elf_get_synthetic_symtab (bfd *abfd,
return n;
}
+/* Return the ABI flags associated with ABFD if available. */
+
+Elf_Internal_ABIFlags_v0 *
+bfd_mips_elf_get_abiflags (bfd *abfd)
+{
+ struct mips_elf_obj_tdata *tdata = mips_elf_tdata (abfd);
+
+ return tdata->abiflags_valid ? &tdata->abiflags : NULL;
+}
+
void
_bfd_mips_post_process_headers (bfd *abfd, struct bfd_link_info *link_info)
{