This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[vms/committed]: simplify gas/config/tc-alpha.c: add_to_link_pool
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils Development <binutils at sourceware dot org>
- Date: Mon, 27 Jun 2011 16:07:55 +0200
- Subject: [vms/committed]: simplify gas/config/tc-alpha.c: add_to_link_pool
Hi,
this patch slightly simplify add_to_link_pool by removing one argument and avoiding the use of literal_pool_size.
To be continued.
Tristan.
gas/
2011-06-27 Tristan Gingold <gingold@adacore.com>
* config/tc-alpha.c (add_to_link_pool): Remove basesym parameter.
Locally declare basesym. Add comments. Do not set literal_pool_size.
(load_expression): Adjust call to add_to_link_pool.
(s_alpha_pdesc): Define pdesc symbol using dot.
Do not set literal_pool_size.
(s_alpha_end): Use NULL instead of 0.
Index: gas/config/tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.91
diff -c -r1.91 tc-alpha.c
*** gas/config/tc-alpha.c 24 Jun 2011 15:16:03 -0000 1.91
--- gas/config/tc-alpha.c 27 Jun 2011 13:57:48 -0000
***************
*** 582,588 ****
static void assemble_tokens (const char *, const expressionS *, int, int);
#ifdef OBJ_EVAX
static char *s_alpha_section_name (void);
! static symbolS *add_to_link_pool (symbolS *, symbolS *, offsetT);
#endif
static struct alpha_reloc_tag *
--- 582,588 ----
static void assemble_tokens (const char *, const expressionS *, int, int);
#ifdef OBJ_EVAX
static char *s_alpha_section_name (void);
! static symbolS *add_to_link_pool (symbolS *, offsetT);
#endif
static struct alpha_reloc_tag *
***************
*** 1448,1455 ****
if (!range_signed_32 (addend))
addend = sign_extend_32 (addend);
! linkexp = add_to_link_pool (alpha_evax_proc->symbol,
! exp->X_add_symbol, 0);
set_tok_reg (newtok[0], targreg);
set_tok_sym (newtok[1], linkexp, 0);
set_tok_preg (newtok[2], basereg);
--- 1448,1454 ----
if (!range_signed_32 (addend))
addend = sign_extend_32 (addend);
! linkexp = add_to_link_pool (exp->X_add_symbol, 0);
set_tok_reg (newtok[0], targreg);
set_tok_sym (newtok[1], linkexp, 0);
set_tok_preg (newtok[2], basereg);
***************
*** 1516,1523 ****
/* For 64-bit addends, just put it in the literal pool. */
#ifdef OBJ_EVAX
/* Emit "ldq targreg, lit(basereg)". */
! litexp = add_to_link_pool (alpha_evax_proc->symbol,
! section_symbol (absolute_section), addend);
set_tok_reg (newtok[0], targreg);
set_tok_sym (newtok[1], litexp, 0);
set_tok_preg (newtok[2], alpha_gp_register);
--- 1515,1521 ----
/* For 64-bit addends, just put it in the literal pool. */
#ifdef OBJ_EVAX
/* Emit "ldq targreg, lit(basereg)". */
! litexp = add_to_link_pool (section_symbol (absolute_section), addend);
set_tok_reg (newtok[0], targreg);
set_tok_sym (newtok[1], litexp, 0);
set_tok_preg (newtok[2], alpha_gp_register);
***************
*** 3373,3387 ****
#ifdef OBJ_EVAX
/* Add sym+addend to link pool.
! Return offset from basesym to entry in link pool.
Add new fixup only if offset isn't 16bit. */
static symbolS *
! add_to_link_pool (symbolS *basesym,
! symbolS *sym,
! offsetT addend)
{
segT current_section = now_seg;
int current_subsec = now_subseg;
char *p;
--- 3371,3384 ----
#ifdef OBJ_EVAX
/* Add sym+addend to link pool.
! Return offset from curent procedure value (pv) to entry in link pool.
Add new fixup only if offset isn't 16bit. */
static symbolS *
! add_to_link_pool (symbolS *sym, offsetT addend)
{
+ symbolS *basesym;
segT current_section = now_seg;
int current_subsec = now_subseg;
char *p;
***************
*** 3390,3395 ****
--- 3387,3394 ----
symbolS *linksym, *expsym;
expressionS e;
+ basesym = alpha_evax_proc->symbol;
+
/* @@ This assumes all entries in a given section will be of the same
size... Probably correct, but unwise to rely on. */
/* This must always be called with the same subsegment. */
***************
*** 3407,3420 ****
return fixp->tc_fix_data.info->sym;
}
! /* Not found in 16bit signed range. */
!
subseg_set (alpha_link_section, 0);
linksym = symbol_new
(FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now);
p = frag_more (8);
memset (p, 0, 8);
e.X_op = O_subtract;
e.X_add_symbol = linksym;
e.X_op_symbol = basesym;
--- 3406,3419 ----
return fixp->tc_fix_data.info->sym;
}
! /* Not found, add a new entry. */
subseg_set (alpha_link_section, 0);
linksym = symbol_new
(FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now);
p = frag_more (8);
memset (p, 0, 8);
+ /* Create the basesym - linksym expression (offset of the added entry). */
e.X_op = O_subtract;
e.X_add_symbol = linksym;
e.X_op_symbol = basesym;
***************
*** 3427,3433 ****
fixp->tc_fix_data.info->sym = expsym;
subseg_set (current_section, current_subsec);
- seginfo->literal_pool_size += 8;
return expsym;
}
#endif /* OBJ_EVAX */
--- 3426,3431 ----
***************
*** 4502,4507 ****
--- 4500,4506 ----
entry_sym = make_expr_symbol (&exp);
entry_sym_name = symbol_get_bfdsym (entry_sym)->name;
+ /* Strip "..en". */
len = strlen (entry_sym_name);
sym_name = (char *) xmalloc (len - 4 + 1);
strncpy (sym_name, entry_sym_name, len - 4);
***************
*** 4517,4526 ****
return;
}
! *symbol_get_obj (alpha_evax_proc->symbol) =
! (valueT) seginfo->literal_pool_size;
!
! alpha_evax_proc->symbol->sy_obj = (valueT)seginfo->literal_pool_size;
/* Save bfd symbol of proc entry in function symbol. */
((struct evax_private_udata_struct *)
--- 4516,4523 ----
return;
}
! /* Define pdesc symbol. */
! define_sym_at_dot (alpha_evax_proc->symbol);
/* Save bfd symbol of proc entry in function symbol. */
((struct evax_private_udata_struct *)
***************
*** 4566,4572 ****
p = frag_more (16);
fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0);
fixp->fx_done = 1;
- seginfo->literal_pool_size += 16;
*p = alpha_evax_proc->pdsckind
| ((alpha_evax_proc->framereg == 29) ? PDSC_S_M_BASE_REG_IS_FP : 0)
--- 4563,4568 ----
***************
*** 4606,4612 ****
p = frag_more (6);
fixp = fix_new (frag_now, p - frag_now->fr_literal, 6, 0, 0, 0, 0);
fixp->fx_done = 1;
- seginfo->literal_pool_size += 6;
/* pdesc+16: Size. */
md_number_to_chars (p, (valueT) alpha_evax_proc->framesize, 4);
--- 4602,4607 ----
***************
*** 4626,4632 ****
p = frag_more (8);
fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0);
fixp->fx_done = 1;
- seginfo->literal_pool_size += 8;
/* pdesc+24: register masks. */
--- 4621,4626 ----
***************
*** 4646,4652 ****
p = frag_more (8);
fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0);
fixp->fx_done = 1;
- seginfo->literal_pool_size += 8;
md_number_to_chars (p, alpha_evax_proc->handler_data, 8);
}
}
--- 4640,4645 ----
***************
*** 4683,4689 ****
frag_align (3, 0, 0);
p = frag_more (8);
- seginfo->literal_pool_size += 8;
fix_new_exp (frag_now, p - frag_now->fr_literal, 8, &exp, 0, BFD_RELOC_64);
}
--- 4676,4681 ----
***************
*** 4822,4828 ****
c = get_symbol_end ();
*input_line_pointer = c;
demand_empty_rest_of_line ();
! alpha_evax_proc = 0;
}
static void
--- 4814,4820 ----
c = get_symbol_end ();
*input_line_pointer = c;
demand_empty_rest_of_line ();
! alpha_evax_proc = NULL;
}
static void