From: Richard Henderson Date: Tue, 27 May 2003 16:00:04 +0000 (+0000) Subject: * symbols.c (temp_label_name): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b7d6ed970a277da806f01110c032f0e19eab2368;p=binutils-gdb.git * symbols.c (temp_label_name): New. (symbol_temp_new, symbol_temp_new_now, symbol_temp_make): New. (symbol_set_value_now): New. * symbols.h: Prototype them. * dwarf2dbg.c: Use them. (fake_label_name, symbol_new_now, set_symbol_value_now): Remove. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index f0bfd1a6c5b..8383b73d958 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2003-05-27 Richard Henderson + + * symbols.c (temp_label_name): New. + (symbol_temp_new, symbol_temp_new_now, symbol_temp_make): New. + (symbol_set_value_now): New. + * symbols.h: Prototype them. + * dwarf2dbg.c: Use them. + (fake_label_name, symbol_new_now, set_symbol_value_now): Remove. + 2003-05-23 Jason Eckhardt * config/tc-i860.c (target_xp): Declare variable. diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index e58f73a25cf..69d4731c9cb 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -157,9 +157,6 @@ static bfd_boolean loc_directive_seen; /* Current location as indicated by the most recent .loc directive. */ static struct dwarf2_line_info current; -/* Fake label name. */ -static char const fake_label_name[] = ".L0\001"; - /* The size of an address on the target. */ static unsigned int sizeof_address; @@ -174,8 +171,6 @@ static void out_two PARAMS ((int)); static void out_four PARAMS ((int)); static void out_abbrev PARAMS ((int, int)); static void out_uleb128 PARAMS ((addressT)); -static symbolS *symbol_new_now PARAMS ((void)); -static void set_symbol_value_now PARAMS ((symbolS *)); static offsetT get_frag_fix PARAMS ((fragS *)); static void out_set_addr PARAMS ((segT, fragS *, addressT)); static int size_inc_line_addr PARAMS ((int, addressT)); @@ -621,25 +616,6 @@ out_abbrev (name, form) out_uleb128 (form); } -/* Create a new fake symbol whose value is the current position. */ - -static symbolS * -symbol_new_now () -{ - return symbol_new (fake_label_name, now_seg, frag_now_fix (), frag_now); -} - -/* Set the value of SYM to the current position in the current segment. */ - -static void -set_symbol_value_now (sym) - symbolS *sym; -{ - S_SET_SEGMENT (sym, now_seg); - S_SET_VALUE (sym, frag_now_fix ()); - symbol_set_frag (sym, frag_now); -} - /* Get the size of a fragment. */ static offsetT @@ -676,7 +652,7 @@ out_set_addr (seg, frag, ofs) expressionS expr; symbolS *sym; - sym = symbol_new (fake_label_name, seg, ofs, frag); + sym = symbol_temp_new (seg, ofs, frag); out_opcode (DW_LNS_extended_op); out_uleb128 (sizeof_address + 1); @@ -894,8 +870,8 @@ relax_inc_line_addr (line_delta, seg, to_frag, to_ofs, from_frag, from_ofs) expressionS expr; int max_chars; - to_sym = symbol_new (fake_label_name, seg, to_ofs, to_frag); - from_sym = symbol_new (fake_label_name, seg, from_ofs, from_frag); + to_sym = symbol_temp_new (seg, to_ofs, to_frag); + from_sym = symbol_temp_new (seg, from_ofs, from_frag); expr.X_op = O_subtract; expr.X_add_symbol = to_sym; @@ -1124,9 +1100,9 @@ out_debug_line (line_seg) subseg_set (line_seg, 0); - line_start = symbol_new_now (); - prologue_end = symbol_make (fake_label_name); - line_end = symbol_make (fake_label_name); + line_start = symbol_temp_new_now (); + prologue_end = symbol_temp_make (); + line_end = symbol_temp_make (); /* Total length of the information for this compilation unit. */ expr.X_op = O_subtract; @@ -1188,13 +1164,13 @@ out_debug_line (line_seg) out_file_list (); - set_symbol_value_now (prologue_end); + symbol_set_value_now (prologue_end); /* For each section, emit a statement program. */ for (s = all_segs; s; s = s->next) process_entries (s->seg, s->head->head); - set_symbol_value_now (line_end); + symbol_set_value_now (line_end); } /* Emit data for .debug_aranges. */ @@ -1250,11 +1226,11 @@ out_debug_aranges (aranges_seg, info_seg) symbolS *beg, *end; frag = first_frag_for_seg (s->seg); - beg = symbol_new (fake_label_name, s->seg, 0, frag); + beg = symbol_temp_new (s->seg, 0, frag); s->text_start = beg; frag = last_frag_for_seg (s->seg); - end = symbol_new (fake_label_name, s->seg, get_frag_fix (frag), frag); + end = symbol_temp_new (s->seg, get_frag_fix (frag), frag); s->text_end = end; expr.X_op = O_symbol; @@ -1322,8 +1298,8 @@ out_debug_info (info_seg, abbrev_seg, line_seg) subseg_set (info_seg, 0); - info_start = symbol_new_now (); - info_end = symbol_make (fake_label_name); + info_start = symbol_temp_new_now (); + info_end = symbol_temp_make (); /* Compilation Unit length. */ expr.X_op = O_subtract; @@ -1421,7 +1397,7 @@ out_debug_info (info_seg, abbrev_seg, line_seg) dwarf2 draft has no standard code for assembler. */ out_two (DW_LANG_Mips_Assembler); - set_symbol_value_now (info_end); + symbol_set_value_now (info_end); } void diff --git a/gas/symbols.c b/gas/symbols.c index 416ff1a8c43..935c6a42bd4 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -588,6 +588,29 @@ symbol_make (name) return (symbolP); } +static const char temp_label_name[] = ".L0\001"; + +symbolS * +symbol_temp_new (seg, ofs, frag) + segT seg; + valueT ofs; + fragS *frag; +{ + return symbol_new (temp_label_name, seg, ofs, frag); +} + +symbolS * +symbol_temp_new_now () +{ + return symbol_temp_new (now_seg, frag_now_fix (), frag_now); +} + +symbolS * +symbol_temp_make () +{ + return symbol_make (temp_label_name); +} + /* Implement symbol table lookup. In: A symbol's name as a string: '\0' can't be part of a symbol name. Out: NULL if the name was not in the symbol table, else the address @@ -2061,6 +2084,17 @@ symbol_set_value_expression (s, exp) s->sy_value = *exp; } +/* Set the value of SYM to the current position in the current segment. */ + +void +symbol_set_value_now (sym) + symbolS *sym; +{ + S_SET_SEGMENT (sym, now_seg); + S_SET_VALUE (sym, frag_now_fix ()); + symbol_set_frag (sym, frag_now); +} + /* Set the frag of a symbol. */ void diff --git a/gas/symbols.h b/gas/symbols.h index d3b9dd3734a..0bc88d8b412 100644 --- a/gas/symbols.h +++ b/gas/symbols.h @@ -59,6 +59,10 @@ symbolS *symbol_create PARAMS ((const char *name, segT segment, valueT value, fragS * frag)); struct local_symbol *local_symbol_make PARAMS ((const char *name, segT section, valueT value, fragS * frag)); +symbolS *symbol_temp_new PARAMS ((segT, valueT, fragS *)); +symbolS *symbol_temp_new_now PARAMS ((void)); +symbolS *symbol_temp_make PARAMS ((void)); + symbolS *colon PARAMS ((const char *sym_name)); void local_colon PARAMS ((int n)); void symbol_begin PARAMS ((void)); @@ -172,6 +176,7 @@ extern symbolS *symbol_next PARAMS ((symbolS *)); extern expressionS *symbol_get_value_expression PARAMS ((symbolS *)); extern void symbol_set_value_expression PARAMS ((symbolS *, const expressionS *)); +extern void symbol_set_value_now PARAMS ((symbolS *)); extern void symbol_set_frag PARAMS ((symbolS *, fragS *)); extern fragS *symbol_get_frag PARAMS ((symbolS *)); extern void symbol_mark_used PARAMS ((symbolS *));