aboutsummaryrefslogtreecommitdiff
path: root/gas/symbols.c
diff options
context:
space:
mode:
authorChristian Eggers <ceggers@gmx.de>2019-03-10 19:21:53 +0100
committerAlan Modra <amodra@gmail.com>2019-03-13 13:29:28 +1030
commitd18d199917337537713f9fc4b7ae4d6568f740cf (patch)
treeaef953bb061dd985c773dde8b35c41cccc74916d /gas/symbols.c
parent71250b94dc669b285cddcb744a7b3d1c7e2ec94b (diff)
downloadgdb-d18d199917337537713f9fc4b7ae4d6568f740cf.zip
gdb-d18d199917337537713f9fc4b7ae4d6568f740cf.tar.gz
gdb-d18d199917337537713f9fc4b7ae4d6568f740cf.tar.bz2
Symbols with octets value
Up to now, all symbol values are in units of bytes, where a "byte" can consist of one or more octets (e.g. 8 bit or 16 bit). Allow to specfiy that the "unit" of a newly created symbol is octets (exactly 8 bit), instead of bytes. * symbols.h (symbol_temp_new_now_octets): Declare. (symbol_set_value_now_octets, symbol_octets_p): Declare. * symbols.c (struct symbol_flags): New member sy_octets. (symbol_temp_new_now_octets): New function. (resolve_symbol_value): Return octets instead of bytes if sy_octets is set. (symbol_set_value_now_octets): New function. (symbol_octets_p): New function.
Diffstat (limited to 'gas/symbols.c')
-rw-r--r--gas/symbols.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/gas/symbols.c b/gas/symbols.c
index b12ab74..d8a9c92 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -73,6 +73,10 @@ struct symbol_flags
before. It is cleared as soon as any direct reference to the
symbol is present. */
unsigned int sy_weakrefd : 1;
+
+ /* This if set if the unit of the symbol value is "octets" instead
+ of "bytes". */
+ unsigned int sy_octets : 1;
};
/* The information we keep for a symbol. Note that the symbol table
@@ -844,6 +848,14 @@ symbol_temp_new_now (void)
}
symbolS *
+symbol_temp_new_now_octets (void)
+{
+ symbolS * symb = symbol_temp_new (now_seg, frag_now_fix_octets (), frag_now);
+ symb->sy_flags.sy_octets = 1;
+ return symb;
+}
+
+symbolS *
symbol_temp_make (void)
{
return symbol_make (FAKE_LABEL_NAME);
@@ -1324,7 +1336,10 @@ resolve_symbol_value (symbolS *symp)
/* Fall through. */
case O_constant:
- final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE;
+ if (symp->sy_flags.sy_octets)
+ final_val += symp->sy_frag->fr_address;
+ else
+ final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE;
if (final_seg == expr_section)
final_seg = absolute_section;
/* Fall through. */
@@ -2650,6 +2665,18 @@ symbol_set_value_now (symbolS *sym)
symbol_set_frag (sym, frag_now);
}
+/* Set the value of SYM to the current position in the current segment,
+ in octets. */
+
+void
+symbol_set_value_now_octets (symbolS *sym)
+{
+ S_SET_SEGMENT (sym, now_seg);
+ S_SET_VALUE (sym, frag_now_fix_octets ());
+ symbol_set_frag (sym, frag_now);
+ sym->sy_flags.sy_octets = 1;
+}
+
/* Set the frag of a symbol. */
void
@@ -2921,6 +2948,13 @@ symbol_set_bfdsym (symbolS *s, asymbol *bsym)
/* else XXX - What do we do now ? */
}
+/* Return whether symbol unit is "octets" (instead of "bytes"). */
+
+int symbol_octets_p (symbolS *s)
+{
+ return s->sy_flags.sy_octets;
+}
+
#ifdef OBJ_SYMFIELD_TYPE
/* Get a pointer to the object format information for a symbol. */