This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] 2016-09-01 Thomas Preud'homme <thomas dot preudhomme at arm dot com>
- From: Thomas Preud'homme <thopre01 at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 1 Sep 2016 08:37:49 -0000
- Subject: [binutils-gdb] 2016-09-01 Thomas Preud'homme <thomas dot preudhomme at arm dot com>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=424844864aa6f49c616b3bb74a0a5ba9bcb92e72
commit 424844864aa6f49c616b3bb74a0a5ba9bcb92e72
Author: Thomas Preud'homme <thomas.preudhomme@arm.com>
Date: Thu Sep 1 09:35:57 2016 +0100
2016-09-01 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* elf32-arm.c (cmse_entry_fct_p): Store instruction encoding in an
array of bytes and use bfd_get_16 to interpret its encoding according
to endianness of target.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elf32-arm.c | 9 ++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ddbf23b..71ec02f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-09-01 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * elf32-arm.c (cmse_entry_fct_p): Store instruction encoding in an
+ array of bytes and use bfd_get_16 to interpret its encoding according
+ to endianness of target.
+
2016-09-01 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (synthetic_opd): New static var.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 9ff418a..5275cae 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -5775,6 +5775,7 @@ cmse_scan (bfd *input_bfd, struct elf32_arm_link_hash_table *htab,
static bfd_boolean
cmse_entry_fct_p (struct elf32_arm_link_hash_entry *hash)
{
+ bfd_byte contents[4];
uint32_t first_insn;
asection *section;
file_ptr offset;
@@ -5791,11 +5792,13 @@ cmse_entry_fct_p (struct elf32_arm_link_hash_entry *hash)
section = hash->root.root.u.def.section;
abfd = section->owner;
offset = hash->root.root.u.def.value - section->vma;
- if (!bfd_get_section_contents (abfd, section, &first_insn, offset,
- sizeof (first_insn)))
+ if (!bfd_get_section_contents (abfd, section, contents, offset,
+ sizeof (contents)))
return FALSE;
- /* Start by SG instruction. */
+ first_insn = bfd_get_32 (abfd, contents);
+
+ /* Starts by SG instruction. */
return first_insn == 0xe97fe97f;
}