Commit 49309057 authored by Ian Lance Taylor's avatar Ian Lance Taylor
Browse files

Add support for storing local symbols in a small structure to save

	memory when assembling large files.
	* as.h: Don't include struc-symbol.h.
	(symbolS): Add typedef.
	* symbols.c: Include struc-symbol.h.
	(local_hash): New static variable.
	(save_symbol_name): New static function, from symbol_create.
	(symbol_create): Call save_symbol_name.
	(local_symbol_count): New static variable.
	(local_symbol_conversion_count): Likewise.
	(LOCAL_SYMBOL_CHECK): Define.
	(local_symbol_make): New static function.
	(local_symbol_convert): New static function.
	(colon): Handle local symbols.  Create local symbol for local
	label name.
	(symbol_table_insert): Handle local symbols.
	(symbol_find_or_make): Create local symbol for local label name.
	(symbol_find_base): Check for local symbol.
	(symbol_append, symbol_insert): Check for local symbols.
	(symbol_clear_list_pointers, symbol_remove): Likewise.
	(verify_symbol_chain): Likewise.
	(copy_symbol_attributes): Likewise.
	(resolve_symbol_value): Handle local symbols.
	(resolve_local_symbol): New static function.
	(resolve_local_symbol_values): New function.
	(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
	(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
	(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
	(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
	(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
	(symbol_previous, symbol_next): New functions.
	(symbol_get_value_expression): Likewise.
	(symbol_set_value_expression): Likewise.
	(symbol_set_frag, symbol_get_frag): Likewise.
	(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
	(symbol_mark_used_in_reloc): Likewise.
	(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
	(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
	(symbol_mri_common_p): Likewise.
	(symbol_mark_written, symbol_clear_written): Likewise.
	(symbol_written_p): Likewise.
	(symbol_mark_resolved, symbol_resolved_p): Likewise.
	(symbol_section_p, symbol_equated_p): Likewise.
	(symbol_constant_p): Likewise.
	(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
	(symbol_get_obj, symbol_set_obj): Likewise.
	(symbol_get_tc, symbol_set_tc): Likewise.
	(symbol_begin): Initialize local_hash.
	(print_symbol_value_1): Handle local symbols.
	(symbol_print_statistics): Print local symbol statistics.
	* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
	Declare new symbols.c functions.  Move many declarations here from
	struc-symbol.h.
	(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
	* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
	(struct symbol): Move bsym to make it clearly the first field.
	Remove TARGET_SYMBOL_FIELDS.
	(symbolS): Don't typedef.
	(struct broken_word): Remove.
	(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
	(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
	(symbol_clear_list_pointers): Likewise.
	(symbol_insert, symbol_remove): Likewise.
	(symbol_previous, symbol_append): Likewise.
	(verify_symbol_chain, verify_symbol_chain_2): Likewise.
	(struct local_symbol): Define.
	(local_symbol_converted_p, local_symbol_mark_converted): Define.
	(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
	(local_symbol_get_frag, local_symbol_set_frag): Define.
	(local_symbol_get_real_symbol): Define.
	(local_symbol_set_real_symbol): Define.
	Define.
	* write.c (write_object_file): Call resolve_local_symbol_values.
	* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
	(TARGET_SYMBOL_FIELDS): Don't define.
	* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field.  If
	ECOFF_DEBUGGING, add ECOFF fields.
	(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
	* config/obj-multi.h (struct elf_obj_sy): Add local field.  If
	ECOFF_DEBUGGING, add ECOFF fields.
	(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
	(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
	* config/tc-mcore.h: Don't include struc-symbol.h.
	(TARGET_SYMBOL_FIELDS): Don't define.
	(struct mcore_tc_sy): Define.
	(TC_SYMFIELD_TYPE): Define.
	* Many files: Use symbolS instead of struct symbol.  Use new
	accessor functions rather than referring to symbolS fields
	directly.
	* read.c (s_mri_common): Don't add in value of line_label.
	* config/tc-mips.c (md_apply_fix): Correct parenthesization when
	checking for SEC_LINK_ONCE.
	* config/tc-sh.h (sh_fix_adjustable): Declare.
parent 2b47531b
1999-06-03 Ian Lance Taylor <ian@zembu.com>
Add support for storing local symbols in a small structure to save
memory when assembling large files.
* as.h: Don't include struc-symbol.h.
(symbolS): Add typedef.
* symbols.c: Include struc-symbol.h.
(local_hash): New static variable.
(save_symbol_name): New static function, from symbol_create.
(symbol_create): Call save_symbol_name.
(local_symbol_count): New static variable.
(local_symbol_conversion_count): Likewise.
(LOCAL_SYMBOL_CHECK): Define.
(local_symbol_make): New static function.
(local_symbol_convert): New static function.
(colon): Handle local symbols. Create local symbol for local
label name.
(symbol_table_insert): Handle local symbols.
(symbol_find_or_make): Create local symbol for local label name.
(symbol_find_base): Check for local symbol.
(symbol_append, symbol_insert): Check for local symbols.
(symbol_clear_list_pointers, symbol_remove): Likewise.
(verify_symbol_chain): Likewise.
(copy_symbol_attributes): Likewise.
(resolve_symbol_value): Handle local symbols.
(resolve_local_symbol): New static function.
(resolve_local_symbol_values): New function.
(S_GET_VALUE, S_SET_VALUE): Handle local symbols.
(S_IS_FUNCTION, S_IS_EXTERNAL, S_IS_WEAK, S_IS_COMMON): Likewise.
(S_IS_DEFINED, S_IS_DEBUG, S_IS_LOCAL, S_GET_NAME): Likewise.
(S_GET_SEGMENT, S_SET_SEGMENT, S_SET_EXTERNAL): Likewise.
(S_CLEAR_EXTERNAL, S_SET_WEAK, S_SET_NAME): Likewise.
(symbol_previous, symbol_next): New functions.
(symbol_get_value_expression): Likewise.
(symbol_set_value_expression): Likewise.
(symbol_set_frag, symbol_get_frag): Likewise.
(symbol_mark_used, symbol_clear_used, symbol_used_p): Likewise.
(symbol_mark_used_in_reloc): Likewise.
(symbol_clear_used_in_reloc, symbol_used_in_reloc_p): Likewise.
(symbol_mark_mri_common, symbol_clear_mri_common): Likewise.
(symbol_mri_common_p): Likewise.
(symbol_mark_written, symbol_clear_written): Likewise.
(symbol_written_p): Likewise.
(symbol_mark_resolved, symbol_resolved_p): Likewise.
(symbol_section_p, symbol_equated_p): Likewise.
(symbol_constant_p): Likewise.
(symbol_get_bfdsym, symbol_set_bfdsym): Likewise.
(symbol_get_obj, symbol_set_obj): Likewise.
(symbol_get_tc, symbol_set_tc): Likewise.
(symbol_begin): Initialize local_hash.
(print_symbol_value_1): Handle local symbols.
(symbol_print_statistics): Print local symbol statistics.
* symbols.h: Include "struc-symbol.h" if not BFD_ASSEMBLER.
Declare new symbols.c functions. Move many declarations here from
struc-symbol.h.
(SYMBOLS_NEED_BACKPOINTERS): Define if needed.
* struc-symbol.h (SYMBOLS_NEED_BACKPOINTERS): Don't set.
(struct symbol): Move bsym to make it clearly the first field.
Remove TARGET_SYMBOL_FIELDS.
(symbolS): Don't typedef.
(struct broken_word): Remove.
(N_TYPE_seg, seg_N_TYPE): Move to symbol.h.
(SEGMENT_TO_SYMBOL_TYPE, N_REGISTER): Likewise.
(symbol_clear_list_pointers): Likewise.
(symbol_insert, symbol_remove): Likewise.
(symbol_previous, symbol_append): Likewise.
(verify_symbol_chain, verify_symbol_chain_2): Likewise.
(struct local_symbol): Define.
(local_symbol_converted_p, local_symbol_mark_converted): Define.
(local_symbol_resolved_p, local_symbol_mark_resolved): Define.
(local_symbol_get_frag, local_symbol_set_frag): Define.
(local_symbol_get_real_symbol): Define.
(local_symbol_set_real_symbol): Define.
Define.
* write.c (write_object_file): Call resolve_local_symbol_values.
* config/obj-ecoff.h (OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-elf.h (OBJ_SYMFIELD_TYPE): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
* config/obj-multi.h (struct elf_obj_sy): Add local field. If
ECOFF_DEBUGGING, add ECOFF fields.
(ELF_TARGET_SYMBOL_FIELDS, TARGET_SYMBOL_FIELDS): Don't define.
(ECOFF_DEBUG_TARGET_SYMBOL_FIELDS): Don't define.
* config/tc-mcore.h: Don't include struc-symbol.h.
(TARGET_SYMBOL_FIELDS): Don't define.
(struct mcore_tc_sy): Define.
(TC_SYMFIELD_TYPE): Define.
* Many files: Use symbolS instead of struct symbol. Use new
accessor functions rather than referring to symbolS fields
directly.
* read.c (s_mri_common): Don't add in value of line_label.
* config/tc-mips.c (md_apply_fix): Correct parenthesization when
checking for SEC_LINK_ONCE.
* config/tc-sh.h (sh_fix_adjustable): Declare.
* app.c (input_buffer): New static variable.
(app_push): Save saved_input in allocated buffer.
(app_pop): Restored saved_input.
(do_scrub_chars): Change get parameter to take char * and int as
arguments. Change GET macro to pass input_buffer to get
function. Don't save input into allocated buffer.
* as.h (do_scrub_chars): Update declaration.
* input-file.c (input_file_get): Change to take char * and int.
Read data into passed in buffer. Remove static buffer.
* read.c (scrub_from_string): Change to take char * and int. Copy
data into passed in buffer.
* hash.h: Neaten. Declare hash_traverse.
* hash.c: Complete rewrite based on BFD hashing code.
* gasp.c (chunksize): New variable.
* macro.c (macro_expand_body): Call hash_jam with NULL rather than
hash_delete.
1999-05-28 Nick Clifton <nickc@cygnus.com>
* config/tc-arm.c (md_apply_fix3): Add pipeline offset into reloc
......
/* cond.c - conditional assembly pseudo-ops, and .include
Copyright (C) 1990, 91, 92, 93, 95, 96, 97, 1998
Copyright (C) 1990, 91, 92, 93, 95, 96, 97, 98, 1999
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
......@@ -64,7 +64,7 @@ s_ifdef (arg)
int arg;
{
register char *name; /* points to name of symbol */
register struct symbol *symbolP; /* Points to symbol */
register symbolS *symbolP; /* Points to symbol */
struct conditional_frame cframe;
SKIP_WHITESPACE (); /* Leading whitespace is part of operand. */
......
/* a.out object file format
Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996
Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
......@@ -14,9 +14,10 @@ WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with GAS; see the file COPYING. If not, write
to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "as.h"
#ifdef BFD_ASSEMBLER
......@@ -108,18 +109,21 @@ obj_aout_frob_symbol (sym, punt)
asection *sec;
int desc, type, other;
flags = sym->bsym->flags;
flags = symbol_get_bfdsym (sym)->flags;
desc = S_GET_DESC (sym);
type = S_GET_TYPE (sym);
other = S_GET_OTHER (sym);
sec = sym->bsym->section;
sec = S_GET_SEGMENT (sym);
/* Only frob simple symbols this way right now. */
if (! (type & ~ (N_TYPE | N_EXT)))
{
if (type == (N_UNDF | N_EXT)
&& sec == &bfd_abs_section)
sym->bsym->section = sec = bfd_und_section_ptr;
{
sec = bfd_und_section_ptr;
S_SET_SEGMENT (sym, sec);
}
if ((type & N_TYPE) != N_INDR
&& (type & N_TYPE) != N_SETA
......@@ -141,7 +145,7 @@ obj_aout_frob_symbol (sym, punt)
case N_SETB:
/* Set the debugging flag for constructor symbols so that
BFD leaves them alone. */
sym->bsym->flags |= BSF_DEBUGGING;
symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
/* You can't put a common symbol in a set. The way a set
element works is that the symbol has a definition and a
......@@ -164,29 +168,29 @@ obj_aout_frob_symbol (sym, punt)
break;
case N_INDR:
/* Put indirect symbols in the indirect section. */
sym->bsym->section = bfd_ind_section_ptr;
sym->bsym->flags |= BSF_INDIRECT;
S_SET_SEGMENT (sym, bfd_ind_section_ptr);
symbol_get_bfdsym (sym)->flags |= BSF_INDIRECT;
if (type & N_EXT)
{
sym->bsym->flags |= BSF_EXPORT;
sym->bsym->flags &=~ BSF_LOCAL;
symbol_get_bfdsym (sym)->flags |= BSF_EXPORT;
symbol_get_bfdsym (sym)->flags &=~ BSF_LOCAL;
}
break;
case N_WARNING:
/* Mark warning symbols. */
sym->bsym->flags |= BSF_WARNING;
symbol_get_bfdsym (sym)->flags |= BSF_WARNING;
break;
}
}
else
{
sym->bsym->flags |= BSF_DEBUGGING;
symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
}
S_SET_TYPE (sym, type);
/* Double check weak symbols. */
if (sym->bsym->flags & BSF_WEAK)
if (S_IS_WEAK (sym))
{
if (S_IS_COMMON (sym))
as_bad (_("Symbol `%s' can not be both weak and common"),
......
/* obj-aout.h, a.out object file format for gas, the assembler.
Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1998
Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 98, 1999
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
......@@ -60,18 +60,24 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */
#ifdef BFD_ASSEMBLER
#define S_SET_OTHER(S,V) (aout_symbol((S)->bsym)->other = (V))
#define S_SET_TYPE(S,T) (aout_symbol((S)->bsym)->type = (T))
#define S_SET_DESC(S,D) (aout_symbol((S)->bsym)->desc = (D))
#define S_GET_OTHER(S) (aout_symbol((S)->bsym)->other)
#define S_GET_TYPE(S) (aout_symbol((S)->bsym)->type)
#define S_GET_DESC(S) (aout_symbol((S)->bsym)->desc)
#define S_SET_OTHER(S,V) \
(aout_symbol (symbol_get_bfdsym (S))->other = (V))
#define S_SET_TYPE(S,T) \
(aout_symbol (symbol_get_bfdsym (S))->type = (T))
#define S_SET_DESC(S,D) \
(aout_symbol (symbol_get_bfdsym (S))->desc = (D))
#define S_GET_OTHER(S) \
(aout_symbol (symbol_get_bfdsym (S))->other)
#define S_GET_TYPE(S) \
(aout_symbol (symbol_get_bfdsym (S))->type)
#define S_GET_DESC(S) \
(aout_symbol (symbol_get_bfdsym (S))->desc)
asection *text_section, *data_section, *bss_section;
#define obj_frob_symbol(S,PUNT) obj_aout_frob_symbol (S, &PUNT)
#define obj_frob_file() obj_aout_frob_file ()
extern void obj_aout_frob_symbol PARAMS ((struct symbol *, int *));
extern void obj_aout_frob_symbol PARAMS ((symbolS *, int *));
extern void obj_aout_frob_file PARAMS ((void));
#define obj_sec_sym_ok_for_reloc(SEC) (1)
......
/* coff object file format
Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 1998
Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
Free Software Foundation, Inc.
This file is part of GAS.
......@@ -249,8 +249,8 @@ SA_SET_SYM_ENDNDX (sym, val)
{
combined_entry_type *entry, *p;
entry = &coffsymbol (sym->bsym)->native[1];
p = coffsymbol (val->bsym)->native;
entry = &coffsymbol (symbol_get_bfdsym (sym))->native[1];
p = coffsymbol (symbol_get_bfdsym (val))->native;
entry->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p = p;
entry->fix_end = 1;
}
......@@ -262,8 +262,8 @@ SA_SET_SYM_TAGNDX (sym, val)
{
combined_entry_type *entry, *p;
entry = &coffsymbol (sym->bsym)->native[1];
p = coffsymbol (val->bsym)->native;
entry = &coffsymbol (symbol_get_bfdsym (sym))->native[1];
p = coffsymbol (symbol_get_bfdsym (val))->native;
entry->u.auxent.x_sym.x_tagndx.p = p;
entry->fix_tag = 1;
}
......@@ -272,7 +272,7 @@ static int
S_GET_DATA_TYPE (sym)
symbolS *sym;
{
return coffsymbol (sym->bsym)->native->u.syment.n_type;
return coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_type;
}
int
......@@ -280,7 +280,7 @@ S_SET_DATA_TYPE (sym, val)
symbolS *sym;
int val;
{
coffsymbol (sym->bsym)->native->u.syment.n_type = val;
coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_type = val;
return val;
}
......@@ -288,7 +288,7 @@ int
S_GET_STORAGE_CLASS (sym)
symbolS *sym;
{
return coffsymbol (sym->bsym)->native->u.syment.n_sclass;
return coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_sclass;
}
int
......@@ -296,7 +296,7 @@ S_SET_STORAGE_CLASS (sym, val)
symbolS *sym;
int val;
{
coffsymbol (sym->bsym)->native->u.syment.n_sclass = val;
coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_sclass = val;
return val;
}
......@@ -339,7 +339,7 @@ c_dot_file_symbol (filename)
S_SET_STORAGE_CLASS (symbolP, C_FILE);
S_SET_NUMBER_AUXILIARY (symbolP, 1);
symbolP->bsym->flags = BSF_DEBUGGING;
symbol_get_bfdsym (symbolP)->flags = BSF_DEBUGGING;
#ifndef NO_LISTING
{
......@@ -385,7 +385,7 @@ coff_obj_symbol_new_hook (symbolP)
char * s = (char *) xmalloc (sz);
memset (s, 0, sz);
coffsymbol (symbolP->bsym)->native = (combined_entry_type *) s;
coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s;
S_SET_DATA_TYPE (symbolP, T_NULL);
S_SET_STORAGE_CLASS (symbolP, 0);
......@@ -434,7 +434,8 @@ coff_add_linesym (sym)
{
if (line_nos)
{
coffsymbol (current_lineno_sym->bsym)->lineno = (alent *) line_nos;
coffsymbol (symbol_get_bfdsym (current_lineno_sym))->lineno =
(alent *) line_nos;
coff_n_line_nos++;
line_nos = 0;
}
......@@ -532,7 +533,7 @@ obj_coff_def (what)
/* Initialize the new symbol */
def_symbol_in_progress = symbol_make (symbol_name_copy);
def_symbol_in_progress->sy_frag = &zero_address_frag;
symbol_set_frag (def_symbol_in_progress, &zero_address_frag);
S_SET_VALUE (def_symbol_in_progress, 0);
if (S_IS_STRING (def_symbol_in_progress))
......@@ -585,7 +586,7 @@ obj_coff_endef (ignore)
CONST char *name;
S_SET_SEGMENT (def_symbol_in_progress, text_section);
name = bfd_asymbol_name (def_symbol_in_progress->bsym);
name = S_GET_NAME (def_symbol_in_progress);
if (name[1] == 'b' && name[2] == 'f')
{
if (! in_function ())
......@@ -909,17 +910,19 @@ obj_coff_val (ignore)
#endif
if (!strcmp (symbol_name, "."))
{
def_symbol_in_progress->sy_frag = frag_now;
symbol_set_frag (def_symbol_in_progress, frag_now);
S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ());
/* If the .val is != from the .def (e.g. statics) */
}
else if (strcmp (S_GET_NAME (def_symbol_in_progress), symbol_name))
{
def_symbol_in_progress->sy_value.X_op = O_symbol;
def_symbol_in_progress->sy_value.X_add_symbol =
symbol_find_or_make (symbol_name);
def_symbol_in_progress->sy_value.X_op_symbol = NULL;
def_symbol_in_progress->sy_value.X_add_number = 0;
expressionS exp;
exp.X_op = O_symbol;
exp.X_add_symbol = symbol_find_or_make (symbol_name);
exp.X_op_symbol = NULL;
exp.X_add_number = 0;
symbol_set_value_expression (def_symbol_in_progress, &exp);
/* If the segment is undefined when the forward reference is
resolved, then copy the segment id from the forward
......@@ -1034,7 +1037,8 @@ coff_frob_symbol (symp, punt)
coff_last_function = symp;
if (S_GET_NUMBER_AUXILIARY (symp) < 1)
S_SET_NUMBER_AUXILIARY (symp, 1);
auxp = &coffsymbol (symp->bsym)->native[1].u.auxent;
auxp =
&coffsymbol (symbol_get_bfdsym (symp))->native[1].u.auxent;
memset (auxp->x_sym.x_fcnary.x_ary.x_dimen, 0,
sizeof (auxp->x_sym.x_fcnary.x_ary.x_dimen));
}
......@@ -1055,7 +1059,7 @@ coff_frob_symbol (symp, punt)
*punt = 1;
if (SF_GET_FUNCTION (symp))
symp->bsym->flags |= BSF_FUNCTION;
symbol_get_bfdsym (symp)->flags |= BSF_FUNCTION;
/* more ... */
}
......@@ -1069,7 +1073,7 @@ coff_frob_symbol (symp, punt)
/* This is pretty horrible, but we have to set *punt correctly in
order to call SA_SET_SYM_ENDNDX correctly. */
if (! symp->sy_used_in_reloc
&& ((symp->bsym->flags & BSF_SECTION_SYM) != 0
&& ((symbol_get_bfdsym (symp)->flags & BSF_SECTION_SYM) != 0
|| (! S_IS_EXTERNAL (symp)
&& ! symp->sy_tc.output
&& S_GET_STORAGE_CLASS (symp) != C_FILE)))
......@@ -1078,7 +1082,7 @@ coff_frob_symbol (symp, punt)
if (set_end != (symbolS *) NULL
&& ! *punt
&& ((symp->bsym->flags & BSF_NOT_AT_END) != 0
&& ((symbol_get_bfdsym (symp)->flags & BSF_NOT_AT_END) != 0
|| (S_IS_DEFINED (symp)
&& ! S_IS_COMMON (symp)
&& (! S_IS_EXTERNAL (symp) || SF_GET_FUNCTION (symp)))))
......@@ -1100,22 +1104,22 @@ coff_frob_symbol (symp, punt)
coff_last_bf = symp;
}
if (coffsymbol (symp->bsym)->lineno)
if (coffsymbol (symbol_get_bfdsym (symp))->lineno)
{
int i;
struct line_no *lptr;
alent *l;
lptr = (struct line_no *) coffsymbol (symp->bsym)->lineno;
lptr = (struct line_no *) coffsymbol (symbol_get_bfdsym (symp))->lineno;
for (i = 0; lptr; lptr = lptr->next)
i++;
lptr = (struct line_no *) coffsymbol (symp->bsym)->lineno;
lptr = (struct line_no *) coffsymbol (symbol_get_bfdsym (symp))->lineno;
/* We need i entries for line numbers, plus 1 for the first
entry which BFD will override, plus 1 for the last zero
entry (a marker for BFD). */
l = (alent *) xmalloc ((i + 2) * sizeof (alent));
coffsymbol (symp->bsym)->lineno = l;
coffsymbol (symbol_get_bfdsym (symp))->lineno = l;
l[i + 1].line_number = 0;
l[i + 1].u.sym = NULL;
for (; i > 0; i--)
......
......@@ -154,7 +154,7 @@
#define OBJ_COFF_MAX_AUXENTRIES 1
#endif /* OBJ_COFF_MAX_AUXENTRIES */
extern void coff_obj_symbol_new_hook PARAMS ((struct symbol *));
extern void coff_obj_symbol_new_hook PARAMS ((symbolS *));
#define obj_symbol_new_hook coff_obj_symbol_new_hook
extern void coff_obj_read_begin_hook PARAMS ((void));
......@@ -211,32 +211,35 @@ extern void coff_obj_read_begin_hook PARAMS ((void));
/* Alter the field names, for now, until we've fixed up the other
references to use the new name. */
#ifdef TC_I960
#define TC_SYMFIELD_TYPE struct symbol *
#define TC_SYMFIELD_TYPE symbolS *
#define sy_tc bal
#endif
#define OBJ_SYMFIELD_TYPE unsigned long
#define sy_obj sy_flags
#define SYM_AUXENT(S) (&coffsymbol ((S)->bsym)->native[1].u.auxent)
#define SYM_AUXINFO(S) (&coffsymbol ((S)->bsym)->native[1])
#define SYM_AUXENT(S) \
(&coffsymbol (symbol_get_bfdsym (S))->native[1].u.auxent)
#define SYM_AUXINFO(S) \
(&coffsymbol (symbol_get_bfdsym (S))->native[1])
#define DO_NOT_STRIP 0
extern void obj_coff_section PARAMS ((int));
/* The number of auxiliary entries */
#define S_GET_NUMBER_AUXILIARY(s) (coffsymbol((s)->bsym)->native->u.syment.n_numaux)
#define S_GET_NUMBER_AUXILIARY(s) \
(coffsymbol (symbol_get_bfdsym (s))->native->u.syment.n_numaux)
/* The number of auxiliary entries */
#define S_SET_NUMBER_AUXILIARY(s,v) (S_GET_NUMBER_AUXILIARY (s) = (v))
/* True if a symbol name is in the string table, i.e. its length is > 8. */
#define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
extern int S_SET_DATA_TYPE PARAMS ((struct symbol *, int));
extern int S_SET_STORAGE_CLASS PARAMS ((struct symbol *, int));
extern int S_GET_STORAGE_CLASS PARAMS ((struct symbol *));
extern void SA_SET_SYM_ENDNDX PARAMS ((struct symbol *, struct symbol *));
extern int S_SET_DATA_TYPE PARAMS ((symbolS *, int));
extern int S_SET_STORAGE_CLASS PARAMS ((symbolS *, int));
extern int S_GET_STORAGE_CLASS PARAMS ((symbolS *));
extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *));
/* Auxiliary entry macros. SA_ stands for symbol auxiliary */
/* Omit the tv related fields */
......@@ -298,9 +301,9 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((struct symbol *, struct symbol *));
/* All other bits are unused. */
/* Accessors */
#define SF_GET(s) ((s)->sy_flags)
#define SF_GET_DEBUG(s) ((s)->bsym->flags & BSF_DEBUGGING)
#define SF_SET_DEBUG(s) ((s)->bsym->flags |= BSF_DEBUGGING)
#define SF_GET(s) (*symbol_get_obj (s))
#define SF_GET_DEBUG(s) (symbol_get_bfdsym (s)->flags & BSF_DEBUGGING)
#define SF_SET_DEBUG(s) (symbol_get_bfdsym (s)->flags |= BSF_DEBUGGING)
#define SF_GET_NORMAL_FIELD(s) (SF_GET (s) & SF_NORMAL_MASK)
#define SF_GET_DEBUG_FIELD(s) (SF_GET (s) & SF_DEBUG_MASK)
#define SF_GET_FILE(s) (SF_GET (s) & SF_FILE)
......@@ -346,13 +349,13 @@ extern int coff_line_base;
extern int coff_n_line_nos;
#define obj_emit_lineno(WHERE,LINE,FILE_START) abort ()
extern void coff_add_linesym PARAMS ((struct symbol *));
extern void coff_add_linesym PARAMS ((symbolS *));
void c_dot_file_symbol PARAMS ((char *filename));
#define obj_app_file c_dot_file_symbol
extern void coff_frob_symbol PARAMS ((struct symbol *, int *));
extern void coff_frob_symbol PARAMS ((symbolS *, int *));
extern void coff_adjust_symtab PARAMS ((void));
extern void coff_frob_section PARAMS ((segT));
extern void coff_adjust_section_syms PARAMS ((bfd *, asection *, PTR));
......@@ -364,7 +367,7 @@ extern void coff_frob_file_after_relocs PARAMS ((void));
#define obj_frob_section(S) coff_frob_section (S)
#define obj_frob_file_after_relocs() coff_frob_file_after_relocs ()
extern struct symbol *coff_last_function;
extern symbolS *coff_last_function;
/* Forward the segment of a forwarded symbol, handle assignments that
just copy symbol values, etc. */
......@@ -778,7 +781,7 @@ extern void c_dot_file_symbol PARAMS ((char *filename));
#define obj_app_file c_dot_file_symbol
extern void obj_extra_stuff PARAMS ((object_headers * headers));
extern segT s_get_segment PARAMS ((struct symbol * ptr));
extern segT s_get_segment PARAMS ((symbolS *ptr));
extern void c_section_header PARAMS ((struct internal_scnhdr * header,
char *name,
......@@ -792,7 +795,7 @@ extern void c_section_header PARAMS ((struct internal_scnhdr * header,
long alignment));
#ifndef tc_coff_symbol_emit_hook
void tc_coff_symbol_emit_hook PARAMS ((struct symbol *));
void tc_coff_symbol_emit_hook PARAMS ((symbolS *));
#endif
/* sanity check */
......
......@@ -36,10 +36,14 @@
symbols is undefined (this last is needed to distinguish a .extern
symbols from a .comm symbol). */
#define TARGET_SYMBOL_FIELDS \
struct efdr *ecoff_file; \
struct localsym *ecoff_symbol; \
struct ecoff_sy_obj
{
struct efdr *ecoff_file;
struct localsym *ecoff_symbol;
valueT ecoff_extern_size;
};
#define OBJ_SYMFIELD_TYPE struct ecoff_sy_obj
/* Modify the ECOFF symbol. */
#define obj_frob_symbol(symp, punt) ecoff_frob_symbol (symp)
......@@ -64,4 +68,4 @@ extern void ecoff_frob_file PARAMS ((void));
#define obj_sec_sym_ok_for_reloc(SEC) 1
#define obj_ecoff_set_ext ecoff_set_ext
extern void obj_ecoff_set_ext PARAMS ((struct symbol *, EXTR *));
extern void obj_ecoff_set_ext PARAMS ((symbolS *, EXTR *));
/* ELF object file format
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
......@@ -235,8 +236,8 @@ elf_file_symbol (s)
symbolS *sym;
sym = symbol_new (s, absolute_section, (valueT) 0, (struct frag *) 0);
sym->sy_frag = &zero_address_frag;
sym->bsym->flags |= BSF_FILE;
symbol_set_frag (sym, &zero_address_frag);
symbol_get_bfdsym (sym)->flags |= BSF_FILE;
if (symbol_rootP != sym)
{
......@@ -322,7 +323,7 @@ obj_elf_common (ignore)
as_warn (_("Common alignment negative; 0 assumed"));
}
}
if (symbolP->local)
if (symbol_get_obj (symbolP)->local)
{
segT old_sec;
int old_subsec;
......@@ -350,8 +351,8 @@ obj_elf_common (ignore)
if (align)
frag_align (align, 0, 0);
if (S_GET_SEGMENT (symbolP) == bss_section)
symbolP->sy_frag->fr_symbol = 0;
symbolP->sy_frag = frag_now;
symbol_get_frag (symbolP)->fr_symbol = 0;
symbol_set_frag (symbolP, frag_now);
pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
(offsetT) size, (char *) 0);
*pfrag = 0;
......@@ -389,7 +390,7 @@ obj_elf_common (ignore)