* cofflink.c (_bfd_coff_final_link): If there aren't any relocs in

a relocateable link, don't try to process them.  From Heinz Wrobel
	<wrobel@lpr.e-technik.tu-muenchen.de>.
This commit is contained in:
Ian Lance Taylor 1996-12-02 17:15:05 +00:00
parent b7b89deb44
commit 179b58d949
2 changed files with 25 additions and 7 deletions

View file

@ -1,3 +1,9 @@
Mon Dec 2 12:13:51 1996 Ian Lance Taylor <ian@cygnus.com>
* cofflink.c (_bfd_coff_final_link): If there aren't any relocs in
a relocateable link, don't try to process them. From Heinz Wrobel
<wrobel@lpr.e-technik.tu-muenchen.de>.
Mon Dec 2 00:39:24 1996 Jeffrey A Law (law@cygnus.com)
* elf32-mn10300.c (mn10300_info_howto): Renamed from

View file

@ -283,6 +283,7 @@ coff_link_add_symbols (abfd, info)
struct bfd_link_info *info;
{
boolean (*sym_is_global) PARAMS ((bfd *, struct internal_syment *));
boolean keep_syms;
boolean default_copy;
bfd_size_type symcount;
struct coff_link_hash_entry **sym_hash;
@ -290,6 +291,11 @@ coff_link_add_symbols (abfd, info)
bfd_byte *esym;
bfd_byte *esym_end;
/* Keep the symbols during this function, in case the linker needs
to read the generic symbols in order to report an error message. */
keep_syms = obj_coff_keep_syms (abfd);
obj_coff_keep_syms (abfd) = true;
sym_is_global = coff_backend_info (abfd)->_bfd_coff_sym_is_global;
if (info->keep_memory)
@ -306,7 +312,7 @@ coff_link_add_symbols (abfd, info)
((size_t) symcount
* sizeof (struct coff_link_hash_entry *))));
if (sym_hash == NULL && symcount != 0)
return false;
goto error_return;
obj_coff_sym_hashes (abfd) = sym_hash;
memset (sym_hash, 0,
(size_t) symcount * sizeof (struct coff_link_hash_entry *));
@ -335,7 +341,7 @@ coff_link_add_symbols (abfd, info)
name = _bfd_coff_internal_syment_name (abfd, &sym, buf);
if (name == NULL)
return false;
goto error_return;
/* We must copy the name into memory if we got it from the
syment itself, rather than the string table. */
@ -370,7 +376,7 @@ coff_link_add_symbols (abfd, info)
(info, abfd, name, flags, section, value,
(const char *) NULL, copy, false,
(struct bfd_link_hash_entry **) sym_hash)))
return false;
goto error_return;
if (info->hash->creator->flavour == bfd_get_flavour (abfd))
{
@ -405,7 +411,7 @@ coff_link_add_symbols (abfd, info)
(sym.n_numaux
* sizeof (*alloc))));
if (alloc == NULL)
return false;
goto error_return;
for (i = 0, eaux = esym + symesz, iaux = alloc;
i < sym.n_numaux;
i++, eaux += symesz, iaux++)
@ -448,7 +454,7 @@ coff_link_add_symbols (abfd, info)
(PTR) bfd_zalloc (abfd,
sizeof (struct coff_section_tdata));
if (stab->used_by_bfd == NULL)
return false;
goto error_return;
secdata = coff_section_data (abfd, stab);
}
@ -457,12 +463,18 @@ coff_link_add_symbols (abfd, info)
if (! _bfd_link_section_stabs (abfd, &table->stab_info,
stab, stabstr,
&secdata->stab_info))
return false;
goto error_return;
}
}
}
obj_coff_keep_syms (abfd) = keep_syms;
return true;
error_return:
obj_coff_keep_syms (abfd) = keep_syms;
return false;
}
/* Do the final link step. */
@ -826,7 +838,7 @@ _bfd_coff_final_link (abfd, info)
finfo.outsyms = NULL;
}
if (info->relocateable)
if (info->relocateable && max_output_reloc_count > 0)
{
/* Now that we have written out all the global symbols, we know
the symbol indices to use for relocs against them, and we can