}
/* Try and figure out what it should be */
- else if (sec_flags & SEC_CODE)
+ else if (sec_flags & SEC_CODE)
{
styp_flags = STYP_TEXT;
}
. 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));
.
.#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))
/* 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;
/* 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 */
{
reloc_size += current->reloc_count * RELSZ;
- lnno_size += current->lineno_count * LINESZ;
data_base += SCNHSZ;
}
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;
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:
/* 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. */
/* 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;
- while (s) {
- BFD_ASSERT(s->lineno_count == 0);
- s = s->next;
- }
- }
+ {
+ asection *s = abfd->sections->output_section;
+ while (s) {
+ BFD_ASSERT(s->lineno_count == 0);
+ s = s->next;
+ }
+ }
for (p = abfd->outsymbols, i = 0; i < limit; i++, p++) {
*/
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
/* Find all the linenumbers in this section */
while (*q) {
asymbol *p = *q;
- alent *l =
- BFD_SEND(bfd_asymbol_bfd(p), _get_lineno, (bfd_asymbol_bfd(p), p));
- if (l) {
- /* Found a linenumber entry, output */
- struct internal_lineno out;
- memset( (PTR)&out, 0, sizeof(out));
- out.l_lnno = 0;
- out.l_addr.l_symndx = l->u.offset;
- bfd_coff_swap_lineno_out(abfd, &out, buff);
- bfd_write(buff, 1, linesz, abfd);
- l++;
- while (l->line_number) {
- out.l_lnno = l->line_number;
+ if (p->section->output_section == s) {
+ alent *l =
+ BFD_SEND(bfd_asymbol_bfd(p), _get_lineno, (bfd_asymbol_bfd(p), p));
+ if (l) {
+ /* Found a linenumber entry, output */
+ struct internal_lineno out;
+ memset( (PTR)&out, 0, sizeof(out));
+ out.l_lnno = 0;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out(abfd, &out, buff);
bfd_write(buff, 1, linesz, abfd);
l++;
+ while (l->line_number) {
+ out.l_lnno = l->line_number;
+ out.l_addr.l_symndx = l->u.offset;
+ bfd_coff_swap_lineno_out(abfd, &out, buff);
+ bfd_write(buff, 1, linesz, abfd);
+ l++;
+ }
}
}
q++;