*** empty log message ***
This commit is contained in:
parent
4e41b5aa40
commit
4fed881829
1 changed files with 270 additions and 262 deletions
|
@ -156,10 +156,10 @@ const pseudo_typeS obj_pseudo_table[] = {
|
||||||
{ "type", obj_coff_type, 0 },
|
{ "type", obj_coff_type, 0 },
|
||||||
{ "val", obj_coff_val, 0 },
|
{ "val", obj_coff_val, 0 },
|
||||||
{ "section", obj_coff_section, 0 },
|
{ "section", obj_coff_section, 0 },
|
||||||
{ "text", obj_coff_text, 0 },
|
{ "text", obj_coff_text, 0 },
|
||||||
{ "data", obj_coff_data, 0 },
|
{ "data", obj_coff_data, 0 },
|
||||||
|
/* we don't yet handle this. */
|
||||||
{ "ident", s_ignore, 0 }, /* we don't yet handle this. */
|
{ "ident", s_ignore, 0 },
|
||||||
{ "ABORT", s_abort, 0 },
|
{ "ABORT", s_abort, 0 },
|
||||||
{ "lcomm", obj_coff_lcomm, 0},
|
{ "lcomm", obj_coff_lcomm, 0},
|
||||||
{ NULL} /* end sentinel */
|
{ NULL} /* end sentinel */
|
||||||
|
@ -419,74 +419,75 @@ static void DEFUN(fill_section,(abfd, filehdr, file_cursor),
|
||||||
unsigned long *file_cursor)
|
unsigned long *file_cursor)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int paddr = 0;
|
unsigned int paddr = 0;
|
||||||
|
|
||||||
for (i = SEG_E0; i < SEG_UNKNOWN; i++) {
|
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
|
||||||
unsigned int offset = 0;
|
{
|
||||||
|
unsigned int offset = 0;
|
||||||
|
|
||||||
|
struct internal_scnhdr *s = &( segment_info[i].scnhdr);
|
||||||
struct internal_scnhdr *s = &( segment_info[i].scnhdr);
|
|
||||||
|
|
||||||
if (s->s_name[0]) {
|
if (s->s_name[0])
|
||||||
fragS *frag = segment_info[i].frchainP->frch_root;
|
{
|
||||||
char *buffer = malloc(s->s_size);
|
fragS *frag = segment_info[i].frchainP->frch_root;
|
||||||
s->s_scnptr = *file_cursor;
|
char *buffer = malloc(s->s_size);
|
||||||
s->s_paddr = paddr;
|
s->s_scnptr = *file_cursor;
|
||||||
s->s_vaddr = paddr;
|
s->s_paddr = paddr;
|
||||||
|
s->s_vaddr = paddr;
|
||||||
|
|
||||||
s->s_flags = STYP_REG;
|
s->s_flags = STYP_REG;
|
||||||
if (strcmp(s->s_name,".text")==0)
|
if (strcmp(s->s_name,".text")==0)
|
||||||
s->s_flags |= STYP_TEXT;
|
s->s_flags |= STYP_TEXT;
|
||||||
else if (strcmp(s->s_name,".data")==0)
|
else if (strcmp(s->s_name,".data")==0)
|
||||||
s->s_flags |= STYP_DATA;
|
s->s_flags |= STYP_DATA;
|
||||||
else if (strcmp(s->s_name,".bss")==0)
|
else if (strcmp(s->s_name,".bss")==0)
|
||||||
s->s_flags |= STYP_BSS | STYP_NOLOAD;
|
s->s_flags |= STYP_BSS | STYP_NOLOAD;
|
||||||
|
|
||||||
while (frag) {
|
while (frag) {
|
||||||
unsigned int fill_size;
|
unsigned int fill_size;
|
||||||
switch (frag->fr_type) {
|
switch (frag->fr_type) {
|
||||||
|
|
||||||
case rs_fill:
|
case rs_fill:
|
||||||
case rs_align:
|
case rs_align:
|
||||||
case rs_org:
|
case rs_org:
|
||||||
if(frag->fr_fix)
|
if(frag->fr_fix)
|
||||||
{
|
{
|
||||||
memcpy(buffer + frag->fr_address,
|
memcpy(buffer + frag->fr_address,
|
||||||
frag->fr_literal,
|
frag->fr_literal,
|
||||||
frag->fr_fix);
|
frag->fr_fix);
|
||||||
offset += frag->fr_fix;
|
offset += frag->fr_fix;
|
||||||
}
|
}
|
||||||
|
|
||||||
fill_size = frag->fr_var;
|
fill_size = frag->fr_var;
|
||||||
if (fill_size)
|
if (fill_size)
|
||||||
{
|
{
|
||||||
unsigned int count ;
|
unsigned int count ;
|
||||||
unsigned int off = frag->fr_fix;
|
unsigned int off = frag->fr_fix;
|
||||||
for (count = frag->fr_offset; count; count--)
|
for (count = frag->fr_offset; count; count--)
|
||||||
{
|
{
|
||||||
memcpy(buffer + frag->fr_address + off,
|
memcpy(buffer + frag->fr_address + off,
|
||||||
frag->fr_literal + frag->fr_fix,
|
frag->fr_literal + frag->fr_fix,
|
||||||
fill_size);
|
fill_size);
|
||||||
off += fill_size;
|
off += fill_size;
|
||||||
offset += fill_size;
|
offset += fill_size;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
|
}
|
||||||
|
frag = frag->fr_next;
|
||||||
}
|
}
|
||||||
frag = frag->fr_next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bfd_write(buffer, s->s_size,1,abfd);
|
bfd_write(buffer, s->s_size,1,abfd);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
*file_cursor += s->s_size;
|
*file_cursor += s->s_size;
|
||||||
paddr += s->s_size;
|
paddr += s->s_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,22 +704,23 @@ static void obj_coff_ln() {
|
||||||
*input_line_pointer == '\t') \
|
*input_line_pointer == '\t') \
|
||||||
input_line_pointer++;
|
input_line_pointer++;
|
||||||
|
|
||||||
static void obj_coff_def(what)
|
static void
|
||||||
int what;
|
DEFUN(obj_coff_def,(what),
|
||||||
|
int what)
|
||||||
{
|
{
|
||||||
char name_end; /* Char after the end of name */
|
char name_end; /* Char after the end of name */
|
||||||
char *symbol_name; /* Name of the debug symbol */
|
char *symbol_name; /* Name of the debug symbol */
|
||||||
char *symbol_name_copy; /* Temporary copy of the name */
|
char *symbol_name_copy; /* Temporary copy of the name */
|
||||||
unsigned int symbol_name_length;
|
unsigned int symbol_name_length;
|
||||||
/*$char* directiveP;$ */ /* Name of the pseudo opcode */
|
/*$char* directiveP;$ */ /* Name of the pseudo opcode */
|
||||||
/*$char directive[MAX_DIRECTIVE];$ */ /* Backup of the directive */
|
/*$char directive[MAX_DIRECTIVE];$ */ /* Backup of the directive */
|
||||||
/*$char end = 0;$ */ /* If 1, stop parsing */
|
/*$char end = 0;$ */ /* If 1, stop parsing */
|
||||||
|
|
||||||
if (def_symbol_in_progress != NULL) {
|
if (def_symbol_in_progress != NULL) {
|
||||||
as_warn(".def pseudo-op used inside of .def/.endef: ignored.");
|
as_warn(".def pseudo-op used inside of .def/.endef: ignored.");
|
||||||
demand_empty_rest_of_line();
|
demand_empty_rest_of_line();
|
||||||
return;
|
return;
|
||||||
} /* if not inside .def/.endef */
|
} /* if not inside .def/.endef */
|
||||||
|
|
||||||
SKIP_WHITESPACES();
|
SKIP_WHITESPACES();
|
||||||
|
|
||||||
|
@ -736,123 +738,125 @@ int what;
|
||||||
S_SET_NAME(def_symbol_in_progress, (*symbol_name_copy == '_'
|
S_SET_NAME(def_symbol_in_progress, (*symbol_name_copy == '_'
|
||||||
? symbol_name_copy + 1
|
? symbol_name_copy + 1
|
||||||
: symbol_name_copy));
|
: symbol_name_copy));
|
||||||
#else /* STRIP_UNDERSCORE */
|
#else /* STRIP_UNDERSCORE */
|
||||||
S_SET_NAME(def_symbol_in_progress, symbol_name_copy);
|
S_SET_NAME(def_symbol_in_progress, symbol_name_copy);
|
||||||
#endif /* STRIP_UNDERSCORE */
|
#endif /* STRIP_UNDERSCORE */
|
||||||
/* free(symbol_name_copy); */
|
/* free(symbol_name_copy); */
|
||||||
def_symbol_in_progress->sy_name_offset = ~0;
|
def_symbol_in_progress->sy_name_offset = ~0;
|
||||||
def_symbol_in_progress->sy_number = ~0;
|
def_symbol_in_progress->sy_number = ~0;
|
||||||
def_symbol_in_progress->sy_frag = &zero_address_frag;
|
def_symbol_in_progress->sy_frag = &zero_address_frag;
|
||||||
|
|
||||||
if (S_IS_STRING(def_symbol_in_progress)) {
|
if (S_IS_STRING(def_symbol_in_progress)) {
|
||||||
SF_SET_STRING(def_symbol_in_progress);
|
SF_SET_STRING(def_symbol_in_progress);
|
||||||
} /* "long" name */
|
} /* "long" name */
|
||||||
|
|
||||||
*input_line_pointer = name_end;
|
*input_line_pointer = name_end;
|
||||||
|
|
||||||
demand_empty_rest_of_line();
|
demand_empty_rest_of_line();
|
||||||
return;
|
return;
|
||||||
} /* obj_coff_def() */
|
} /* obj_coff_def() */
|
||||||
|
|
||||||
unsigned int dim_index;
|
unsigned int dim_index;
|
||||||
static void obj_coff_endef() {
|
static void
|
||||||
symbolS *symbolP = 0;
|
DEFUN_VOID(obj_coff_endef)
|
||||||
/* DIM BUG FIX sac@cygnus.com */
|
{
|
||||||
dim_index =0;
|
symbolS *symbolP = 0;
|
||||||
if (def_symbol_in_progress == NULL) {
|
/* DIM BUG FIX sac@cygnus.com */
|
||||||
as_warn(".endef pseudo-op used outside of .def/.endef: ignored.");
|
dim_index =0;
|
||||||
demand_empty_rest_of_line();
|
if (def_symbol_in_progress == NULL) {
|
||||||
return;
|
as_warn(".endef pseudo-op used outside of .def/.endef: ignored.");
|
||||||
} /* if not inside .def/.endef */
|
demand_empty_rest_of_line();
|
||||||
|
return;
|
||||||
|
} /* if not inside .def/.endef */
|
||||||
|
|
||||||
/* Set the section number according to storage class. */
|
/* Set the section number according to storage class. */
|
||||||
switch (S_GET_STORAGE_CLASS(def_symbol_in_progress)) {
|
switch (S_GET_STORAGE_CLASS(def_symbol_in_progress)) {
|
||||||
case C_STRTAG:
|
case C_STRTAG:
|
||||||
case C_ENTAG:
|
case C_ENTAG:
|
||||||
case C_UNTAG:
|
case C_UNTAG:
|
||||||
SF_SET_TAG(def_symbol_in_progress);
|
SF_SET_TAG(def_symbol_in_progress);
|
||||||
/* intentional fallthrough */
|
/* intentional fallthrough */
|
||||||
case C_FILE:
|
case C_FILE:
|
||||||
case C_TPDEF:
|
case C_TPDEF:
|
||||||
SF_SET_DEBUG(def_symbol_in_progress);
|
SF_SET_DEBUG(def_symbol_in_progress);
|
||||||
S_SET_SEGMENT(def_symbol_in_progress, SEG_DEBUG);
|
S_SET_SEGMENT(def_symbol_in_progress, SEG_DEBUG);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_EFCN:
|
case C_EFCN:
|
||||||
SF_SET_LOCAL(def_symbol_in_progress); /* Do not emit this symbol. */
|
SF_SET_LOCAL(def_symbol_in_progress); /* Do not emit this symbol. */
|
||||||
/* intentional fallthrough */
|
/* intentional fallthrough */
|
||||||
case C_BLOCK:
|
case C_BLOCK:
|
||||||
SF_SET_PROCESS(def_symbol_in_progress); /* Will need processing before writing */
|
SF_SET_PROCESS(def_symbol_in_progress); /* Will need processing before writing */
|
||||||
/* intentional fallthrough */
|
/* intentional fallthrough */
|
||||||
case C_FCN:
|
case C_FCN:
|
||||||
S_SET_SEGMENT(def_symbol_in_progress, SEG_E0);
|
S_SET_SEGMENT(def_symbol_in_progress, SEG_E0);
|
||||||
|
|
||||||
if (def_symbol_in_progress->sy_symbol.ost_entry.n_name[1] == 'b') { /* .bf */
|
if (def_symbol_in_progress->sy_symbol.ost_entry.n_name[1] == 'b') { /* .bf */
|
||||||
if (function_lineoff < 0) {
|
if (function_lineoff < 0) {
|
||||||
fprintf(stderr, "`.bf' symbol without preceding function\n");
|
fprintf(stderr, "`.bf' symbol without preceding function\n");
|
||||||
} /* missing function symbol */
|
} /* missing function symbol */
|
||||||
SA_GET_SYM_LNNOPTR(def_symbol_in_progress) = function_lineoff;
|
SA_GET_SYM_LNNOPTR(def_symbol_in_progress) = function_lineoff;
|
||||||
SF_SET_PROCESS(def_symbol_in_progress); /* Will need relocating */
|
SF_SET_PROCESS(def_symbol_in_progress); /* Will need relocating */
|
||||||
function_lineoff = -1;
|
function_lineoff = -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef C_AUTOARG
|
#ifdef C_AUTOARG
|
||||||
case C_AUTOARG:
|
case C_AUTOARG:
|
||||||
#endif /* C_AUTOARG */
|
#endif /* C_AUTOARG */
|
||||||
case C_AUTO:
|
case C_AUTO:
|
||||||
case C_REG:
|
case C_REG:
|
||||||
case C_MOS:
|
case C_MOS:
|
||||||
case C_MOE:
|
case C_MOE:
|
||||||
case C_MOU:
|
case C_MOU:
|
||||||
case C_ARG:
|
case C_ARG:
|
||||||
case C_REGPARM:
|
case C_REGPARM:
|
||||||
case C_FIELD:
|
case C_FIELD:
|
||||||
case C_EOS:
|
case C_EOS:
|
||||||
SF_SET_DEBUG(def_symbol_in_progress);
|
SF_SET_DEBUG(def_symbol_in_progress);
|
||||||
S_SET_SEGMENT(def_symbol_in_progress, SEG_ABSOLUTE);
|
S_SET_SEGMENT(def_symbol_in_progress, SEG_ABSOLUTE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_EXT:
|
case C_EXT:
|
||||||
case C_STAT:
|
case C_STAT:
|
||||||
case C_LABEL:
|
case C_LABEL:
|
||||||
/* Valid but set somewhere else (s_comm, s_lcomm, colon) */
|
/* Valid but set somewhere else (s_comm, s_lcomm, colon) */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_USTATIC:
|
case C_USTATIC:
|
||||||
case C_EXTDEF:
|
case C_EXTDEF:
|
||||||
case C_ULABEL:
|
case C_ULABEL:
|
||||||
as_warn("unexpected storage class %d", S_GET_STORAGE_CLASS(def_symbol_in_progress));
|
as_warn("unexpected storage class %d", S_GET_STORAGE_CLASS(def_symbol_in_progress));
|
||||||
break;
|
break;
|
||||||
} /* switch on storage class */
|
} /* switch on storage class */
|
||||||
|
|
||||||
/* Now that we have built a debug symbol, try to
|
/* Now that we have built a debug symbol, try to
|
||||||
find if we should merge with an existing symbol
|
find if we should merge with an existing symbol
|
||||||
or not. If a symbol is C_EFCN or SEG_ABSOLUTE or
|
or not. If a symbol is C_EFCN or SEG_ABSOLUTE or
|
||||||
untagged SEG_DEBUG it never merges. */
|
untagged SEG_DEBUG it never merges. */
|
||||||
|
|
||||||
/* Two cases for functions. Either debug followed
|
/* Two cases for functions. Either debug followed
|
||||||
by definition or definition followed by debug.
|
by definition or definition followed by debug.
|
||||||
For definition first, we will merge the debug
|
For definition first, we will merge the debug
|
||||||
symbol into the definition. For debug first, the
|
symbol into the definition. For debug first, the
|
||||||
lineno entry MUST point to the definition
|
lineno entry MUST point to the definition
|
||||||
function or else it will point off into space
|
function or else it will point off into space
|
||||||
when crawl_symbols() merges the debug
|
when crawl_symbols() merges the debug
|
||||||
symbol into the real symbol. Therefor, let's
|
symbol into the real symbol. Therefor, let's
|
||||||
presume the debug symbol is a real function
|
presume the debug symbol is a real function
|
||||||
reference. */
|
reference. */
|
||||||
|
|
||||||
/* FIXME-SOON If for some reason the definition
|
/* FIXME-SOON If for some reason the definition
|
||||||
label/symbol is never seen, this will probably
|
label/symbol is never seen, this will probably
|
||||||
leave an undefined symbol at link time. */
|
leave an undefined symbol at link time. */
|
||||||
|
|
||||||
if (S_GET_STORAGE_CLASS(def_symbol_in_progress) == C_EFCN
|
if (S_GET_STORAGE_CLASS(def_symbol_in_progress) == C_EFCN
|
||||||
|| (S_GET_SEGMENT(def_symbol_in_progress) == SEG_DEBUG
|
|| (S_GET_SEGMENT(def_symbol_in_progress) == SEG_DEBUG
|
||||||
&& !SF_GET_TAG(def_symbol_in_progress))
|
&& !SF_GET_TAG(def_symbol_in_progress))
|
||||||
|| S_GET_SEGMENT(def_symbol_in_progress) == SEG_ABSOLUTE
|
|| S_GET_SEGMENT(def_symbol_in_progress) == SEG_ABSOLUTE
|
||||||
|| (symbolP = symbol_find_base(S_GET_NAME(def_symbol_in_progress), DO_NOT_STRIP)) == NULL) {
|
|| (symbolP = symbol_find_base(S_GET_NAME(def_symbol_in_progress), DO_NOT_STRIP)) == NULL) {
|
||||||
|
|
||||||
symbol_append(def_symbol_in_progress, symbol_lastP, &symbol_rootP, &symbol_lastP);
|
symbol_append(def_symbol_in_progress, symbol_lastP, &symbol_rootP, &symbol_lastP);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* This symbol already exists, merge the
|
/* This symbol already exists, merge the
|
||||||
|
@ -878,72 +882,76 @@ static void obj_coff_endef() {
|
||||||
if (def_symbol_in_progress != symbol_lastP) {
|
if (def_symbol_in_progress != symbol_lastP) {
|
||||||
symbol_remove(def_symbol_in_progress, &symbol_rootP, &symbol_lastP);
|
symbol_remove(def_symbol_in_progress, &symbol_rootP, &symbol_lastP);
|
||||||
symbol_append(def_symbol_in_progress, symbol_lastP, &symbol_rootP, &symbol_lastP);
|
symbol_append(def_symbol_in_progress, symbol_lastP, &symbol_rootP, &symbol_lastP);
|
||||||
} /* if not already in place */
|
} /* if not already in place */
|
||||||
} /* if function */
|
} /* if function */
|
||||||
} /* normal or mergable */
|
} /* normal or mergable */
|
||||||
|
|
||||||
if (SF_GET_TAG(def_symbol_in_progress)
|
if (SF_GET_TAG(def_symbol_in_progress)
|
||||||
&& symbol_find_base(S_GET_NAME(def_symbol_in_progress), DO_NOT_STRIP) == NULL) {
|
&& symbol_find_base(S_GET_NAME(def_symbol_in_progress), DO_NOT_STRIP) == NULL) {
|
||||||
tag_insert(S_GET_NAME(def_symbol_in_progress), def_symbol_in_progress);
|
tag_insert(S_GET_NAME(def_symbol_in_progress), def_symbol_in_progress);
|
||||||
} /* If symbol is a {structure,union} tag, associate symbol to its name. */
|
} /* If symbol is a {structure,union} tag, associate symbol to its name. */
|
||||||
|
|
||||||
if (SF_GET_FUNCTION(def_symbol_in_progress)) {
|
if (SF_GET_FUNCTION(def_symbol_in_progress)) {
|
||||||
know(sizeof(def_symbol_in_progress) <= sizeof(long));
|
know(sizeof(def_symbol_in_progress) <= sizeof(long));
|
||||||
function_lineoff
|
function_lineoff
|
||||||
= c_line_new((long)
|
= c_line_new((long)
|
||||||
def_symbol_in_progress,0, 0, &zero_address_frag);
|
def_symbol_in_progress,0, 0, &zero_address_frag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SF_SET_PROCESS(def_symbol_in_progress);
|
SF_SET_PROCESS(def_symbol_in_progress);
|
||||||
|
|
||||||
if (symbolP == NULL) {
|
if (symbolP == NULL) {
|
||||||
/* That is, if this is the first
|
/* That is, if this is the first
|
||||||
time we've seen the function... */
|
time we've seen the function... */
|
||||||
symbol_table_insert(def_symbol_in_progress);
|
symbol_table_insert(def_symbol_in_progress);
|
||||||
} /* definition follows debug */
|
} /* definition follows debug */
|
||||||
} /* Create the line number entry pointing to the function being defined */
|
} /* Create the line number entry pointing to the function being defined */
|
||||||
|
|
||||||
def_symbol_in_progress = NULL;
|
def_symbol_in_progress = NULL;
|
||||||
demand_empty_rest_of_line();
|
demand_empty_rest_of_line();
|
||||||
return;
|
return;
|
||||||
} /* obj_coff_endef() */
|
} /* obj_coff_endef() */
|
||||||
|
|
||||||
static void obj_coff_dim()
|
static void
|
||||||
|
DEFUN_VOID(obj_coff_dim)
|
||||||
{
|
{
|
||||||
register int dim_index;
|
register int dim_index;
|
||||||
|
|
||||||
if (def_symbol_in_progress == NULL) {
|
if (def_symbol_in_progress == NULL)
|
||||||
|
{
|
||||||
as_warn(".dim pseudo-op used outside of .def/.endef: ignored.");
|
as_warn(".dim pseudo-op used outside of .def/.endef: ignored.");
|
||||||
demand_empty_rest_of_line();
|
demand_empty_rest_of_line();
|
||||||
return;
|
return;
|
||||||
} /* if not inside .def/.endef */
|
} /* if not inside .def/.endef */
|
||||||
|
|
||||||
S_SET_NUMBER_AUXILIARY(def_symbol_in_progress, 1);
|
S_SET_NUMBER_AUXILIARY(def_symbol_in_progress, 1);
|
||||||
|
|
||||||
for (dim_index = 0; dim_index < DIMNUM; dim_index++) {
|
for (dim_index = 0; dim_index < DIMNUM; dim_index++)
|
||||||
|
{
|
||||||
SKIP_WHITESPACES();
|
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) {
|
switch (*input_line_pointer)
|
||||||
|
{
|
||||||
|
|
||||||
case ',':
|
case ',':
|
||||||
input_line_pointer++;
|
input_line_pointer++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
as_warn("badly formed .dim directive ignored");
|
as_warn("badly formed .dim directive ignored");
|
||||||
/* intentional fallthrough */
|
/* intentional fallthrough */
|
||||||
case '\n':
|
case '\n':
|
||||||
case ';':
|
case ';':
|
||||||
dim_index = DIMNUM;
|
dim_index = DIMNUM;
|
||||||
break;
|
break;
|
||||||
} /* switch on following character */
|
} /* switch on following character */
|
||||||
} /* for each dimension */
|
} /* for each dimension */
|
||||||
|
|
||||||
demand_empty_rest_of_line();
|
demand_empty_rest_of_line();
|
||||||
return;
|
return;
|
||||||
} /* obj_coff_dim() */
|
} /* obj_coff_dim() */
|
||||||
|
|
||||||
static void obj_coff_line() {
|
static void obj_coff_line() {
|
||||||
if (def_symbol_in_progress == NULL) {
|
if (def_symbol_in_progress == NULL) {
|
||||||
|
@ -1269,10 +1277,12 @@ static unsigned int DEFUN_VOID(yank_symbols)
|
||||||
/* next pointer remains valid */
|
/* next pointer remains valid */
|
||||||
symbol_remove(symbolP, &symbol_rootP, &symbol_lastP);
|
symbol_remove(symbolP, &symbol_rootP, &symbol_lastP);
|
||||||
|
|
||||||
} else if (!S_IS_DEFINED(symbolP)
|
}
|
||||||
&& !S_IS_DEBUG(symbolP)
|
else if (!S_IS_DEFINED(symbolP)
|
||||||
&& !SF_GET_STATICS(symbolP)) {
|
&& !S_IS_DEBUG(symbolP)
|
||||||
/* S_GET_STORAGE_CLASS(symbolP) == C_EXT && !SF_GET_FUNCTION(symbolP)) { */
|
&& !SF_GET_STATICS(symbolP) &&
|
||||||
|
S_GET_STORAGE_CLASS(symbolP) == C_EXT)
|
||||||
|
{ /* C_EXT && !SF_GET_FUNCTION(symbolP)) */
|
||||||
/* if external, Remove from the list */
|
/* if external, Remove from the list */
|
||||||
symbolS *hold = symbol_previous(symbolP);
|
symbolS *hold = symbol_previous(symbolP);
|
||||||
|
|
||||||
|
@ -1348,81 +1358,85 @@ static unsigned int DEFUN_VOID(tie_tags)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DEFUN(crawl_symbols,(headers, abfd),
|
static void
|
||||||
struct internal_filehdr *headers AND
|
DEFUN(crawl_symbols,(headers, abfd),
|
||||||
bfd *abfd)
|
struct internal_filehdr *headers AND
|
||||||
|
bfd *abfd)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int ptr = 0;
|
unsigned int ptr = 0;
|
||||||
|
|
||||||
|
|
||||||
symbolS *symbolP;
|
symbolS *symbolP;
|
||||||
|
|
||||||
/* Initialize the stack used to keep track of the matching .bb .be */
|
/* Initialize the stack used to keep track of the matching .bb .be */
|
||||||
|
|
||||||
block_stack = stack_init(512, sizeof(symbolS*));
|
block_stack = stack_init(512, sizeof(symbolS*));
|
||||||
/* JF deal with forward references first... */
|
/* JF deal with forward references first... */
|
||||||
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
|
for (symbolP = symbol_rootP;
|
||||||
|
symbolP;
|
||||||
|
symbolP = symbol_next(symbolP))
|
||||||
|
{
|
||||||
|
|
||||||
if (symbolP->sy_forward) {
|
if (symbolP->sy_forward) {
|
||||||
S_SET_VALUE(symbolP, (S_GET_VALUE(symbolP)
|
S_SET_VALUE(symbolP, (S_GET_VALUE(symbolP)
|
||||||
+ S_GET_VALUE(symbolP->sy_forward)
|
+ S_GET_VALUE(symbolP->sy_forward)
|
||||||
+ symbolP->sy_forward->sy_frag->fr_address));
|
+ symbolP->sy_forward->sy_frag->fr_address));
|
||||||
|
|
||||||
if (SF_GET_GET_SEGMENT(symbolP)) {
|
if (SF_GET_GET_SEGMENT(symbolP)) {
|
||||||
S_SET_SEGMENT(symbolP, S_GET_SEGMENT(symbolP->sy_forward));
|
S_SET_SEGMENT(symbolP, S_GET_SEGMENT(symbolP->sy_forward));
|
||||||
} /* forward segment also */
|
} /* forward segment also */
|
||||||
|
|
||||||
symbolP->sy_forward=0;
|
symbolP->sy_forward=0;
|
||||||
} /* if it has a forward reference */
|
} /* if it has a forward reference */
|
||||||
} /* walk the symbol chain */
|
} /* walk the symbol chain */
|
||||||
|
|
||||||
|
|
||||||
/* The symbol list should be ordered according to the following sequence
|
/* The symbol list should be ordered according to the following sequence
|
||||||
* order :
|
* order :
|
||||||
* . .file symbol
|
* . .file symbol
|
||||||
* . debug entries for functions
|
* . debug entries for functions
|
||||||
* . fake symbols for the sections, including.text .data and .bss
|
* . fake symbols for the sections, including.text .data and .bss
|
||||||
* . defined symbols
|
* . defined symbols
|
||||||
* . undefined symbols
|
* . undefined symbols
|
||||||
* But this is not mandatory. The only important point is to put the
|
* But this is not mandatory. The only important point is to put the
|
||||||
* undefined symbols at the end of the list.
|
* undefined symbols at the end of the list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (symbol_rootP == NULL
|
if (symbol_rootP == NULL
|
||||||
|| S_GET_STORAGE_CLASS(symbol_rootP) != C_FILE) {
|
|| S_GET_STORAGE_CLASS(symbol_rootP) != C_FILE) {
|
||||||
c_dot_file_symbol("fake");
|
c_dot_file_symbol("fake");
|
||||||
}
|
|
||||||
/* Is there a .file symbol ? If not insert one at the beginning. */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Build up static symbols for the sections, they are filled in later
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
for (i = SEG_E0; i < SEG_E9; i++)
|
|
||||||
{
|
|
||||||
if (segment_info[i].scnhdr.s_name[0])
|
|
||||||
{
|
|
||||||
segment_info[i].dot =
|
|
||||||
c_section_symbol(segment_info[i].scnhdr.s_name,
|
|
||||||
i-SEG_E0+1);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
/* Is there a .file symbol ? If not insert one at the beginning. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Build up static symbols for the sections, they are filled in later
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* Take all the externals out and put them into another chain */
|
for (i = SEG_E0; i < SEG_E9; i++)
|
||||||
headers->f_nsyms = yank_symbols();
|
{
|
||||||
/* Take the externals and glue them onto the end.*/
|
if (segment_info[i].scnhdr.s_name[0])
|
||||||
headers->f_nsyms += glue_symbols();
|
{
|
||||||
|
segment_info[i].dot =
|
||||||
|
c_section_symbol(segment_info[i].scnhdr.s_name,
|
||||||
|
i-SEG_E0+1);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
headers->f_nsyms = tie_tags();
|
|
||||||
know(symbol_externP == NULL);
|
|
||||||
know(symbol_extern_lastP == NULL);
|
|
||||||
|
|
||||||
return;
|
/* Take all the externals out and put them into another chain */
|
||||||
|
headers->f_nsyms = yank_symbols();
|
||||||
|
/* Take the externals and glue them onto the end.*/
|
||||||
|
headers->f_nsyms += glue_symbols();
|
||||||
|
|
||||||
|
headers->f_nsyms = tie_tags();
|
||||||
|
know(symbol_externP == NULL);
|
||||||
|
know(symbol_extern_lastP == NULL);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1505,14 +1519,7 @@ DEFUN(do_linenos_for,(abfd, file_cursor),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Local Variables:
|
|
||||||
* comment-column: 0
|
|
||||||
* fill-column: 131
|
|
||||||
* End:
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* end of obj-coff.c */
|
|
||||||
/* Now we run through the list of frag chains in a segment and
|
/* Now we run through the list of frag chains in a segment and
|
||||||
make all the subsegment frags appear at the end of the
|
make all the subsegment frags appear at the end of the
|
||||||
list, as if the seg 0 was extra long */
|
list, as if the seg 0 was extra long */
|
||||||
|
@ -2104,3 +2111,4 @@ segT this_segment_type)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue