elflink.c whitespace, formatting and a plugin symbol tweak

* elflink.c: Whitespace, formatting fixes.
	(elf_link_input_bfd): Clarify comment.
	(elf_link_output_extsym): Exclude symbols in linker created
	sections when testing for plugin symbols.
This commit is contained in:
Alan Modra
2015-02-05 17:30:57 +10:30
parent dddcc5b9a8
commit ca4be51cd8
2 changed files with 35 additions and 26 deletions

View File

@ -1,3 +1,10 @@
2015-02-09 Alan Modra <amodra@gmail.com>
* elflink.c: Whitespace, formatting fixes.
(elf_link_input_bfd): Clarify comment.
(elf_link_output_extsym): Exclude symbols in linker created
sections when testing for plugin symbols.
2015-02-07 H.J. Lu <hongjiu.lu@intel.com> 2015-02-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/17935 PR ld/17935

View File

@ -2281,8 +2281,8 @@ _bfd_elf_link_size_reloc_section (bfd *abfd,
{ {
struct elf_link_hash_entry **p; struct elf_link_hash_entry **p;
p = (struct elf_link_hash_entry **) p = ((struct elf_link_hash_entry **)
bfd_zmalloc (reldata->count * sizeof (struct elf_link_hash_entry *)); bfd_zmalloc (reldata->count * sizeof (*p)));
if (p == NULL) if (p == NULL)
return FALSE; return FALSE;
@ -4384,8 +4384,8 @@ error_free_dyn:
{ {
amt = ((isymend - isym + 1) amt = ((isymend - isym + 1)
* sizeof (struct elf_link_hash_entry *)); * sizeof (struct elf_link_hash_entry *));
nondeflt_vers = nondeflt_vers
(struct elf_link_hash_entry **) bfd_malloc (amt); = (struct elf_link_hash_entry **) bfd_malloc (amt);
if (!nondeflt_vers) if (!nondeflt_vers)
goto error_free_vers; goto error_free_vers;
} }
@ -4860,8 +4860,7 @@ error_free_dyn:
/* Add this bfd to the loaded list. */ /* Add this bfd to the loaded list. */
struct elf_link_loaded_list *n; struct elf_link_loaded_list *n;
n = (struct elf_link_loaded_list *) n = (struct elf_link_loaded_list *) bfd_alloc (abfd, sizeof (*n));
bfd_alloc (abfd, sizeof (struct elf_link_loaded_list));
if (n == NULL) if (n == NULL)
goto error_return; goto error_return;
n->abfd = abfd; n->abfd = abfd;
@ -7267,10 +7266,10 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
if (count1 == 0 || count2 == 0 || count1 != count2) if (count1 == 0 || count2 == 0 || count1 != count2)
goto done; goto done;
symtable1 = (struct elf_symbol *) symtable1
bfd_malloc (count1 * sizeof (struct elf_symbol)); = (struct elf_symbol *) bfd_malloc (count1 * sizeof (*symtable1));
symtable2 = (struct elf_symbol *) symtable2
bfd_malloc (count2 * sizeof (struct elf_symbol)); = (struct elf_symbol *) bfd_malloc (count2 * sizeof (*symtable2));
if (symtable1 == NULL || symtable2 == NULL) if (symtable1 == NULL || symtable2 == NULL)
goto done; goto done;
@ -8945,7 +8944,8 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
|| h->root.type == bfd_link_hash_defweak) || h->root.type == bfd_link_hash_defweak)
&& ((flinfo->info->strip_discarded && ((flinfo->info->strip_discarded
&& discarded_section (h->root.u.def.section)) && discarded_section (h->root.u.def.section))
|| (h->root.u.def.section->owner != NULL || ((h->root.u.def.section->flags & SEC_LINKER_CREATED) == 0
&& h->root.u.def.section->owner != NULL
&& (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0))) && (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0)))
strip = TRUE; strip = TRUE;
else if ((h->root.type == bfd_link_hash_undefined else if ((h->root.type == bfd_link_hash_undefined
@ -9794,8 +9794,10 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
s_type = h->type; s_type = h->type;
/* If a plugin symbol is referenced from a non-IR file, /* If a plugin symbol is referenced from a non-IR file,
mark the symbol as undefined, except for symbol for mark the symbol as undefined. Note that the
linker created section. */ linker may attach linker created dynamic sections
to the plugin bfd. Symbols defined in linker
created sections are not plugin symbols. */
if (h->root.non_ir_ref if (h->root.non_ir_ref
&& (h->root.type == bfd_link_hash_defined && (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak) || h->root.type == bfd_link_hash_defweak)
@ -12519,8 +12521,8 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
win: win:
if (!child->vtable) if (!child->vtable)
{ {
child->vtable = (struct elf_link_virtual_table_entry *) child->vtable = ((struct elf_link_virtual_table_entry *)
bfd_zalloc (abfd, sizeof (*child->vtable)); bfd_zalloc (abfd, sizeof (*child->vtable)));
if (!child->vtable) if (!child->vtable)
return FALSE; return FALSE;
} }
@ -12552,8 +12554,8 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
if (!h->vtable) if (!h->vtable)
{ {
h->vtable = (struct elf_link_virtual_table_entry *) h->vtable = ((struct elf_link_virtual_table_entry *)
bfd_zalloc (abfd, sizeof (*h->vtable)); bfd_zalloc (abfd, sizeof (*h->vtable)));
if (!h->vtable) if (!h->vtable)
return FALSE; return FALSE;
} }