This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[vms/committed]: improve comments in gas
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils <binutils at sourceware dot org>
- Date: Mon, 31 May 2010 17:52:42 +0200
- Subject: [vms/committed]: improve comments in gas
Hi,
this patch adds some comments to EVAX specific part of gas, in the hope it will be easier to read the code.
Tristan.
gas/
2010-05-31 Tristan Gingold <gingold@adacore.com>
* config/tc-alpha.c: Add comments for evax.
* config/obj-evax.c: Ditto.
Index: gas/config/obj-evax.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-evax.c,v
retrieving revision 1.7
diff -c -r1.7 obj-evax.c
*** gas/config/obj-evax.c 2 Sep 2009 07:24:20 -0000 1.7
--- gas/config/obj-evax.c 31 May 2010 15:42:14 -0000
***************
*** 145,150 ****
--- 145,151 ----
subseg_set (alpha_link_section, 0);
seginfo = seg_info (alpha_link_section);
+ /* Handle .linkage fixups. */
for (l = alpha_linkage_fixup_root; l != NULL; l = l->next)
{
if (S_GET_SEGMENT (l->fixp->fx_addsy) == alpha_link_section)
Index: gas/config/tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.85
diff -c -r1.85 tc-alpha.c
*** gas/config/tc-alpha.c 14 Apr 2010 09:25:34 -0000 1.85
--- gas/config/tc-alpha.c 31 May 2010 15:42:15 -0000
***************
*** 86,92 ****
/* bfd_reloc_code_real_type reloc; */
extended_bfd_reloc_code_real_type reloc;
#ifdef OBJ_EVAX
! symbolS *xtrasym, *procsym;
#endif
};
--- 86,96 ----
/* bfd_reloc_code_real_type reloc; */
extended_bfd_reloc_code_real_type reloc;
#ifdef OBJ_EVAX
! /* The symbol of the item in the linkage section. */
! symbolS *xtrasym;
!
! /* The symbol of the procedure descriptor. */
! symbolS *procsym;
#endif
};
***************
*** 419,427 ****
--- 423,433 ----
int handler_data;
};
+ /* Linked list of .linkage fixups. */
struct alpha_linkage_fixups *alpha_linkage_fixup_root;
static struct alpha_linkage_fixups *alpha_linkage_fixup_tail;
+ /* Current procedure descriptor. */
static struct alpha_evax_procs *alpha_evax_proc;
static int alpha_flag_hash_long_names = 0; /* -+ */
***************
*** 495,502 ****
{
fixS *master; /* The literal reloc. */
#ifdef OBJ_EVAX
! struct symbol *sym;
! struct symbol *psym;
#endif
fixS *slaves; /* Head of linked list of lituses. */
segT segment; /* Segment relocs are in or undefined_section. */
--- 501,508 ----
{
fixS *master; /* The literal reloc. */
#ifdef OBJ_EVAX
! struct symbol *sym; /* Linkage section item symbol. */
! struct symbol *psym; /* Pdesc symbol. */
#endif
fixS *slaves; /* Head of linked list of lituses. */
segT segment; /* Segment relocs are in or undefined_section. */
***************
*** 1333,1353 ****
if (exp->X_add_symbol == alpha_evax_proc->symbol)
{
if (range_signed_16 (addend))
{
- set_tok_reg (newtok[0], targreg);
set_tok_const (newtok[1], addend);
- set_tok_preg (newtok[2], basereg);
- assemble_tokens_to_insn ("lda", newtok, 3, &insn);
addend = 0;
}
else
{
- set_tok_reg (newtok[0], targreg);
set_tok_const (newtok[1], 0);
- set_tok_preg (newtok[2], basereg);
- assemble_tokens_to_insn ("lda", newtok, 3, &insn);
}
}
else
{
--- 1339,1358 ----
if (exp->X_add_symbol == alpha_evax_proc->symbol)
{
+ /* Linkage-relative expression. */
+ set_tok_reg (newtok[0], targreg);
+
if (range_signed_16 (addend))
{
set_tok_const (newtok[1], addend);
addend = 0;
}
else
{
set_tok_const (newtok[1], 0);
}
+ set_tok_preg (newtok[2], basereg);
+ assemble_tokens_to_insn ("lda", newtok, 3, &insn);
}
else
{
***************
*** 1358,1363 ****
--- 1363,1370 ----
if ((symlen > 4 &&
strcmp (ptr2 = &symname [symlen - 4], "..lk") == 0))
{
+ /* Access to an item whose address is stored in the linkage
+ section. Just read the address. */
set_tok_reg (newtok[0], targreg);
newtok[1] = *exp;
***************
*** 1373,1382 ****
--- 1380,1391 ----
if (alpha_flag_replace && targreg == 26)
{
+ /* Add a NOP fixup for 'ldX $26,YYY..NAME..lk'. */
char *ensymname;
symbolS *ensym;
volatile asymbol *dummy;
+ /* Build the entry name as 'NAME..en'. */
ptr1 = strstr (symname, "..") + 2;
if (ptr1 > ptr2)
ptr1 = symname;
***************
*** 1404,1418 ****
--- 1413,1430 ----
}
else if (alpha_flag_replace && targreg == 27)
{
+ /* Add a lda fixup for 'ldX $27,YYY.NAME..lk+8'. */
char *psymname;
symbolS *psym;
+ /* Extract NAME. */
ptr1 = strstr (symname, "..") + 2;
if (ptr1 > ptr2)
ptr1 = symname;
psymname = (char *) xmalloc (ptr2 - ptr1 + 1);
memcpy (psymname, ptr1, ptr2 - ptr1);
psymname [ptr2 - ptr1] = 0;
+
gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS);
insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_LDA;
psym = symbol_find_or_make (psymname);
***************
*** 1426,1436 ****
insn.nfixups++;
}
! emit_insn(&insn);
return 0;
}
else
{
symbolS *linkexp;
if (!range_signed_32 (addend))
--- 1438,1450 ----
insn.nfixups++;
}
! emit_insn (&insn);
return 0;
}
else
{
+ /* Not in the linkage section. Put the value into the linkage
+ section. */
symbolS *linkexp;
if (!range_signed_32 (addend))
***************
*** 2868,2877 ****
--- 2882,2893 ----
&& tok[tokidx].X_add_symbol
&& alpha_linkage_symbol)
{
+ /* Create a BOH reloc for 'jsr $27,NAME'. */
const char *symname = S_GET_NAME (tok[tokidx].X_add_symbol);
int symlen = strlen (symname);
char *ensymname;
+ /* Build the entry name as 'NAME..en'. */
ensymname = (char *) xmalloc (symlen + 5);
memcpy (ensymname, symname, symlen);
memcpy (ensymname + symlen, "..en", 5);
***************
*** 4457,4462 ****
--- 4473,4480 ----
alpha_evax_proc->rsa_offset = get_absolute_expression ();
}
+ /* Parse .prologue. */
+
static void
s_alpha_prologue (int ignore ATTRIBUTE_UNUSED)
{
***************
*** 4468,4473 ****
--- 4486,4494 ----
(FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now);
}
+ /* Parse .pdesc <entry_name>.
+ Insert a procedure descriptor. */
+
static void
s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED)
{
***************
*** 4686,4691 ****
--- 4707,4715 ----
fix_new_exp (frag_now, p - frag_now->fr_literal, 8, &exp, 0, BFD_RELOC_64);
}
+ /* Parse .linkage <symbol>.
+ Create a linkage pair relocation. */
+
static void
s_alpha_linkage (int ignore ATTRIBUTE_UNUSED)
{
***************
*** 4738,4743 ****
--- 4762,4770 ----
demand_empty_rest_of_line ();
}
+ /* Parse .code_address <symbol>.
+ Create a code address relocation. */
+
static void
s_alpha_code_address (int ignore ATTRIBUTE_UNUSED)
{
***************
*** 6281,6286 ****
--- 6308,6314 ----
int pname_len;
case BFD_RELOC_ALPHA_LINKAGE:
+ /* Copy the linkage index. */
reloc->addend = fixp->fx_addnumber;
break;