From fdc076b641fb5708e24c4c911d1baf32facc797f Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 11 Sep 1999 21:15:16 +0000 Subject: [PATCH] 1999-09-11 Donn Terry * cofflink.c (_bfd_coff_write_global_sym): Handle section symbol aux entries. --- bfd/ChangeLog | 3 +++ bfd/cofflink.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index df32dda3e..8e4212a96 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -5,6 +5,9 @@ 1999-09-11 Donn Terry + * cofflink.c (_bfd_coff_write_global_sym): Handle section symbol + aux entries. + * cofflink.c (coff_link_add_symbols): Don't warn about symbol type changes when the base type is unknown. diff --git a/bfd/cofflink.c b/bfd/cofflink.c index a4e18b32e..1373e48c6 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -2477,11 +2477,64 @@ _bfd_coff_write_global_sym (h, data) ++obj_raw_syment_count (output_bfd); - /* Write out any associated aux entries. There normally will be - none. If there are any, I have no idea how to modify them. */ + /* Write out any associated aux entries. Most of the aux entries + will have been modified in _bfd_coff_link_input_bfd. We have to + handle section aux entries here, now that we have the final + relocation and line number counts. */ for (i = 0; i < isym.n_numaux; i++) { - bfd_coff_swap_aux_out (output_bfd, (PTR) (h->aux + i), isym.n_type, + union internal_auxent *auxp; + + auxp = h->aux + i; + + /* Look for a section aux entry here using the same tests that + coff_swap_aux_out uses. */ + if (i == 0 + && (isym.n_sclass == C_STAT + || isym.n_sclass == C_HIDDEN) + && isym.n_type == T_NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + asection *sec; + + sec = h->root.u.def.section->output_section; + if (sec != NULL) + { + auxp->x_scn.x_scnlen = (sec->_cooked_size != 0 + ? sec->_cooked_size + : sec->_raw_size); + + /* For PE, an overflow on the final link reportedly does + not matter. FIXME: Why not? */ + + if (sec->reloc_count > 0xffff + && (! obj_pe (output_bfd) + || finfo->info->relocateable)) + (*_bfd_error_handler) + (_("%s: %s: reloc overflow: 0x%lx > 0xffff"), + bfd_get_filename (output_bfd), + bfd_get_section_name (output_bfd, sec), + sec->reloc_count); + + if (sec->lineno_count > 0xffff + && (! obj_pe (output_bfd) + || finfo->info->relocateable)) + (*_bfd_error_handler) + (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"), + bfd_get_filename (output_bfd), + bfd_get_section_name (output_bfd, sec), + sec->lineno_count); + + auxp->x_scn.x_nreloc = sec->reloc_count; + auxp->x_scn.x_nlinno = sec->lineno_count; + auxp->x_scn.x_checksum = 0; + auxp->x_scn.x_associated = 0; + auxp->x_scn.x_comdat = 0; + } + } + + bfd_coff_swap_aux_out (output_bfd, (PTR) auxp, isym.n_type, isym.n_sclass, i, isym.n_numaux, (PTR) finfo->outsyms); if (bfd_write (finfo->outsyms, symesz, 1, output_bfd) != symesz) -- 2.11.4.GIT