* coffcode.h (combined_entry_type): Add fix_line field.
(coff_slurp_line_table): Warn if we try to set the lineno field of a symbol twice. (coff_slurp_symbol_table): If RS6000COFF_C, handle C_BINCL and C_EINCL by setting fix_line. Fix C_BSTAT symbol value. * coffgen.c (coff_mangle_symbols): Handle fix_line. (coff_write_symbol): Only use N_DEBUG if the symbol is in the absolute section. (coff_print_symbol): Print fix_value symbols in a useful fashion. * libcoff.h: Rebuild.
This commit is contained in:
parent
24e6097868
commit
49488f2b2d
|
@ -1,5 +1,16 @@
|
|||
Mon Oct 9 11:24:08 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* coffcode.h (combined_entry_type): Add fix_line field.
|
||||
(coff_slurp_line_table): Warn if we try to set the lineno field of
|
||||
a symbol twice.
|
||||
(coff_slurp_symbol_table): If RS6000COFF_C, handle C_BINCL and
|
||||
C_EINCL by setting fix_line. Fix C_BSTAT symbol value.
|
||||
* coffgen.c (coff_mangle_symbols): Handle fix_line.
|
||||
(coff_write_symbol): Only use N_DEBUG if the symbol is in the
|
||||
absolute section.
|
||||
(coff_print_symbol): Print fix_value symbols in a useful fashion.
|
||||
* libcoff.h: Rebuild.
|
||||
|
||||
* libcoff-in.h (struct xcoff_tdata): Define.
|
||||
(xcoff_data): Define.
|
||||
* bfd.c (struct _bfd): Add xcoff_obj_data field to tdata union.
|
||||
|
|
|
@ -268,6 +268,11 @@ CODE_FRAGMENT
|
|||
. Created by coff_pointerize_aux. *}
|
||||
.unsigned int fix_scnlen : 1;
|
||||
.
|
||||
. {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
|
||||
. index into the line number entries. Set by
|
||||
. coff_slurp_symbol_table. *}
|
||||
.unsigned int fix_line : 1;
|
||||
.
|
||||
. {* The container for the symbol structure as read and translated
|
||||
. from the file. *}
|
||||
.
|
||||
|
@ -2453,6 +2458,13 @@ coff_slurp_line_table (abfd, asect)
|
|||
(coff_symbol_type *) (dst.l_addr.l_symndx
|
||||
+ obj_raw_syments (abfd))->u.syment._n._n_n._n_zeroes;
|
||||
cache_ptr->u.sym = (asymbol *) sym;
|
||||
if (sym->lineno != NULL)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: warning: duplicate line number information for `%s'",
|
||||
bfd_get_filename (abfd),
|
||||
bfd_asymbol_name (&sym->symbol));
|
||||
}
|
||||
sym->lineno = cache_ptr;
|
||||
}
|
||||
else
|
||||
|
@ -2641,8 +2653,6 @@ coff_slurp_symbol_table (abfd)
|
|||
case C_FILE: /* file name */
|
||||
case C_STRTAG: /* structure tag */
|
||||
#ifdef RS6000COFF_C
|
||||
case C_BINCL: /* beginning of include file */
|
||||
case C_EINCL: /* ending of include file */
|
||||
case C_GSYM:
|
||||
case C_LSYM:
|
||||
case C_PSYM:
|
||||
|
@ -2659,15 +2669,43 @@ coff_slurp_symbol_table (abfd)
|
|||
break;
|
||||
|
||||
#ifdef RS6000COFF_C
|
||||
case C_BINCL: /* beginning of include file */
|
||||
case C_EINCL: /* ending of include file */
|
||||
/* The value is actually a pointer into the line numbers
|
||||
of the file. We locate the line number entry, and
|
||||
set the section to the section which contains it, and
|
||||
the value to the index in that section. */
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
dst->symbol.flags = BSF_DEBUGGING;
|
||||
for (sec = abfd->sections; sec != NULL; sec = sec->next)
|
||||
if (sec->line_filepos <= src->u.syment.n_value
|
||||
&& (sec->line_filepos + sec->lineno_count * LINESZ
|
||||
> src->u.syment.n_value))
|
||||
break;
|
||||
if (sec == NULL)
|
||||
dst->symbol.value = 0;
|
||||
else
|
||||
{
|
||||
dst->symbol.section = sec;
|
||||
dst->symbol.value = ((src->u.syment.n_value
|
||||
- sec->line_filepos)
|
||||
/ LINESZ);
|
||||
src->fix_line = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case C_BSTAT:
|
||||
dst->symbol.flags = BSF_DEBUGGING;
|
||||
dst->symbol.value = src->u.syment.n_value;
|
||||
|
||||
/* The value is actually a symbol index. Save a pointer
|
||||
to the symbol instead of the index. FIXME: This
|
||||
should use a union. */
|
||||
src->u.syment.n_value =
|
||||
(long) (native_symbols + src->u.syment.n_value);
|
||||
dst->symbol.value = src->u.syment.n_value;
|
||||
src->fix_value = 1;
|
||||
break;
|
||||
#endif
|
||||
|
|
|
@ -576,6 +576,18 @@ coff_mangle_symbols (bfd_ptr)
|
|||
((combined_entry_type *) s->u.syment.n_value)->offset;
|
||||
s->fix_value = 0;
|
||||
}
|
||||
if (s->fix_line)
|
||||
{
|
||||
/* The value is the offset into the line number entries
|
||||
for the symbol's section. On output, the symbol's
|
||||
section should be N_DEBUG. */
|
||||
s->u.syment.n_value =
|
||||
(coff_symbol_ptr->symbol.section->output_section->line_filepos
|
||||
+ s->u.syment.n_value * bfd_coff_linesz (bfd_ptr));
|
||||
coff_symbol_ptr->symbol.section =
|
||||
coff_section_from_bfd_index (bfd_ptr, N_DEBUG);
|
||||
BFD_ASSERT (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING);
|
||||
}
|
||||
for (i = 0; i < s->u.syment.n_numaux; i++)
|
||||
{
|
||||
combined_entry_type *a = s + i + 1;
|
||||
|
@ -729,7 +741,8 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
|
|||
if (native->u.syment.n_sclass == C_FILE)
|
||||
symbol->flags |= BSF_DEBUGGING;
|
||||
|
||||
if (symbol->flags & BSF_DEBUGGING)
|
||||
if (symbol->flags & BSF_DEBUGGING
|
||||
&& bfd_is_abs_section (symbol->section))
|
||||
{
|
||||
native->u.syment.n_scnum = N_DEBUG;
|
||||
}
|
||||
|
@ -1699,6 +1712,7 @@ coff_print_symbol (abfd, filep, symbol, how)
|
|||
case bfd_print_symbol_all:
|
||||
if (coffsymbol (symbol)->native)
|
||||
{
|
||||
unsigned long val;
|
||||
unsigned int aux;
|
||||
combined_entry_type *combined = coffsymbol (symbol)->native;
|
||||
combined_entry_type *root = obj_raw_syments (abfd);
|
||||
|
@ -1706,6 +1720,13 @@ coff_print_symbol (abfd, filep, symbol, how)
|
|||
|
||||
fprintf (file, "[%3ld]", (long) (combined - root));
|
||||
|
||||
if (! combined->fix_value)
|
||||
val = (unsigned long) combined->u.syment.n_value;
|
||||
else
|
||||
val = ((unsigned long)
|
||||
((combined_entry_type *) combined->u.syment.n_value
|
||||
- root));
|
||||
|
||||
fprintf (file,
|
||||
"(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%08lx %s",
|
||||
combined->u.syment.n_scnum,
|
||||
|
@ -1713,7 +1734,7 @@ coff_print_symbol (abfd, filep, symbol, how)
|
|||
combined->u.syment.n_type,
|
||||
combined->u.syment.n_sclass,
|
||||
combined->u.syment.n_numaux,
|
||||
(unsigned long) combined->u.syment.n_value,
|
||||
val,
|
||||
symbol->name);
|
||||
|
||||
for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
|
||||
|
|
|
@ -294,6 +294,11 @@ unsigned int fix_end : 1;
|
|||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_scnlen : 1;
|
||||
|
||||
/* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
|
||||
index into the line number entries. Set by
|
||||
coff_slurp_symbol_table. */
|
||||
unsigned int fix_line : 1;
|
||||
|
||||
/* The container for the symbol structure as read and translated
|
||||
from the file. */
|
||||
|
||||
|
|
Loading…
Reference in New Issue