+2017-11-27 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/tc-xtensa.c (find_trampoline_seg): Move above the first
+ use.
+ (xtensa_create_trampoline_frag): Replace trampoline seg search
+ code with a call to find_trampoline_seg.
+
2017-11-27 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (xg_append_jump): New function.
#define TRAMPOLINE_FRAG_SIZE 3000
+static struct trampoline_seg *
+find_trampoline_seg (asection *seg)
+{
+ struct trampoline_seg *ts = trampoline_seg_list.next;
+
+ for ( ; ts; ts = ts->next)
+ {
+ if (ts->seg == seg)
+ return ts;
+ }
+
+ return NULL;
+}
+
+
static void
xtensa_create_trampoline_frag (bfd_boolean needs_jump_around)
{
We allocate enough for 1000 trampolines in each frag.
If that's not enough, oh well. */
- struct trampoline_seg *ts = trampoline_seg_list.next;
+ struct trampoline_seg *ts = find_trampoline_seg (now_seg);
struct trampoline_frag *tf;
char *varP;
fragS *fragP;
int size = TRAMPOLINE_FRAG_SIZE;
- for ( ; ts; ts = ts->next)
- {
- if (ts->seg == now_seg)
- break;
- }
-
if (ts == NULL)
{
ts = XCNEW(struct trampoline_seg);
}
-static struct trampoline_seg *
-find_trampoline_seg (asection *seg)
-{
- struct trampoline_seg *ts = trampoline_seg_list.next;
-
- for ( ; ts; ts = ts->next)
- {
- if (ts->seg == seg)
- return ts;
- }
-
- return NULL;
-}
-
-
void dump_trampolines (void);
void