aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-xtensa.c
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@acm.org>2007-03-01 23:38:03 +0000
committerBob Wilson <bob.wilson@acm.org>2007-03-01 23:38:03 +0000
commit25c6282a07f8bb0c743667757a570cdb36813a35 (patch)
tree35827bf7d2b9a8e629c66de0fc09d56d78136310 /bfd/elf32-xtensa.c
parent558e5d2178a2fb5a5d6ca3f20f171152e593c43f (diff)
downloadgdb-25c6282a07f8bb0c743667757a570cdb36813a35.zip
gdb-25c6282a07f8bb0c743667757a570cdb36813a35.tar.gz
gdb-25c6282a07f8bb0c743667757a570cdb36813a35.tar.bz2
* elf32-xtensa.c (analyze_relocations): Zero src_count if not relaxing.
(find_relaxable_sections): Do not increment src_count for unknown opcodes. Decode only once instead of calling is_l32r_relocation. (compute_text_actions): Remove unused no_insn_move flag. Assert that src_next matches src_count in relax_info.
Diffstat (limited to 'bfd/elf32-xtensa.c')
-rw-r--r--bfd/elf32-xtensa.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index cfc8520..8bf855d 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -5913,6 +5913,8 @@ analyze_relocations (struct bfd_link_info *link_info)
relax_info->src_relocs = (source_reloc *)
bfd_malloc (relax_info->src_count * sizeof (source_reloc));
}
+ else
+ relax_info->src_count = 0;
}
/* Collect info on relocations against each relaxable section. */
@@ -5956,6 +5958,7 @@ find_relaxable_sections (bfd *abfd,
bfd_boolean ok = TRUE;
unsigned i;
xtensa_relax_info *source_relax_info;
+ bfd_boolean is_l32r_reloc;
internal_relocs = retrieve_internal_relocs (abfd, sec,
link_info->keep_memory);
@@ -6006,13 +6009,21 @@ find_relaxable_sections (bfd *abfd,
/* Count PC-relative operand relocations against the target section.
Note: The conditions tested here must match the conditions under
which init_source_reloc is called in collect_source_relocs(). */
- if (is_operand_relocation (ELF32_R_TYPE (irel->r_info))
- && (!is_alt_relocation (ELF32_R_TYPE (irel->r_info))
- || is_l32r_relocation (abfd, sec, contents, irel)))
- target_relax_info->src_count++;
+ is_l32r_reloc = FALSE;
+ if (is_operand_relocation (ELF32_R_TYPE (irel->r_info)))
+ {
+ xtensa_opcode opcode =
+ get_relocation_opcode (abfd, sec, contents, irel);
+ if (opcode != XTENSA_UNDEFINED)
+ {
+ is_l32r_reloc = (opcode == get_l32r_opcode ());
+ if (!is_alt_relocation (ELF32_R_TYPE (irel->r_info))
+ || is_l32r_reloc)
+ target_relax_info->src_count++;
+ }
+ }
- if (is_l32r_relocation (abfd, sec, contents, irel)
- && r_reloc_is_defined (&r_rel))
+ if (is_l32r_reloc && r_reloc_is_defined (&r_rel))
{
/* Mark the target section as relaxable. */
target_relax_info->is_relaxable_literal_section = TRUE;
@@ -6333,14 +6344,12 @@ compute_text_actions (bfd *abfd,
property_table_entry *prop_table = 0;
int ptblsize = 0;
bfd_size_type sec_size;
- static bfd_boolean no_insn_move = FALSE;
- if (no_insn_move)
- return ok;
-
- /* Do nothing if the section contains no optimized longcalls. */
relax_info = get_xtensa_relax_info (sec);
BFD_ASSERT (relax_info);
+ BFD_ASSERT (relax_info->src_next == relax_info->src_count);
+
+ /* Do nothing if the section contains no optimized longcalls. */
if (!relax_info->is_relaxable_asm_section)
return ok;