* struc-symbol.h: Put local_symbol code in ifdef BFD_ASSEMBLER.

* symbols.c: Likewise.
	* config/obj-aout.c (obj_crawl_symbol_chain): Refer directly to
	sy_next field when taking address, rather than symbol_next.
This commit is contained in:
Ian Lance Taylor
1999-06-11 21:07:46 +00:00
parent ae69440806
commit a1605869fb
4 changed files with 51 additions and 6 deletions

View File

@ -1,3 +1,20 @@
1999-06-12 Ian Lance Taylor <ian@zembu.com>
* config/tc-i386.c (i386_immediate): Remove unused label
seg_unimplemented.
* struc-symbol.h: Put local_symbol code in ifdef BFD_ASSEMBLER.
* symbols.c: Likewise.
* config/obj-aout.c (obj_crawl_symbol_chain): Refer directly to
sy_next field when taking address, rather than symbol_next.
* dwarf2dbg.c: Change bfd_vma to addressT and bfd_signed_vma to
offsetT.
(out_set_addr): Don't use BYTES_PER_ADDRESS. Instead, get the
value from the output file architecture.
(dwarf2_gen_line_info): Ifdef BFD_ASSEMBLER specific code.
* dwarf2dbg.h: Change bfd_vma to addressT.
1999-06-11 Ian Lance Taylor <ian@zembu.com> 1999-06-11 Ian Lance Taylor <ian@zembu.com>
* dwarf2dbg.h: Use PARAMS in function declarations. * dwarf2dbg.h: Use PARAMS in function declarations.

View File

@ -512,7 +512,7 @@ obj_crawl_symbol_chain (headers)
} }
else /* .Stabd case. */ else /* .Stabd case. */
symbolP->sy_name_offset = 0; symbolP->sy_name_offset = 0;
symbolPP = &(symbol_next (symbolP)); symbolPP = &symbolP->sy_next;
} }
else else
{ {

View File

@ -90,6 +90,8 @@ struct symbol
#endif #endif
}; };
#ifdef BFD_ASSEMBLER
/* A pointer in the symbol may point to either a complete symbol /* A pointer in the symbol may point to either a complete symbol
(struct symbol above) or to a local symbol (struct local_symbol (struct symbol above) or to a local symbol (struct local_symbol
defined here). The symbol code can detect the case by examining defined here). The symbol code can detect the case by examining
@ -137,6 +139,8 @@ struct local_symbol
#define local_symbol_get_real_symbol(l) ((l)->u.lsy_sym) #define local_symbol_get_real_symbol(l) ((l)->u.lsy_sym)
#define local_symbol_set_real_symbol(l, s) ((l)->u.lsy_sym = (s)) #define local_symbol_set_real_symbol(l, s) ((l)->u.lsy_sym = (s))
#endif /* BFD_ASSEMBLER */
#endif /* __struc_symbol_h__ */ #endif /* __struc_symbol_h__ */
/* end of struc-symbol.h */ /* end of struc-symbol.h */

View File

@ -354,6 +354,7 @@ colon (sym_name) /* just seen "x:" - rattle symbols & frags */
*/ */
if (LOCAL_SYMBOL_CHECK (symbolP)) if (LOCAL_SYMBOL_CHECK (symbolP))
{ {
#ifdef BFD_ASSEMBLER
struct local_symbol *locsym = (struct local_symbol *) symbolP; struct local_symbol *locsym = (struct local_symbol *) symbolP;
if (locsym->lsy_section != undefined_section if (locsym->lsy_section != undefined_section
@ -368,6 +369,7 @@ colon (sym_name) /* just seen "x:" - rattle symbols & frags */
locsym->lsy_section = now_seg; locsym->lsy_section = now_seg;
local_symbol_set_frag (locsym, frag_now); local_symbol_set_frag (locsym, frag_now);
locsym->lsy_offset = frag_now_fix (); locsym->lsy_offset = frag_now_fix ();
#endif
} }
else if (!S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP)) else if (!S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP))
{ {
@ -615,8 +617,6 @@ symbol_find_base (name, strip_underscore)
CONST char *name; CONST char *name;
int strip_underscore; int strip_underscore;
{ {
struct local_symbol *locsym;
if (strip_underscore && *name == '_') if (strip_underscore && *name == '_')
name++; name++;
@ -649,9 +649,15 @@ symbol_find_base (name, strip_underscore)
*copy = '\0'; *copy = '\0';
} }
locsym = (struct local_symbol *) hash_find (local_hash, name); #ifdef BFD_ASSEMBLER
if (locsym != NULL) {
return (symbolS *) locsym; struct local_symbol *locsym;
locsym = (struct local_symbol *) hash_find (local_hash, name);
if (locsym != NULL)
return (symbolS *) locsym;
}
#endif
return ((symbolS *) hash_find (sy_hash, name)); return ((symbolS *) hash_find (sy_hash, name));
} }
@ -844,6 +850,7 @@ resolve_symbol_value (symp, finalize)
valueT final_val; valueT final_val;
segT final_seg; segT final_seg;
#ifdef BFD_ASSEMBLER
if (LOCAL_SYMBOL_CHECK (symp)) if (LOCAL_SYMBOL_CHECK (symp))
{ {
struct local_symbol *locsym = (struct local_symbol *) symp; struct local_symbol *locsym = (struct local_symbol *) symp;
@ -862,6 +869,7 @@ resolve_symbol_value (symp, finalize)
return final_val; return final_val;
} }
#endif
if (symp->sy_resolved) if (symp->sy_resolved)
{ {
@ -1566,8 +1574,10 @@ valueT
S_GET_VALUE (s) S_GET_VALUE (s)
symbolS *s; symbolS *s;
{ {
#ifdef BFD_ASSEMBLER
if (LOCAL_SYMBOL_CHECK (s)) if (LOCAL_SYMBOL_CHECK (s))
return ((struct local_symbol *) s)->lsy_offset; return ((struct local_symbol *) s)->lsy_offset;
#endif
if (!s->sy_resolved && s->sy_value.X_op != O_constant) if (!s->sy_resolved && s->sy_value.X_op != O_constant)
resolve_symbol_value (s, 1); resolve_symbol_value (s, 1);
@ -1598,11 +1608,13 @@ S_SET_VALUE (s, val)
symbolS *s; symbolS *s;
valueT val; valueT val;
{ {
#ifdef BFD_ASSEMBLER
if (LOCAL_SYMBOL_CHECK (s)) if (LOCAL_SYMBOL_CHECK (s))
{ {
((struct local_symbol *) s)->lsy_offset = val; ((struct local_symbol *) s)->lsy_offset = val;
return; return;
} }
#endif
s->sy_value.X_op = O_constant; s->sy_value.X_op = O_constant;
s->sy_value.X_add_number = (offsetT) val; s->sy_value.X_add_number = (offsetT) val;
@ -1909,11 +1921,13 @@ symbol_set_frag (s, f)
symbolS *s; symbolS *s;
fragS *f; fragS *f;
{ {
#ifdef BFD_ASSEMBLER
if (LOCAL_SYMBOL_CHECK (s)) if (LOCAL_SYMBOL_CHECK (s))
{ {
local_symbol_set_frag ((struct local_symbol *) s, f); local_symbol_set_frag ((struct local_symbol *) s, f);
return; return;
} }
#endif
s->sy_frag = f; s->sy_frag = f;
} }
@ -1923,8 +1937,10 @@ fragS *
symbol_get_frag (s) symbol_get_frag (s)
symbolS *s; symbolS *s;
{ {
#ifdef BFD_ASSEMBLER
if (LOCAL_SYMBOL_CHECK (s)) if (LOCAL_SYMBOL_CHECK (s))
return local_symbol_get_frag ((struct local_symbol *) s); return local_symbol_get_frag ((struct local_symbol *) s);
#endif
return s->sy_frag; return s->sy_frag;
} }
@ -2066,11 +2082,13 @@ void
symbol_mark_resolved (s) symbol_mark_resolved (s)
symbolS *s; symbolS *s;
{ {
#ifdef BFD_ASSEMBLER
if (LOCAL_SYMBOL_CHECK (s)) if (LOCAL_SYMBOL_CHECK (s))
{ {
local_symbol_mark_resolved ((struct local_symbol *) s); local_symbol_mark_resolved ((struct local_symbol *) s);
return; return;
} }
#endif
s->sy_resolved = 1; s->sy_resolved = 1;
} }
@ -2080,8 +2098,10 @@ int
symbol_resolved_p (s) symbol_resolved_p (s)
symbolS *s; symbolS *s;
{ {
#ifdef BFD_ASSEMBLER
if (LOCAL_SYMBOL_CHECK (s)) if (LOCAL_SYMBOL_CHECK (s))
return local_symbol_resolved_p ((struct local_symbol *) s); return local_symbol_resolved_p ((struct local_symbol *) s);
#endif
return s->sy_resolved; return s->sy_resolved;
} }
@ -2260,6 +2280,7 @@ print_symbol_value_1 (file, sym)
if (LOCAL_SYMBOL_CHECK (sym)) if (LOCAL_SYMBOL_CHECK (sym))
{ {
#ifdef BFD_ASSEMBLER
struct local_symbol *locsym = (struct local_symbol *) sym; struct local_symbol *locsym = (struct local_symbol *) sym;
if (local_symbol_get_frag (locsym) != &zero_address_frag if (local_symbol_get_frag (locsym) != &zero_address_frag
&& local_symbol_get_frag (locsym) != NULL) && local_symbol_get_frag (locsym) != NULL)
@ -2267,6 +2288,7 @@ print_symbol_value_1 (file, sym)
if (local_symbol_resolved_p (locsym)) if (local_symbol_resolved_p (locsym))
fprintf (file, " resolved"); fprintf (file, " resolved");
fprintf (file, " local"); fprintf (file, " local");
#endif
} }
else else
{ {
@ -2305,10 +2327,12 @@ print_symbol_value_1 (file, sym)
{ {
indent_level++; indent_level++;
fprintf (file, "\n%*s<", indent_level * 4, ""); fprintf (file, "\n%*s<", indent_level * 4, "");
#ifdef BFD_ASSEMBLER
if (LOCAL_SYMBOL_CHECK (sym)) if (LOCAL_SYMBOL_CHECK (sym))
fprintf (file, "constant %lx", fprintf (file, "constant %lx",
(long) ((struct local_symbol *) sym)->lsy_offset); (long) ((struct local_symbol *) sym)->lsy_offset);
else else
#endif
print_expr_1 (file, &sym->sy_value); print_expr_1 (file, &sym->sy_value);
fprintf (file, ">"); fprintf (file, ">");
indent_level--; indent_level--;