Change ld "notice" interface for better handling of indirect symbols

The main aim of this change was to have non_ir_ref set correctly on
new indirect symbols.  I could have added a "copy" param to the "notice"
function, so that indirect symbols could be created in plugin_notice,
but it seemed cleaner to create indirect syms earlier and pass them
rather than "string" to "notice".

include/
	* bfdlink.h (struct bfd_link_callbacks <notice>): Remove "string"
	param, add "inh".
bfd/
	* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Only call "notice"
	here when not calling the generic add_symbol function.  Formatting.
	Correct handling of indirect symbols.  Update notice call.
	* elflink.c (_bfd_elf_notice_as_needed): Update notice call.
	* linker.c (_bfd_generic_link_add_one_symbol): Create indirect
	symbols early.  Update notice call.  Add comments regarding weak
	symbols vs. indirect.
ld/
	* ldmain.c (notice): Update args.
	* plugin.c (plugin_notice): Likewise.  Follow warning sym link.
	Handle new indirect symbol.
This commit is contained in:
Alan Modra
2014-08-12 10:43:33 +09:30
parent 88d3f0870b
commit 4613510308
9 changed files with 128 additions and 91 deletions

View File

@@ -137,7 +137,7 @@ static bfd_boolean unattached_reloc
(struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma);
static bfd_boolean notice
(struct bfd_link_info *, struct bfd_link_hash_entry *,
bfd *, asection *, bfd_vma, flagword, const char *);
struct bfd_link_hash_entry *, bfd *, asection *, bfd_vma, flagword);
static struct bfd_link_callbacks link_callbacks =
{
@@ -1461,11 +1461,11 @@ unattached_reloc (struct bfd_link_info *info ATTRIBUTE_UNUSED,
static bfd_boolean
notice (struct bfd_link_info *info,
struct bfd_link_hash_entry *h,
struct bfd_link_hash_entry *inh ATTRIBUTE_UNUSED,
bfd *abfd,
asection *section,
bfd_vma value,
flagword flags ATTRIBUTE_UNUSED,
const char *string ATTRIBUTE_UNUSED)
flagword flags ATTRIBUTE_UNUSED)
{
const char *name;