diff options
-rw-r--r-- | bfd/ChangeLog | 4 | ||||
-rw-r--r-- | bfd/cofflink.c | 39 |
2 files changed, 39 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1575adb..4305015 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -4,6 +4,10 @@ Tue Oct 1 16:14:22 1996 Joel Sherrill <joel@oarcorp.com> Tue Oct 1 12:31:39 1996 Ian Lance Taylor <ian@cygnus.com> + * cofflink.c (coff_link_add_symbols): Don't override a meaningful + symbol type with T_NULL. Warn if symbol type changes. Based on + patch from Philippe De Muyter <phdm@labauto1.ulb.ac.be>. + * elflink.h (elf_link_add_object_symbols): Only put a symbol from a dynamic object in the dynamic symbol table if it is referenced or defined by a regular object. diff --git a/bfd/cofflink.c b/bfd/cofflink.c index e100025..9d62013 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -381,8 +381,16 @@ coff_link_add_symbols (abfd, info) && (*sym_hash)->root.type != bfd_link_hash_defined)) { (*sym_hash)->class = sym.n_sclass; - (*sym_hash)->type = sym.n_type; - (*sym_hash)->numaux = sym.n_numaux; + if (sym.n_type != T_NULL) + { + if ((*sym_hash)->type != T_NULL + && (*sym_hash)->type != sym.n_type) + (*_bfd_error_handler) + ("Warning: type of symbol `%s' changed from %d to %d in %s", + name, (*sym_hash)->type, sym.n_type, + bfd_get_filename (abfd)); + (*sym_hash)->type = sym.n_type; + } (*sym_hash)->auxbfd = abfd; if (sym.n_numaux != 0) { @@ -391,6 +399,7 @@ coff_link_add_symbols (abfd, info) bfd_byte *eaux; union internal_auxent *iaux; + (*sym_hash)->numaux = sym.n_numaux; alloc = ((union internal_auxent *) bfd_hash_allocate (&info->hash->table, (sym.n_numaux @@ -466,6 +475,7 @@ _bfd_coff_final_link (abfd, info) bfd_size_type symesz; struct coff_final_link_info finfo; boolean debug_merge_allocated; + boolean long_section_names; asection *o; struct bfd_link_order *p; size_t max_sym_count; @@ -521,6 +531,7 @@ _bfd_coff_final_link (abfd, info) max_lineno_count = 0; max_reloc_count = 0; + long_section_names = false; for (o = abfd->sections; o != NULL; o = o->next) { o->reloc_count = 0; @@ -566,6 +577,20 @@ _bfd_coff_final_link (abfd, info) o->rel_filepos = rel_filepos; rel_filepos += o->reloc_count * relsz; } + + if (bfd_coff_long_section_names (abfd) + && strlen (o->name) > SCNNMLEN) + { + /* This section has a long name which must go in the string + table. This must correspond to the code in + coff_write_object_contents which puts the string index + into the s_name field of the section header. That is why + we pass hash as false. */ + if (_bfd_stringtab_add (finfo.strtab, o->name, false, false) + == (bfd_size_type) -1) + goto error_return; + long_section_names = true; + } } /* If doing a relocateable link, allocate space for the pointers we @@ -869,7 +894,7 @@ _bfd_coff_final_link (abfd, info) } /* Write out the string table. */ - if (obj_raw_syment_count (abfd) != 0) + if (obj_raw_syment_count (abfd) != 0 || long_section_names) { if (bfd_seek (abfd, (obj_sym_filepos (abfd) @@ -1538,7 +1563,12 @@ _bfd_coff_link_input_bfd (finfo, input_bfd) if (*indexp < 0) { h = *sym_hash; - BFD_ASSERT (h->numaux == isymp->n_numaux); + + /* The m68k-motorola-sysv assembler will sometimes + generate two symbols with the same name, but only one + will have aux entries. */ + BFD_ASSERT (isymp->n_numaux == 0 + || h->numaux == isymp->n_numaux); } esym += isymesz; @@ -2431,6 +2461,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, + input_section->output_section->vma; if (coff_data(output_bfd)->pe) addr -= pe_data(output_bfd)->pe_opthdr.ImageBase; + /* FIXME: Shouldn't 4 be sizeof (addr)? */ fwrite (&addr, 1,4, (FILE *) info->base_file); } } |