This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 3/8] gas: xtensa: reuse find_trampoline_seg
- From: Max Filippov <jcmvbkbc at gmail dot com>
- To: binutils at sourceware dot org
- Cc: Sterling Augustine <augustine dot sterling at gmail dot com>, linux-xtensa at linux-xtensa dot org, Max Filippov <jcmvbkbc at gmail dot com>
- Date: Mon, 27 Nov 2017 11:39:29 -0800
- Subject: [PATCH 3/8] gas: xtensa: reuse find_trampoline_seg
- Authentication-results: sourceware.org; auth=none
- References: <1511811574-11128-1-git-send-email-jcmvbkbc@gmail.com>
xtensa_create_trampoline_frag has opencoded fragment equivalent to
find_trampoline_seg. Drop the fragment and use find_trampoline_seg
instead. No functional changes.
gas/
2017-11-20 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.
---
gas/config/tc-xtensa.c | 38 ++++++++++++++++----------------------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index d407454f343b..1d51a2cefc3b 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -7431,6 +7431,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)
{
@@ -7440,18 +7455,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);
@@ -7479,21 +7488,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
--
2.1.4