]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gas/config/tc-xtensa.c
gas: xtensa: reuse find_trampoline_seg
[thirdparty/binutils-gdb.git] / gas / config / tc-xtensa.c
index eccf3c310087b110e0c17fac1d00dfa8a41c0902..a8ed49b56d9785f5f2eb85a4af6e8a38bfea97a3 100644 (file)
@@ -7421,6 +7421,21 @@ static xtensa_insnbuf litpool_slotbuf = NULL;
 
 #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)
 {
@@ -7430,18 +7445,12 @@ 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);
@@ -7469,21 +7478,6 @@ xtensa_create_trampoline_frag (bfd_boolean needs_jump_around)
 }
 
 
-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