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:
parent
dddcc5b9a8
commit
ca4be51cd8
2 changed files with 35 additions and 26 deletions
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -4451,7 +4451,7 @@ error_free_dyn:
|
||||||
}
|
}
|
||||||
|
|
||||||
elf_dyn_lib_class (abfd) = (enum dynamic_lib_link_class)
|
elf_dyn_lib_class (abfd) = (enum dynamic_lib_link_class)
|
||||||
(elf_dyn_lib_class (abfd) & ~DYN_AS_NEEDED);
|
(elf_dyn_lib_class (abfd) & ~DYN_AS_NEEDED);
|
||||||
|
|
||||||
add_needed = TRUE;
|
add_needed = TRUE;
|
||||||
ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
|
ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
|
||||||
|
@ -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;
|
||||||
|
@ -5422,7 +5421,7 @@ compute_bucket_count (struct bfd_link_info *info ATTRIBUTE_UNUSED,
|
||||||
{
|
{
|
||||||
best_chlen = max;
|
best_chlen = max;
|
||||||
best_size = i;
|
best_size = i;
|
||||||
no_improvement_count = 0;
|
no_improvement_count = 0;
|
||||||
}
|
}
|
||||||
/* PR 11843: Avoid futile long searches for the best bucket size
|
/* PR 11843: Avoid futile long searches for the best bucket size
|
||||||
when there are a large number of symbols. */
|
when there are a large number of symbols. */
|
||||||
|
@ -6716,7 +6715,7 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
{
|
{
|
||||||
entry = (struct bfd_hash_entry *)
|
entry = (struct bfd_hash_entry *)
|
||||||
bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
|
bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -8599,7 +8598,7 @@ elf_link_output_sym (struct elf_final_link_info *flinfo,
|
||||||
|
|
||||||
amt = flinfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
|
amt = flinfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
|
||||||
destshndx = (Elf_External_Sym_Shndx *) bfd_realloc (destshndx,
|
destshndx = (Elf_External_Sym_Shndx *) bfd_realloc (destshndx,
|
||||||
amt * 2);
|
amt * 2);
|
||||||
if (destshndx == NULL)
|
if (destshndx == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
flinfo->symshndxbuf = destshndx;
|
flinfo->symshndxbuf = destshndx;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -13211,11 +13213,11 @@ _bfd_elf_get_dynamic_reloc_section (bfd * abfd,
|
||||||
string table associated with ABFD. */
|
string table associated with ABFD. */
|
||||||
|
|
||||||
asection *
|
asection *
|
||||||
_bfd_elf_make_dynamic_reloc_section (asection * sec,
|
_bfd_elf_make_dynamic_reloc_section (asection *sec,
|
||||||
bfd * dynobj,
|
bfd *dynobj,
|
||||||
unsigned int alignment,
|
unsigned int alignment,
|
||||||
bfd * abfd,
|
bfd *abfd,
|
||||||
bfd_boolean is_rela)
|
bfd_boolean is_rela)
|
||||||
{
|
{
|
||||||
asection * reloc_sec = elf_section_data (sec)->sreloc;
|
asection * reloc_sec = elf_section_data (sec)->sreloc;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue