This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Xtensa - put fill action after widen actions
- From: Sterling Augustine <sterling at tensilica dot com>
- To: binutils at sourceware dot org
- Date: Tue, 24 Feb 2009 14:47:19 -0800
- Subject: [PATCH] Xtensa - put fill action after widen actions
On Xtensa, when ld relaxes literal sections which also contain text, it
can erroneously add padding bytes in the middle of the instruction
stream. It does this when there is an instruction to widen at the
location it also wants to pad.
By requiring it to pad, then widen, this patch eliminates the problem.
2009-02-24 Sterling Augustine <sterling@tensilica.com>
* elf32-xtensa.c (text_action_add): Separate test for action
type. Break if saved action is ta_widen_insn at same offset.
Index: elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.112
diff -u -p -d -u -r1.112 elf32-xtensa.c
--- elf32-xtensa.c 18 Sep 2008 00:37:47 -0000 1.112
+++ elf32-xtensa.c 24 Feb 2009 22:37:23 -0000
@@ -5478,12 +5478,20 @@ text_action_add (text_action_list *l,
for (m_p = &l->head; *m_p && (*m_p)->offset <= offset; m_p = &(*m_p)->next)
{
text_action *t = *m_p;
- /* When the action is another fill at the same address,
- just increase the size. */
- if (t->offset == offset && t->action == ta_fill && action == ta_fill)
+
+ if (action == ta_fill)
{
- t->removed_bytes += removed;
- return;
+ /* When the action is another fill at the same address,
+ just increase the size. */
+ if (t->offset == offset && t->action == ta_fill)
+ {
+ t->removed_bytes += removed;
+ return;
+ }
+ /* Fills need to happen before widens so that we don't
+ insert fill bytes into the instruction stream. */
+ if (t->offset == offset && t->action == ta_widen_insn)
+ break;
}
}