* obj-coff.h (TARGET_FORMAT) [TC_I960]: Select little endian version.

* obj-coffbfd.h (TARGET_FORMAT) [TC_I960]: Ditto.

* obj-coff.c (coff_frob_section): Round up the size of every section to a
multiple of the alignment, so that BFD doesn't surprise us.

Eliminate many simple differences between the two COFF back ends:

* obj-coffbfd.c: Removed all uses of DEFUN and DEFUN_VOID.  Made minor
stylistic changes, deleted some register declarations.
(stack_top): Deleted.
(symbol_to_chars): Use absolute_section and reg_section instead of the
corresponding SEG_* symbols.
(obj_coff_endef, tag_find_or_make, fixup_segment): Likewise.
(stack typedef, stack_init, stack_delete, stack_push, stack_pop): Moved to just
after pseudo-op table.  All functions now static.
(stack_delete): Removed declaration.
(tag_init, tag_insert, tag_find_or_make, tag_find): Moved to just after stack
functions.
* obj-coffbfd.h: Reordered some declarations and macros.
(stack_init, stack_delete, stack_push, stack_pop): Don't declare.
(stack typedef): Deleted.
(SYMBOLS_NEED_BACKPOINTERS): Always undef then define; don't test.
(SYM_AUXENT): New macro.
(SA_GET_*, SA_SET_*): Define in terms of SYM_AUXENT when feasible.
(SF_GET_*, SF_SET_*): Define in terms of SF_GET when feasible.
(SA_GET_SYM_TAGNDX, SA_GET_SYM_ENDNDX, SA_SET_SYM_TAGNDX, SA_SET_SYM_ENDNDX,
object_headers typedef, data_section_header, text_section_header): Delete
non-BFD_HEADERS versions, since we always define that symbol now.

* obj-coff.c (stack_top): Deleted.
(obj_coff_endef, obj_coff_dim, obj_coff_line, obj_coff_size, obj_coff_scl,
obj_coff_tag, obj_coff_type, obj_coff_val): Change argument name from "ignored"
to "ignore".
(obj_coff_val): Use frag_now_fix.
(obj_pseudo_table): Removed IGNORE_DEBUG version, since it doesn't get used.
(stack typedef, stack_init, stack_delete, stack_push, stack_pop): Moved to just
after pseudo-op table.  All functions now static.
(tag_init, tag_insert, tag_find_or_make, tag_find): Moved to just after stack
functions.
* obj-coff.h: Reordered some declarations and macros.  Protected against
multiple inclusions.
(stack_init, stack_delete, stack_push, stack_pop): Don't declare.
(stack typedef): Deleted.
(SYMBOLS_NEED_BACKPOINTERS): Always undef then define; don't test.
(stdoutput): Deleted declaration.
(TARGET_FORMAT) [TC_I386]: Don't define if already defined.
This commit is contained in:
Ken Raeburn 1994-05-04 06:19:26 +00:00
parent de9117a714
commit 8fb85d50cd
4 changed files with 494 additions and 582 deletions

View File

@ -19,14 +19,16 @@
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "as.h"
#include "subsegs.h"
#include "obstack.h"
#include "subsegs.h"
const char *s_get_name PARAMS ((symbolS * s));
static symbolS *tag_find_or_make PARAMS ((char *name));
static symbolS *tag_find PARAMS ((char *name));
static void tag_init PARAMS ((void));
static void tag_insert PARAMS ((const char *name, symbolS * symbolP));
const char *s_get_name PARAMS ((symbolS * s));
static void obj_coff_def PARAMS ((int what));
static void obj_coff_def PARAMS ((int));
static void obj_coff_dim PARAMS ((int));
static void obj_coff_endef PARAMS ((int));
static void obj_coff_line PARAMS ((int));
@ -36,8 +38,6 @@ static void obj_coff_size PARAMS ((int));
static void obj_coff_tag PARAMS ((int));
static void obj_coff_type PARAMS ((int));
static void obj_coff_val PARAMS ((int));
static void tag_init PARAMS ((void));
static void tag_insert PARAMS ((const char *name, symbolS * symbolP));
static void SA_SET_SYM_TAGNDX PARAMS ((symbolS *, symbolS *));
@ -46,7 +46,6 @@ static symbolS *def_symbol_in_progress;
const pseudo_typeS obj_pseudo_table[] =
{
#ifndef IGNORE_DEBUG
{"def", obj_coff_def, 0},
{"dim", obj_coff_dim, 0},
{"endef", obj_coff_endef, 0},
@ -58,21 +57,7 @@ const pseudo_typeS obj_pseudo_table[] =
{"tag", obj_coff_tag, 0},
{"type", obj_coff_type, 0},
{"val", obj_coff_val, 0},
#else
{"def", s_ignore, 0},
{"dim", s_ignore, 0},
{"endef", s_ignore, 0},
{"line", s_ignore, 0},
{"ln", s_ignore, 0},
{"scl", s_ignore, 0},
{"size", s_ignore, 0},
{"tag", s_ignore, 0},
{"type", s_ignore, 0},
{"val", s_ignore, 0},
#endif /* ignore debug */
{ "section", obj_coff_section, 0 },
{"ident", s_ignore, 0}, /* we don't yet handle this. */
{"optim", s_ignore, 0}, /* For sun386i cc (?) */
/* other stuff */
@ -80,7 +65,131 @@ const pseudo_typeS obj_pseudo_table[] =
{NULL} /* end sentinel */
}; /* obj_pseudo_table */
/* stack stuff */
typedef struct
{
unsigned long chunk_size;
unsigned long element_size;
unsigned long size;
char *data;
unsigned long pointer;
}
stack;
static stack *
stack_init (chunk_size, element_size)
unsigned long chunk_size;
unsigned long element_size;
{
stack *st;
st = (stack *) malloc (sizeof (stack));
if (!st)
return 0;
st->data = malloc (chunk_size);
if (!st->data)
{
free (st);
return 0;
}
st->pointer = 0;
st->size = chunk_size;
st->chunk_size = chunk_size;
st->element_size = element_size;
return st;
}
static void
stack_delete (st)
stack *st;
{
free (st->data);
free (st);
}
static char *
stack_push (st, element)
stack *st;
char *element;
{
if (st->pointer + st->element_size >= st->size)
{
st->size += st->chunk_size;
if ((st->data = xrealloc (st->data, st->size)) == (char *) 0)
return (char *) 0;
}
memcpy (st->data + st->pointer, element, st->element_size);
st->pointer += st->element_size;
return st->data + st->pointer;
}
static char *
stack_pop (st)
stack *st;
{
if (st->pointer < st->element_size)
{
st->pointer = 0;
return (char *) 0;
}
st->pointer -= st->element_size;
return st->data + st->pointer;
}
/*
* Maintain a list of the tagnames of the structres.
*/
static void
tag_init ()
{
tag_hash = hash_new ();
}
static void
tag_insert (name, symbolP)
const char *name;
symbolS *symbolP;
{
const char *error_string;
if ((error_string = hash_jam (tag_hash, name, (char *) symbolP)))
{
as_fatal ("Inserting \"%s\" into structure table failed: %s",
name, error_string);
}
}
static symbolS *
tag_find_or_make (name)
char *name;
{
symbolS *symbolP;
if ((symbolP = tag_find (name)) == NULL)
{
symbolP = symbol_new (name, undefined_section,
0, &zero_address_frag);
tag_insert (S_GET_NAME (symbolP), symbolP);
symbol_table_insert (symbolP);
} /* not found */
return symbolP;
}
static symbolS *
tag_find (name)
char *name;
{
#ifdef STRIP_UNDERSCORE
if (*name == '_')
name++;
#endif /* STRIP_UNDERSCORE */
return (symbolS *) hash_find (tag_hash, name);
}
struct line_no {
struct line_no *next;
fragS *frag;
@ -308,75 +417,6 @@ obj_symbol_new_hook (symbolP)
}
/* stack stuff */
stack *
stack_init (chunk_size, element_size)
unsigned long chunk_size;
unsigned long element_size;
{
stack *st;
st = (stack *) malloc (sizeof (stack));
if (!st)
return 0;
st->data = malloc (chunk_size);
if (!st->data)
{
free (st);
return 0;
}
st->pointer = 0;
st->size = chunk_size;
st->chunk_size = chunk_size;
st->element_size = element_size;
return st;
}
void
stack_delete (st)
stack *st;
{
free (st->data);
free (st);
}
char *
stack_push (st, element)
stack *st;
char *element;
{
if (st->pointer + st->element_size >= st->size)
{
st->size += st->chunk_size;
if ((st->data = xrealloc (st->data, st->size)) == (char *) 0)
return (char *) 0;
}
memcpy (st->data + st->pointer, element, st->element_size);
st->pointer += st->element_size;
return st->data + st->pointer;
}
char *
stack_pop (st)
stack *st;
{
if (st->pointer < st->element_size)
{
st->pointer = 0;
return (char *) 0;
}
st->pointer -= st->element_size;
return st->data + st->pointer;
}
char *
stack_top (st)
stack *st;
{
return st->data + st->pointer - st->element_size;
}
/*
* Handle .ln directives.
*/
@ -515,8 +555,8 @@ obj_coff_def (what)
unsigned int dim_index;
static void
obj_coff_endef (ignored)
int ignored;
obj_coff_endef (ignore)
int ignore;
{
symbolS *symbolP;
/* DIM BUG FIX sac@cygnus.com */
@ -679,8 +719,8 @@ obj_coff_endef (ignored)
}
static void
obj_coff_dim (ignored)
int ignored;
obj_coff_dim (ignore)
int ignore;
{
int dim_index;
@ -719,8 +759,8 @@ obj_coff_dim (ignored)
}
static void
obj_coff_line (ignored)
int ignored;
obj_coff_line (ignore)
int ignore;
{
int this_base;
@ -742,8 +782,8 @@ obj_coff_line (ignored)
}
static void
obj_coff_size (ignored)
int ignored;
obj_coff_size (ignore)
int ignore;
{
if (def_symbol_in_progress == NULL)
{
@ -758,8 +798,8 @@ obj_coff_size (ignored)
}
static void
obj_coff_scl (ignored)
int ignored;
obj_coff_scl (ignore)
int ignore;
{
if (def_symbol_in_progress == NULL)
{
@ -773,8 +813,8 @@ obj_coff_scl (ignored)
}
static void
obj_coff_tag (ignored)
int ignored;
obj_coff_tag (ignore)
int ignore;
{
char *symbol_name;
char name_end;
@ -806,8 +846,8 @@ obj_coff_tag (ignored)
}
static void
obj_coff_type (ignored)
int ignored;
obj_coff_type (ignore)
int ignore;
{
if (def_symbol_in_progress == NULL)
{
@ -828,8 +868,8 @@ obj_coff_type (ignored)
}
static void
obj_coff_val (ignored)
int ignored;
obj_coff_val (ignore)
int ignore;
{
if (def_symbol_in_progress == NULL)
{
@ -846,7 +886,7 @@ obj_coff_val (ignored)
if (!strcmp (symbol_name, "."))
{
def_symbol_in_progress->sy_frag = frag_now;
S_SET_VALUE (def_symbol_in_progress, obstack_next_free (&frags) - frag_now->fr_literal);
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))
@ -873,59 +913,6 @@ obj_coff_val (ignored)
demand_empty_rest_of_line ();
}
/*
* Maintain a list of the tagnames of the structres.
*/
static void
tag_init ()
{
tag_hash = hash_new ();
}
static void
tag_insert (name, symbolP)
const char *name;
symbolS *symbolP;
{
const char *error_string;
if ((error_string = hash_jam (tag_hash, name, (char *) symbolP)))
{
as_fatal ("Inserting \"%s\" into structure table failed: %s",
name, error_string);
}
}
static symbolS *
tag_find_or_make (name)
char *name;
{
symbolS *symbolP;
if ((symbolP = tag_find (name)) == NULL)
{
symbolP = symbol_new (name, undefined_section,
0, &zero_address_frag);
tag_insert (S_GET_NAME (symbolP), symbolP);
symbol_table_insert (symbolP);
} /* not found */
return symbolP;
}
static symbolS *
tag_find (name)
char *name;
{
#ifdef STRIP_UNDERSCORE
if (*name == '_')
name++;
#endif /* STRIP_UNDERSCORE */
return (symbolS *) hash_find (tag_hash, name);
}
void
obj_read_begin_hook ()
{
@ -1175,13 +1162,22 @@ coff_frob_file ()
}
void
coff_frob_section (strsec)
segT strsec;
coff_frob_section (sec)
segT sec;
{
segT sec;
segT strsec;
char *strname, *p;
fragS *fragp;
bfd_vma size, n_entries;
bfd_vma size, n_entries, mask;
/* The COFF back end in BFD requires that all section sizes be
rounded up to multiples of the corresponding section alignments.
Seems kinda silly to me, but that's the way it is. */
size = bfd_get_section_size_before_reloc (sec);
assert (sec->alignment_power >= stdoutput->xvec->align_power_min);
mask = ((bfd_vma) 1 << (bfd_vma) sec->alignment_power) - 1;
if (size & mask)
bfd_set_section_size (stdoutput, sec, (size + mask) & ~mask);
/* @@ these should be in a "stabs.h" file, or maybe as.h */
#ifndef STAB_SECTION_NAME
@ -1190,9 +1186,10 @@ coff_frob_section (strsec)
#ifndef STAB_STRING_SECTION_NAME
#define STAB_STRING_SECTION_NAME ".stabstr"
#endif
if (strcmp (STAB_STRING_SECTION_NAME, strsec->name))
if (strcmp (STAB_STRING_SECTION_NAME, sec->name))
return;
strsec = sec;
sec = subseg_get (STAB_SECTION_NAME, 0);
/* size is already rounded up, since other section will be listed first */
size = bfd_get_section_size_before_reloc (strsec);

View File

@ -17,44 +17,24 @@
along with GAS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef OBJ_FORMAT_H
#define OBJ_FORMAT_H
#define OBJ_COFF 1
#include "targ-cpu.h"
#include "bfd.h"
/* This internal_lineno crap is to stop namespace pollution from the
bfd internal coff headerfile. */
#include "bfd.h"
#define internal_lineno bfd_internal_lineno
#include "coff/internal.h"
#undef internal_lineno
#include "../bfd/libcoff.h"
#ifdef TC_A29K
#include "coff/a29k.h"
#define TARGET_FORMAT "coff-a29k-big"
extern bfd *stdoutput;
#endif /* TC_A29K */
#ifdef TC_I960
#include "coff/i960.h"
#define TARGET_FORMAT "coff-i960-big"
#endif
#ifdef TC_I386
# include "coff/i386.h"
# define TARGET_FORMAT "coff-i386"
extern bfd *stdoutput;
#endif /* TC_I386 */
#ifdef TC_M68K
# include "coff/m68k.h"
# define TARGET_FORMAT "coff-m68k"
#endif /* TC_M68K */
#ifdef TC_PPC
#include "coff/rs6000.h"
#endif
@ -68,12 +48,35 @@ extern bfd *stdoutput;
#endif
#endif
#ifdef TC_I386
#include "coff/i386.h"
#ifndef TARGET_FORMAT
#define TARGET_FORMAT "coff-i386"
#endif
#endif
#ifdef TC_M68K
#include "coff/m68k.h"
#ifndef TARGET_FORMAT
#define TARGET_FORMAT "coff-m68k"
#endif
#endif
#ifdef TC_A29K
#include "coff/a29k.h"
#define TARGET_FORMAT "coff-a29k-big"
#endif
#ifdef TC_I960
#include "coff/i960.h"
#define TARGET_FORMAT "coff-Intel-little"
#endif
/* SYMBOL TABLE */
/* targets may also set this */
#ifndef SYMBOLS_NEED_BACKPOINTERS
#undef SYMBOLS_NEED_BACKPOINTERS
#define SYMBOLS_NEED_BACKPOINTERS 1
#endif /* SYMBOLS_NEED_BACKPOINTERS */
/* Alter the field names, for now, until we've fixed up the other
references to use the new name. */
@ -219,24 +222,8 @@ extern int coff_line_base;
#define obj_emit_lineno(WHERE,LINE,FILE_START) abort ()
extern void coff_add_linesym PARAMS ((struct symbol *));
/* stack stuff */
typedef struct
{
unsigned long chunk_size;
unsigned long element_size;
unsigned long size;
char *data;
unsigned long pointer;
}
stack;
char *stack_pop PARAMS ((stack * st));
char *stack_push PARAMS ((stack * st, char *element));
char *stack_top PARAMS ((stack * st));
stack *stack_init PARAMS ((unsigned long chunk_size,
unsigned long element_size));
void c_dot_file_symbol PARAMS ((char *filename));
void stack_delete PARAMS ((stack * st));
#ifndef tc_coff_symbol_emit_hook
void tc_coff_symbol_emit_hook PARAMS ((/* symbolS * */));
@ -272,11 +259,12 @@ hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on i
#endif /* no C_LEAFSTAT */
#endif /* TC_I960 */
/* Stabs in a coff file go into their own section. */
#define SEPARATE_STAB_SECTIONS
/* We need 12 bytes at the start of the section to hold some initial
information. */
extern void obj_coff_init_stab_section PARAMS ((segT));
#define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg)
/* end of obj-coff.h */
#endif /* OBJ_FORMAT_H */

View File

@ -108,10 +108,11 @@ static void fill_section PARAMS ((bfd * abfd,
unsigned long *));
char *s_get_name PARAMS ((symbolS * s));
static symbolS *tag_find_or_make PARAMS ((char *name));
static symbolS *tag_find PARAMS ((char *name));
static void tag_init PARAMS ((void));
static void tag_insert PARAMS ((char *name, symbolS * symbolP));
char *s_get_name PARAMS ((symbolS * s));
static int c_line_new PARAMS ((symbolS * symbol, long paddr,
unsigned short line_number,
@ -121,17 +122,6 @@ static int c_line_new PARAMS ((symbolS * symbol, long paddr,
static void w_symbols PARAMS ((bfd * abfd, char *where,
symbolS * symbol_rootP));
static char *stack_pop PARAMS ((stack * st));
static char *stack_push PARAMS ((stack * st, char *element));
#if 0
static char *stack_top PARAMS ((stack * st));
#endif
static stack *stack_init PARAMS ((unsigned long chunk_size,
unsigned long element_size));
static void tag_init PARAMS ((void));
static void tag_insert PARAMS ((char *name, symbolS * symbolP));
static void adjust_stab_section PARAMS ((bfd *abfd, segT seg));
static struct hash_control *tag_hash;
@ -139,12 +129,7 @@ static struct hash_control *tag_hash;
static symbolS *def_symbol_in_progress = NULL;
static void obj_coff_def PARAMS ((int));
static void obj_coff_lcomm PARAMS ((int));
static void obj_coff_dim PARAMS ((int));
static void obj_coff_text PARAMS ((int));
static void obj_coff_data PARAMS ((int));
static void obj_coff_bss PARAMS ((int));
static void obj_coff_ident PARAMS ((int));
static void obj_coff_endef PARAMS ((int));
static void obj_coff_line PARAMS ((int));
static void obj_coff_ln PARAMS ((int));
@ -153,6 +138,11 @@ static void obj_coff_size PARAMS ((int));
static void obj_coff_tag PARAMS ((int));
static void obj_coff_type PARAMS ((int));
static void obj_coff_val PARAMS ((int));
static void obj_coff_lcomm PARAMS ((int));
static void obj_coff_text PARAMS ((int));
static void obj_coff_data PARAMS ((int));
static void obj_coff_bss PARAMS ((int));
static void obj_coff_ident PARAMS ((int));
void obj_coff_section PARAMS ((int));
const pseudo_typeS obj_pseudo_table[] =
@ -183,9 +173,130 @@ const pseudo_typeS obj_pseudo_table[] =
#endif
{NULL} /* end sentinel */
}; /* obj_pseudo_table */
/* stack stuff */
typedef struct
{
unsigned long chunk_size;
unsigned long element_size;
unsigned long size;
char *data;
unsigned long pointer;
}
stack;
static stack *
stack_init (chunk_size, element_size)
unsigned long chunk_size;
unsigned long element_size;
{
stack *st;
st = (stack *) malloc (sizeof (stack));
if (!st)
return 0;
st->data = malloc (chunk_size);
if (!st->data)
{
free (st);
return 0;
}
st->pointer = 0;
st->size = chunk_size;
st->chunk_size = chunk_size;
st->element_size = element_size;
return st;
}
static void
stack_delete (st)
stack *st;
{
free (st->data);
free (st);
}
static char *
stack_push (st, element)
stack *st;
char *element;
{
if (st->pointer + st->element_size >= st->size)
{
st->size += st->chunk_size;
if ((st->data = xrealloc (st->data, st->size)) == (char *) 0)
return (char *) 0;
}
memcpy (st->data + st->pointer, element, st->element_size);
st->pointer += st->element_size;
return st->data + st->pointer;
}
static char *
stack_pop (st)
stack *st;
{
if (st->pointer < st->element_size)
{
st->pointer = 0;
return (char *) 0;
}
st->pointer -= st->element_size;
return st->data + st->pointer;
}
/*
* Maintain a list of the tagnames of the structres.
*/
static void
tag_init ()
{
tag_hash = hash_new ();
}
static void
tag_insert (name, symbolP)
char *name;
symbolS *symbolP;
{
const char *error_string;
if ((error_string = hash_jam (tag_hash, name, (char *) symbolP)))
{
as_fatal ("Inserting \"%s\" into structure table failed: %s",
name, error_string);
}
}
static symbolS *
tag_find_or_make (name)
char *name;
{
symbolS *symbolP;
if ((symbolP = tag_find (name)) == NULL)
{
symbolP = symbol_new (name, undefined_section,
0, &zero_address_frag);
tag_insert (S_GET_NAME (symbolP), symbolP);
} /* not found */
return symbolP;
}
static symbolS *
tag_find (name)
char *name;
{
#ifdef STRIP_UNDERSCORE
if (*name == '_')
name++;
#endif /* STRIP_UNDERSCORE */
return (symbolS *) hash_find (tag_hash, name);
}
/* Section stuff
We allow more than just the standard 3 sections, infact, we allow
@ -195,18 +306,6 @@ const pseudo_typeS obj_pseudo_table[] =
*/
/* OBS stuff
static struct internal_scnhdr bss_section_header;
struct internal_scnhdr data_section_header;
struct internal_scnhdr text_section_header;
const segT N_TYPE_seg [32] =
{
};
*/
#define N_SEG 32
typedef struct
{
@ -250,9 +349,9 @@ seg_info_type seg_info_off_by_4[N_SEG] =
static relax_addressT
DEFUN (relax_align, (address, alignment),
register relax_addressT address AND
register long alignment)
relax_align (address, alignment)
relax_addressT address;
long alignment;
{
relax_addressT mask;
relax_addressT new_address;
@ -264,8 +363,8 @@ DEFUN (relax_align, (address, alignment),
segT
DEFUN (s_get_segment, (x),
symbolS * x)
s_get_segment (x)
symbolS * x;
{
return SEG_INFO_FROM_SECTION_NUMBER (x->sy_symbol.ost_entry.n_scnum).seg_t;
}
@ -275,9 +374,9 @@ DEFUN (s_get_segment, (x),
/* calculate the size of the frag chain and fill in the section header
to contain all of it, also fill in the addr of the sections */
static unsigned int
DEFUN (size_section, (abfd, idx),
bfd * abfd AND
unsigned int idx)
size_section (abfd, idx)
bfd * abfd;
unsigned int idx;
{
unsigned int size = 0;
@ -319,8 +418,8 @@ DEFUN (size_section, (abfd, idx),
static unsigned int
DEFUN (count_entries_in_chain, (idx),
unsigned int idx)
count_entries_in_chain (idx)
unsigned int idx;
{
unsigned int nrelocs;
fixS *fixup_ptr;
@ -349,10 +448,10 @@ DEFUN (count_entries_in_chain, (idx),
/* output all the relocations for a section */
void
DEFUN (do_relocs_for, (abfd, h, file_cursor),
bfd * abfd AND
object_headers * h AND
unsigned long *file_cursor)
do_relocs_for (abfd, h, file_cursor)
bfd * abfd;
object_headers * h;
unsigned long *file_cursor;
{
unsigned int nrelocs;
unsigned int idx;
@ -476,10 +575,10 @@ DEFUN (do_relocs_for, (abfd, h, file_cursor),
in the scnhdrs with the info on the file postions
*/
static void
DEFUN (fill_section, (abfd, h, file_cursor),
bfd * abfd AND
object_headers *h AND
unsigned long *file_cursor)
fill_section (abfd, h, file_cursor)
bfd * abfd;
object_headers *h;
unsigned long *file_cursor;
{
unsigned int i;
@ -604,9 +703,9 @@ DEFUN (fill_section, (abfd, h, file_cursor),
/* Coff file generation & utilities */
static void
DEFUN (coff_header_append, (abfd, h),
bfd * abfd AND
object_headers * h)
coff_header_append (abfd, h)
bfd * abfd;
object_headers * h;
{
unsigned int i;
char buffer[1000];
@ -646,19 +745,19 @@ DEFUN (coff_header_append, (abfd, h),
char *
DEFUN (symbol_to_chars, (abfd, where, symbolP),
bfd * abfd AND
char *where AND
symbolS * symbolP)
symbol_to_chars (abfd, where, symbolP)
bfd * abfd;
char *where;
symbolS * symbolP;
{
unsigned int numaux = symbolP->sy_symbol.ost_entry.n_numaux;
unsigned int i;
valueT val;
/* Turn any symbols with register attributes into abs symbols */
if (S_GET_SEGMENT (symbolP) == SEG_REGISTER)
if (S_GET_SEGMENT (symbolP) == reg_section)
{
S_SET_SEGMENT (symbolP, SEG_ABSOLUTE);
S_SET_SEGMENT (symbolP, absolute_section);
}
/* At the same time, relocate all symbols to their output value */
@ -684,7 +783,6 @@ DEFUN (symbol_to_chars, (abfd, where, symbolP),
}
void
obj_symbol_new_hook (symbolP)
symbolS *symbolP;
@ -708,75 +806,6 @@ obj_symbol_new_hook (symbolP)
SF_SET_LOCAL (symbolP);
}
/* stack stuff */
static stack *
stack_init (chunk_size, element_size)
unsigned long chunk_size;
unsigned long element_size;
{
stack *st;
if ((st = (stack *) malloc (sizeof (stack))) == (stack *) 0)
return (stack *) 0;
if ((st->data = malloc (chunk_size)) == (char *) 0)
{
free (st);
return (stack *) 0;
}
st->pointer = 0;
st->size = chunk_size;
st->chunk_size = chunk_size;
st->element_size = element_size;
return st;
} /* stack_init() */
void
stack_delete (st)
stack *st;
{
free (st->data);
free (st);
}
static char *
stack_push (st, element)
stack *st;
char *element;
{
if (st->pointer + st->element_size >= st->size)
{
st->size += st->chunk_size;
if ((st->data = xrealloc (st->data, st->size)) == (char *) 0)
return (char *) 0;
}
memcpy (st->data + st->pointer, element, st->element_size);
st->pointer += st->element_size;
return st->data + st->pointer;
} /* stack_push() */
static char *
stack_pop (st)
stack *st;
{
if (st->pointer < st->element_size)
{
st->pointer = 0;
return (char *) 0;
}
st->pointer -= st->element_size;
return st->data + st->pointer;
}
#if 0
/* Not used. */
static char *
stack_top (st)
stack *st;
{
return st->data + st->pointer - st->element_size;
}
#endif
/*
* Handle .ln directives.
*/
@ -834,16 +863,13 @@ obj_coff_ln (appline)
input_line_pointer++;
static void
DEFUN (obj_coff_def, (what),
int what)
obj_coff_def (what)
int what;
{
char name_end; /* Char after the end of name */
char *symbol_name; /* Name of the debug symbol */
char *symbol_name_copy; /* Temporary copy of the name */
unsigned int symbol_name_length;
/*$char* directiveP;$ *//* Name of the pseudo opcode */
/*$char directive[MAX_DIRECTIVE];$ *//* Backup of the directive */
/*$char end = 0;$ *//* If 1, stop parsing */
if (def_symbol_in_progress != NULL)
{
@ -878,9 +904,7 @@ DEFUN (obj_coff_def, (what),
S_SET_VALUE (def_symbol_in_progress, 0);
if (S_IS_STRING (def_symbol_in_progress))
{
SF_SET_STRING (def_symbol_in_progress);
} /* "long" name */
SF_SET_STRING (def_symbol_in_progress);
*input_line_pointer = name_end;
@ -956,7 +980,7 @@ obj_coff_endef (ignore)
case C_FIELD:
case C_EOS:
SF_SET_DEBUG (def_symbol_in_progress);
S_SET_SEGMENT (def_symbol_in_progress, SEG_ABSOLUTE);
S_SET_SEGMENT (def_symbol_in_progress, absolute_section);
break;
case C_EXT:
@ -974,7 +998,7 @@ obj_coff_endef (ignore)
/* Now that we have built a debug symbol, try to find if we should
merge with an existing symbol or not. If a symbol is C_EFCN or
SEG_ABSOLUTE or untagged SEG_DEBUG it never merges. We also
absolute_section or untagged SEG_DEBUG it never merges. We also
don't merge labels, which are in a different namespace, nor
symbols which have not yet been defined since they are typically
unique, nor do we merge tags with non-tags. */
@ -995,7 +1019,7 @@ obj_coff_endef (ignore)
|| S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_LABEL
|| (S_GET_SEGMENT (def_symbol_in_progress) == SEG_DEBUG
&& !SF_GET_TAG (def_symbol_in_progress))
|| S_GET_SEGMENT (def_symbol_in_progress) == SEG_ABSOLUTE
|| S_GET_SEGMENT (def_symbol_in_progress) == absolute_section
|| def_symbol_in_progress->sy_value.X_op != O_constant
|| (symbolP = symbol_find_base (S_GET_NAME (def_symbol_in_progress), DO_NOT_STRIP)) == NULL
|| (SF_GET_TAG (def_symbol_in_progress) != SF_GET_TAG (symbolP)))
@ -1006,9 +1030,9 @@ obj_coff_endef (ignore)
else
{
/* This symbol already exists, merge the newly created symbol
into the This is not mandatory. The linker can handle
duplicate symbols correctly. But I guess that it save a *lot*
of space if the assembly file defines a lot of
into the old one. This is not mandatory. The linker can
handle duplicate symbols correctly. But I guess that it save
a *lot* of space if the assembly file defines a lot of
symbols. [loic] */
/* The debug entry (def_symbol_in_progress) is merged into the
@ -1065,7 +1089,7 @@ static void
obj_coff_dim (ignore)
int ignore;
{
register int dim_index;
int dim_index;
if (def_symbol_in_progress == NULL)
{
@ -1079,11 +1103,11 @@ obj_coff_dim (ignore)
for (dim_index = 0; dim_index < DIMNUM; dim_index++)
{
SKIP_WHITESPACES ();
SA_SET_SYM_DIMEN (def_symbol_in_progress, dim_index, get_absolute_expression ());
SA_SET_SYM_DIMEN (def_symbol_in_progress, dim_index,
get_absolute_expression ());
switch (*input_line_pointer)
{
case ',':
input_line_pointer++;
break;
@ -1095,8 +1119,8 @@ obj_coff_dim (ignore)
case ';':
dim_index = DIMNUM;
break;
} /* switch on following character */
} /* for each dimension */
}
}
demand_empty_rest_of_line ();
}
@ -1111,7 +1135,7 @@ obj_coff_line (ignore)
{
obj_coff_ln (0);
return;
} /* if it looks like a stabs style line */
}
this_base = get_absolute_expression ();
if (this_base > line_base)
@ -1177,15 +1201,16 @@ obj_coff_tag (ignore)
as_warn (".tag pseudo-op used outside of .def/.endef ignored.");
demand_empty_rest_of_line ();
return;
} /* if not inside .def/.endef */
}
S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1);
symbol_name = input_line_pointer;
name_end = get_symbol_end ();
/* Assume that the symbol referred to by .tag is always defined. */
/* This was a bad assumption. I've added find_or_make. xoxorich. */
SA_SET_SYM_TAGNDX (def_symbol_in_progress, (long) tag_find_or_make (symbol_name));
/* Assume that the symbol referred to by .tag is always defined.
This was a bad assumption. I've added find_or_make. xoxorich. */
SA_SET_SYM_TAGNDX (def_symbol_in_progress,
(long) tag_find_or_make (symbol_name));
if (SA_GET_SYM_TAGNDX (def_symbol_in_progress) == 0L)
{
as_warn ("tag not found for .tag %s", symbol_name);
@ -1279,60 +1304,6 @@ obj_coff_val (ignore)
demand_empty_rest_of_line ();
}
/*
* Maintain a list of the tagnames of the structres.
*/
static void
tag_init ()
{
tag_hash = hash_new ();
}
static void
tag_insert (name, symbolP)
char *name;
symbolS *symbolP;
{
register const char *error_string;
if ((error_string = hash_jam (tag_hash, name, (char *) symbolP)))
{
as_fatal ("Inserting \"%s\" into structure table failed: %s",
name, error_string);
}
}
static symbolS *
tag_find_or_make (name)
char *name;
{
symbolS *symbolP;
if ((symbolP = tag_find (name)) == NULL)
{
symbolP = symbol_new (name,
SEG_UNKNOWN,
0,
&zero_address_frag);
tag_insert (S_GET_NAME (symbolP), symbolP);
} /* not found */
return (symbolP);
} /* tag_find_or_make() */
static symbolS *
tag_find (name)
char *name;
{
#ifdef STRIP_UNDERSCORE
if (*name == '_')
name++;
#endif /* STRIP_UNDERSCORE */
return ((symbolS *) hash_find (tag_hash, name));
} /* tag_find() */
void
obj_read_begin_hook ()
{
@ -1356,7 +1327,7 @@ symbolS *last_functionP = NULL;
symbolS *last_tagP;
static unsigned int
DEFUN_VOID (yank_symbols)
yank_symbols ()
{
symbolS *symbolP;
unsigned int symbol_number = 0;
@ -1548,7 +1519,7 @@ DEFUN_VOID (yank_symbols)
static unsigned int
DEFUN_VOID (glue_symbols)
glue_symbols ()
{
unsigned int symbol_number = 0;
symbolS *symbolP;
@ -1579,7 +1550,7 @@ DEFUN_VOID (glue_symbols)
}
static unsigned int
DEFUN_VOID (tie_tags)
tie_tags ()
{
unsigned int symbol_number = 0;
@ -1605,9 +1576,9 @@ DEFUN_VOID (tie_tags)
}
static void
DEFUN (crawl_symbols, (h, abfd),
object_headers *h AND
bfd * abfd)
crawl_symbols (h, abfd)
object_headers *h;
bfd * abfd;
{
unsigned int i;
@ -1666,8 +1637,8 @@ DEFUN (crawl_symbols, (h, abfd),
*/
void
DEFUN (w_strings, (where),
char *where)
w_strings (where)
char *where;
{
symbolS *symbolP;
@ -1692,10 +1663,10 @@ DEFUN (w_strings, (where),
}
static void
DEFUN (do_linenos_for, (abfd, h, file_cursor),
bfd * abfd AND
object_headers * h AND
unsigned long *file_cursor)
do_linenos_for (abfd, h, file_cursor)
bfd * abfd;
object_headers * h;
unsigned long *file_cursor;
{
unsigned int idx;
unsigned long start = *file_cursor;
@ -1756,7 +1727,7 @@ DEFUN (do_linenos_for, (abfd, h, file_cursor),
list, as if the seg 0 was extra long */
static void
DEFUN_VOID (remove_subsegs)
remove_subsegs ()
{
unsigned int i;
@ -1779,7 +1750,7 @@ DEFUN_VOID (remove_subsegs)
unsigned long machine;
int coff_flags;
extern void
DEFUN_VOID (write_object_file)
write_object_file ()
{
int i;
char *name;
@ -2131,11 +2102,11 @@ c_symbol_merge (debug, normal)
} /* c_symbol_merge() */
static int
DEFUN (c_line_new, (symbol, paddr, line_number, frag),
symbolS * symbol AND
long paddr AND
unsigned short line_number AND
fragS * frag)
c_line_new (symbol, paddr, line_number, frag)
symbolS * symbol;
long paddr;
unsigned short line_number;
fragS * frag;
{
struct lineno_list *new_line =
(struct lineno_list *) xmalloc (sizeof (struct lineno_list));
@ -2238,10 +2209,10 @@ c_section_symbol (name, idx)
} /* c_section_symbol() */
static void
DEFUN (w_symbols, (abfd, where, symbol_rootP),
bfd * abfd AND
char *where AND
symbolS * symbol_rootP)
w_symbols (abfd, where, symbol_rootP)
bfd * abfd;
char *where;
symbolS * symbol_rootP;
{
symbolS *symbolP;
unsigned int i;
@ -2357,10 +2328,10 @@ obj_coff_lcomm (ignore)
}
static void
DEFUN (fixup_mdeps, (frags, h, this_segment),
fragS * frags AND
object_headers * h AND
segT this_segment)
fixup_mdeps (frags, h, this_segment)
fragS * frags;
object_headers * h;
segT this_segment;
{
subseg_change (this_segment, 0);
while (frags)
@ -2386,9 +2357,9 @@ DEFUN (fixup_mdeps, (frags, h, this_segment),
#if 1
static void
DEFUN (fixup_segment, (segP, this_segment_type),
segment_info_type * segP AND
segT this_segment_type)
fixup_segment (segP, this_segment_type)
segment_info_type * segP;
segT this_segment_type;
{
register fixS * fixP;
register symbolS *add_symbolP;
@ -2399,7 +2370,7 @@ DEFUN (fixup_segment, (segP, this_segment_type),
register long where;
register char pcrel;
register fragS *fragP;
register segT add_symbol_segment = SEG_ABSOLUTE;
register segT add_symbol_segment = absolute_section;
for (fixP = segP->fix_root; fixP; fixP = fixP->fx_next)
@ -2439,7 +2410,7 @@ DEFUN (fixup_segment, (segP, this_segment_type),
if (!add_symbolP)
{
/* Its just -sym */
if (S_GET_SEGMENT (sub_symbolP) != SEG_ABSOLUTE)
if (S_GET_SEGMENT (sub_symbolP) != absolute_section)
{
as_bad ("Negative of non-absolute symbol %s", S_GET_NAME (sub_symbolP));
} /* not absolute */
@ -2452,7 +2423,7 @@ DEFUN (fixup_segment, (segP, this_segment_type),
}
else if ((S_GET_SEGMENT (sub_symbolP) == add_symbol_segment)
&& (SEG_NORMAL (add_symbol_segment)
|| (add_symbol_segment == SEG_ABSOLUTE)))
|| (add_symbol_segment == absolute_section)))
{
/* Difference of 2 symbols from same segment. Can't
make difference of 2 undefineds: 'value' means
@ -2475,9 +2446,9 @@ DEFUN (fixup_segment, (segP, this_segment_type),
else
{
/* Different segments in subtraction. */
know (!(S_IS_EXTERNAL (sub_symbolP) && (S_GET_SEGMENT (sub_symbolP) == SEG_ABSOLUTE)));
know (!(S_IS_EXTERNAL (sub_symbolP) && (S_GET_SEGMENT (sub_symbolP) == absolute_section)));
if ((S_GET_SEGMENT (sub_symbolP) == SEG_ABSOLUTE))
if ((S_GET_SEGMENT (sub_symbolP) == absolute_section))
{
add_number -= S_GET_VALUE (sub_symbolP);
}
@ -2537,7 +2508,7 @@ DEFUN (fixup_segment, (segP, this_segment_type),
{
switch (add_symbol_segment)
{
case SEG_ABSOLUTE:
case absolute_section:
#ifdef TC_I960
reloc_callj (fixP); /* See comment about reloc_callj() above*/
#endif /* TC_I960 */

View File

@ -62,13 +62,6 @@
#define TARGET_FORMAT "coff-sh"
#endif
#ifdef TC_M68K
#include "coff/m68k.h"
#ifndef TARGET_FORMAT
#define TARGET_FORMAT "coff-m68k"
#endif
#endif
#ifdef TC_M88K
#include "coff/m88k.h"
#define TARGET_FORMAT "coff-m88kbcs"
@ -81,6 +74,13 @@
#endif
#endif
#ifdef TC_M68K
#include "coff/m68k.h"
#ifndef TARGET_FORMAT
#define TARGET_FORMAT "coff-m68k"
#endif
#endif
#ifdef TC_A29K
#include "coff/a29k.h"
#define TARGET_FORMAT "coff-a29k-big"
@ -120,21 +120,20 @@ extern const segT N_TYPE_seg[];
/* SYMBOL TABLE */
/* targets may also set this */
#ifndef SYMBOLS_NEED_BACKPOINTERS
#undef SYMBOLS_NEED_BACKPOINTERS
#define SYMBOLS_NEED_BACKPOINTERS 1
#endif /* SYMBOLS_NEED_BACKPOINTERS */
/* Symbol table entry data type */
typedef struct
{
struct internal_syment ost_entry; /* Basic symbol */
union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
unsigned int ost_flags; /* obj_coff internal use only flags */
}
obj_symbol_type;
/* Basic symbol */
struct internal_syment ost_entry;
/* Auxiliary entry. */
union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES];
/* obj_coff internal use only flags */
unsigned int ost_flags;
} obj_symbol_type;
#ifndef DO_NOT_STRIP
#define DO_NOT_STRIP 0
@ -227,46 +226,32 @@ obj_symbol_type;
/* Auxiliary entry macros. SA_ stands for symbol auxiliary */
/* Omit the tv related fields */
/* Accessors */
#ifdef BFD_HEADERS
#define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx.l)
#else
#define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx)
#endif
#define SA_GET_SYM_LNNO(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno)
#define SA_GET_SYM_SIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size)
#define SA_GET_SYM_FSIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize)
#define SA_GET_SYM_LNNOPTR(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr)
#ifdef BFD_HEADERS
#define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx.l)
#else
#define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx)
#endif
#define SA_GET_SYM_DIMEN(s,i) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)])
#define SA_GET_FILE_FNAME(s) ((s)->sy_symbol.ost_auxent[0].x_file.x_fname)
#define SA_GET_SCN_SCNLEN(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen)
#define SA_GET_SCN_NRELOC(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc)
#define SA_GET_SCN_NLINNO(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno)
#define SYM_AUXENT(S) (&(S)->sy_symbol.ost_auxent[0])
#define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx.l)
#define SA_GET_SYM_LNNO(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno)
#define SA_GET_SYM_SIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size)
#define SA_GET_SYM_FSIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize)
#define SA_GET_SYM_LNNOPTR(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#define SA_GET_SYM_ENDNDX(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx.l)
#define SA_GET_SYM_DIMEN(s,i) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)])
#define SA_GET_FILE_FNAME(s) (SYM_AUXENT (s)->x_file.x_fname)
#define SA_GET_SCN_SCNLEN(s) (SYM_AUXENT (s)->x_scn.x_scnlen)
#define SA_GET_SCN_NRELOC(s) (SYM_AUXENT (s)->x_scn.x_nreloc)
#define SA_GET_SCN_NLINNO(s) (SYM_AUXENT (s)->x_scn.x_nlinno)
/* Modifiers */
#ifdef BFD_HEADERS
#define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx.l=(v))
#else
#define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx=(v))
#endif
#define SA_SET_SYM_LNNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno=(v))
#define SA_SET_SYM_SIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size=(v))
#define SA_SET_SYM_FSIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize=(v))
#define SA_SET_SYM_LNNOPTR(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
#ifdef BFD_HEADERS
#define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx.l=(v))
#else
#define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx=(v))
#endif
#define SA_SET_SYM_DIMEN(s,i,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
#define SA_SET_FILE_FNAME(s,v) strncpy((s)->sy_symbol.ost_auxent[0].x_file.x_fname,(v),FILNMLEN)
#define SA_SET_SCN_SCNLEN(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen=(v))
#define SA_SET_SCN_NRELOC(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc=(v))
#define SA_SET_SCN_NLINNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno=(v))
#define SA_SET_SYM_TAGNDX(s,v) (SYM_AUXENT (s)->x_sym.x_tagndx.l=(v))
#define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno=(v))
#define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size=(v))
#define SA_SET_SYM_FSIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize=(v))
#define SA_SET_SYM_LNNOPTR(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
#define SA_SET_SYM_ENDNDX(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx.l=(v))
#define SA_SET_SYM_DIMEN(s,i,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
#define SA_SET_FILE_FNAME(s,v) strncpy(SYM_AUXENT (s)->x_file.x_fname,(v),FILNMLEN)
#define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen=(v))
#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc=(v))
#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v))
/*
* Internal use only definitions. SF_ stands for symbol flags.
@ -303,46 +288,46 @@ obj_symbol_type;
/* Accessors */
#define SF_GET(s) ((s)->sy_symbol.ost_flags)
#define SF_GET_NORMAL_FIELD(s) ((s)->sy_symbol.ost_flags & SF_NORMAL_MASK)
#define SF_GET_DEBUG_FIELD(s) ((s)->sy_symbol.ost_flags & SF_DEBUG_MASK)
#define SF_GET_FILE(s) ((s)->sy_symbol.ost_flags & SF_FILE)
#define SF_GET_STATICS(s) ((s)->sy_symbol.ost_flags & SF_STATICS)
#define SF_GET_DEFINED(s) ((s)->sy_symbol.ost_flags & SF_DEFINED)
#define SF_GET_STRING(s) ((s)->sy_symbol.ost_flags & SF_STRING)
#define SF_GET_LOCAL(s) ((s)->sy_symbol.ost_flags & SF_LOCAL)
#define SF_GET_FUNCTION(s) ((s)->sy_symbol.ost_flags & SF_FUNCTION)
#define SF_GET_PROCESS(s) ((s)->sy_symbol.ost_flags & SF_PROCESS)
#define SF_GET_DEBUG(s) ((s)->sy_symbol.ost_flags & SF_DEBUG)
#define SF_GET_TAGGED(s) ((s)->sy_symbol.ost_flags & SF_TAGGED)
#define SF_GET_TAG(s) ((s)->sy_symbol.ost_flags & SF_TAG)
#define SF_GET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags & SF_GET_SEGMENT)
#define SF_GET_I960(s) ((s)->sy_symbol.ost_flags & SF_I960_MASK) /* used by i960 */
#define SF_GET_BALNAME(s) ((s)->sy_symbol.ost_flags & SF_BALNAME) /* used by i960 */
#define SF_GET_CALLNAME(s) ((s)->sy_symbol.ost_flags & SF_CALLNAME) /* used by i960 */
#define SF_GET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_IS_SYSPROC) /* used by i960 */
#define SF_GET_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_SYSPROC) /* used by i960 */
#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)
#define SF_GET_STATICS(s) (SF_GET (s) & SF_STATICS)
#define SF_GET_DEFINED(s) (SF_GET (s) & SF_DEFINED)
#define SF_GET_STRING(s) (SF_GET (s) & SF_STRING)
#define SF_GET_LOCAL(s) (SF_GET (s) & SF_LOCAL)
#define SF_GET_FUNCTION(s) (SF_GET (s) & SF_FUNCTION)
#define SF_GET_PROCESS(s) (SF_GET (s) & SF_PROCESS)
#define SF_GET_DEBUG(s) (SF_GET (s) & SF_DEBUG)
#define SF_GET_TAGGED(s) (SF_GET (s) & SF_TAGGED)
#define SF_GET_TAG(s) (SF_GET (s) & SF_TAG)
#define SF_GET_GET_SEGMENT(s) (SF_GET (s) & SF_GET_SEGMENT)
#define SF_GET_I960(s) (SF_GET (s) & SF_I960_MASK) /* used by i960 */
#define SF_GET_BALNAME(s) (SF_GET (s) & SF_BALNAME) /* used by i960 */
#define SF_GET_CALLNAME(s) (SF_GET (s) & SF_CALLNAME) /* used by i960 */
#define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* used by i960 */
#define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* used by i960 */
/* Modifiers */
#define SF_SET(s,v) ((s)->sy_symbol.ost_flags = (v))
#define SF_SET_NORMAL_FIELD(s,v)((s)->sy_symbol.ost_flags |= ((v) & SF_NORMAL_MASK))
#define SF_SET_DEBUG_FIELD(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_DEBUG_MASK))
#define SF_SET_FILE(s) ((s)->sy_symbol.ost_flags |= SF_FILE)
#define SF_SET_STATICS(s) ((s)->sy_symbol.ost_flags |= SF_STATICS)
#define SF_SET_DEFINED(s) ((s)->sy_symbol.ost_flags |= SF_DEFINED)
#define SF_SET_STRING(s) ((s)->sy_symbol.ost_flags |= SF_STRING)
#define SF_SET_LOCAL(s) ((s)->sy_symbol.ost_flags |= SF_LOCAL)
#define SF_CLEAR_LOCAL(s) ((s)->sy_symbol.ost_flags &= ~SF_LOCAL)
#define SF_SET_FUNCTION(s) ((s)->sy_symbol.ost_flags |= SF_FUNCTION)
#define SF_SET_PROCESS(s) ((s)->sy_symbol.ost_flags |= SF_PROCESS)
#define SF_SET_DEBUG(s) ((s)->sy_symbol.ost_flags |= SF_DEBUG)
#define SF_SET_TAGGED(s) ((s)->sy_symbol.ost_flags |= SF_TAGGED)
#define SF_SET_TAG(s) ((s)->sy_symbol.ost_flags |= SF_TAG)
#define SF_SET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags |= SF_GET_SEGMENT)
#define SF_SET_I960(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_I960_MASK)) /* used by i960 */
#define SF_SET_BALNAME(s) ((s)->sy_symbol.ost_flags |= SF_BALNAME) /* used by i960 */
#define SF_SET_CALLNAME(s) ((s)->sy_symbol.ost_flags |= SF_CALLNAME) /* used by i960 */
#define SF_SET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags |= SF_IS_SYSPROC) /* used by i960 */
#define SF_SET_SYSPROC(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_SYSPROC)) /* used by i960 */
#define SF_SET(s,v) (SF_GET (s) = (v))
#define SF_SET_NORMAL_FIELD(s,v)(SF_GET (s) |= ((v) & SF_NORMAL_MASK))
#define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK))
#define SF_SET_FILE(s) (SF_GET (s) |= SF_FILE)
#define SF_SET_STATICS(s) (SF_GET (s) |= SF_STATICS)
#define SF_SET_DEFINED(s) (SF_GET (s) |= SF_DEFINED)
#define SF_SET_STRING(s) (SF_GET (s) |= SF_STRING)
#define SF_SET_LOCAL(s) (SF_GET (s) |= SF_LOCAL)
#define SF_CLEAR_LOCAL(s) (SF_GET (s) &= ~SF_LOCAL)
#define SF_SET_FUNCTION(s) (SF_GET (s) |= SF_FUNCTION)
#define SF_SET_PROCESS(s) (SF_GET (s) |= SF_PROCESS)
#define SF_SET_DEBUG(s) (SF_GET (s) |= SF_DEBUG)
#define SF_SET_TAGGED(s) (SF_GET (s) |= SF_TAGGED)
#define SF_SET_TAG(s) (SF_GET (s) |= SF_TAG)
#define SF_SET_GET_SEGMENT(s) (SF_GET (s) |= SF_GET_SEGMENT)
#define SF_SET_I960(s,v) (SF_GET (s) |= ((v) & SF_I960_MASK)) /* used by i960 */
#define SF_SET_BALNAME(s) (SF_GET (s) |= SF_BALNAME) /* used by i960 */
#define SF_SET_CALLNAME(s) (SF_GET (s) |= SF_CALLNAME) /* used by i960 */
#define SF_SET_IS_SYSPROC(s) (SF_GET (s) |= SF_IS_SYSPROC) /* used by i960 */
#define SF_SET_SYSPROC(s,v) (SF_GET (s) |= ((v) & SF_SYSPROC)) /* used by i960 */
/* File header macro and type definition */
@ -449,29 +434,21 @@ obj_symbol_type;
/* Segment flipping */
typedef struct
{
#ifdef BFD_HEADERS
struct internal_aouthdr aouthdr; /* a.out header */
struct internal_filehdr filehdr; /* File header, not machine dep. */
#else
AOUTHDR aouthdr; /* a.out header */
FILHDR filehdr; /* File header, not machine dep. */
#endif
long string_table_size; /* names + '\0' + sizeof(int) */
long relocation_size; /* Cumulated size of relocation
information for all sections in
bytes. */
long lineno_size; /* Size of the line number information
table in bytes */
}
object_headers;
{
struct internal_aouthdr aouthdr; /* a.out header */
struct internal_filehdr filehdr; /* File header, not machine dep. */
long string_table_size; /* names + '\0' + sizeof(int) */
long relocation_size; /* Cumulated size of relocation
information for all sections in
bytes. */
long lineno_size; /* Size of the line number information
table in bytes */
} object_headers;
struct lineno_list
{
struct bfd_internal_lineno line;
char *frag; /* Frag to which the line number is related */
struct lineno_list *next; /* Forward chain pointer */
@ -480,18 +457,6 @@ struct lineno_list
/* stack stuff */
typedef struct
{
unsigned long chunk_size;
unsigned long element_size;
unsigned long size;
char *data;
unsigned long pointer;
}
stack;
#define obj_segment_name(i) (segment_info[(int) (i)].scnhdr.s_name)
#define obj_add_segment(s) obj_coff_add_segment (s)
@ -502,7 +467,6 @@ extern void obj_coff_section PARAMS ((int));
extern void c_dot_file_symbol PARAMS ((char *filename));
extern void obj_extra_stuff PARAMS ((object_headers * headers));
extern void stack_delete PARAMS ((stack * st));
extern segT s_get_segment PARAMS ((struct symbol * ptr));
@ -525,13 +489,8 @@ extern void c_section_header PARAMS ((struct internal_scnhdr * header,
hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on it.
#endif /* no C_LEAFSTAT */
#endif /* TC_I960 */
#ifdef BFD_HEADERS
extern struct internal_scnhdr data_section_header;
extern struct internal_scnhdr text_section_header;
#else
extern SCNHDR data_section_header;
extern SCNHDR text_section_header;
#endif
/* Forward the segment of a forwarded symbol. */
#define obj_frob_forward_symbol(symp) \
@ -539,15 +498,12 @@ extern SCNHDR text_section_header;
? (S_SET_SEGMENT (symp, S_GET_SEGMENT (symp->sy_value.X_add_symbol)), 0) \
: 0)
/* Stabs in a coff file go into their own section. */
/* Stabs in a coff file go into their own section. */
#define SEPARATE_STAB_SECTIONS
/* We need 12 bytes at the start of the section to hold some initial
information. */
extern void obj_coff_init_stab_section PARAMS ((segT));
#define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg)
#endif /* OBJ_FORMAT_H */