diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 9ff418a..5c04b9b 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -5791,11 +5791,19 @@ 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))) - return FALSE; /* Start by SG instruction. */ + bfd_byte * contents; + /* Get cached copy if it exists. */ + if (elf_section_data (section)->this_hdr.contents != NULL) + contents = elf_section_data (section)->this_hdr.contents; + else + { + /* Go get them off disk. */ + if (! bfd_malloc_and_get_section (abfd, section, &contents)) + return FALSE; + } + first_insn = bfd_get_32 (abfd, contents + offset); return first_insn == 0xe97fe97f; }