Mon Jan 25 15:27:36 1993 Ian Lance Taylor (ian@cygnus.com)

* coffcode.h (_bfd_coff_mkobject_hook): Pass aouthdr argument.
	(coff_mkobject_hook): Accept aouthdr argument.
	* coffgen.c (coff_real_object_p): Pass aouthdr to mkobject_hook.
	Handle NULL aouthdr argument.
	(coff_object_p): If there is no aouthdr, pass it as NULL to
	coff_real_object_p.
	* libcoff.h: Rebuilt for mkobject_hook changes.
This commit is contained in:
Ian Lance Taylor 1993-01-25 23:32:26 +00:00
parent fa8fea3dda
commit 27f524a317
2 changed files with 45 additions and 32 deletions

View File

@ -539,7 +539,8 @@ dependent COFF routines
. PTR internal_filehdr));
. PTR (*_bfd_coff_mkobject_hook) PARAMS ((
. bfd *abfd,
. PTR internal_filehdr));
. PTR internal_filehdr,
. PTR internal_aouthdr));
. flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
. bfd *abfd,
. PTR internal_scnhdr));
@ -617,8 +618,8 @@ dependent COFF routines
.
.#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
. ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
.#define bfd_coff_mkobject_hook(abfd, filehdr)\
. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr))
.#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
.
.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr)\
. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr))
@ -756,9 +757,10 @@ DEFUN(coff_mkobject,(abfd),
/* Create the COFF backend specific information. */
static PTR
DEFUN(coff_mkobject_hook,(abfd, filehdr),
DEFUN(coff_mkobject_hook,(abfd, filehdr, aouthdr),
bfd *abfd AND
PTR filehdr)
PTR filehdr AND
PTR aouthdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
coff_data_type *coff;
@ -1344,7 +1346,7 @@ DEFUN(coff_write_object_contents,(abfd),
/* Make a pass through the symbol table to count line number entries and
put them into the correct asections */
coff_count_linenumbers(abfd);
lnno_size = coff_count_linenumbers(abfd) * LINESZ;
data_base = scn_base;
/* Work out the size of the reloc and linno areas */
@ -1357,7 +1359,6 @@ DEFUN(coff_write_object_contents,(abfd),
{
reloc_size += current->reloc_count * RELSZ;
lnno_size += current->lineno_count * LINESZ;
data_base += SCNHSZ;
}

View File

@ -114,7 +114,7 @@ DEFUN(coff_real_object_p,(abfd, nscns, internal_f, internal_a),
char *external_sections;
/* Build a play area */
tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f);
tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f, (PTR) internal_a);
if (tdata == NULL)
return 0;
@ -156,7 +156,10 @@ DEFUN(coff_real_object_p,(abfd, nscns, internal_f, internal_a),
if (internal_f->f_nsyms)
abfd->flags |= HAS_SYMS;
bfd_get_start_address(abfd) = internal_f->f_opthdr ? internal_a->entry : 0;
if (internal_a != (struct internal_aouthdr *) NULL)
bfd_get_start_address (abfd) = internal_a->entry;
else
bfd_get_start_address (abfd) = 0;
return abfd->xvec;
fail:
@ -213,7 +216,10 @@ DEFUN(coff_object_p,(abfd),
/* Seek past the opt hdr stuff */
bfd_seek(abfd, (file_ptr) (internal_f.f_opthdr + filhsz), SEEK_SET);
return coff_real_object_p(abfd, nscns, &internal_f, &internal_a);
return coff_real_object_p(abfd, nscns, &internal_f,
(internal_f.f_opthdr != 0
? &internal_a
: (struct internal_aouthdr *) NULL));
}
/* Get the BFD section from a COFF symbol section number. */
@ -298,12 +304,13 @@ DEFUN(coff_get_symtab, (abfd, alocation),
/* Set lineno_count for the output sections of a COFF file. */
void
int
DEFUN(coff_count_linenumbers,(abfd),
bfd *abfd)
{
unsigned int limit = bfd_get_symcount(abfd);
unsigned int i;
int total = 0;
asymbol **p;
{
asection *s = abfd->sections->output_section;
@ -325,14 +332,17 @@ DEFUN(coff_count_linenumbers,(abfd),
*/
alent *l = q->lineno;
q->symbol.section->output_section->lineno_count++;
total ++;
l++;
while (l->line_number) {
total ++;
q->symbol.section->output_section->lineno_count++;
l++;
}
}
}
}
return total;
}
/* Takes a bfd and a symbol, returns a pointer to the coff specific
@ -844,6 +854,7 @@ DEFUN(coff_write_linenumbers,(abfd),
/* Find all the linenumbers in this section */
while (*q) {
asymbol *p = *q;
if (p->section->output_section == s) {
alent *l =
BFD_SEND(bfd_asymbol_bfd(p), _get_lineno, (bfd_asymbol_bfd(p), p));
if (l) {
@ -863,6 +874,7 @@ DEFUN(coff_write_linenumbers,(abfd),
l++;
}
}
}
q++;
}
}