i386: Check VxWorks with htab->is_vxworks

* elf32-i386.c (elf_i386_allocate_dynrelocs): Check VxWorks
	with htab->is_vxworks.
	(elf_i386_size_dynamic_sections): Likewise.
	(elf_i386_relocate_section): Likewise.
	(elf_i386_finish_dynamic_symbol): Likewise.
	(elf_i386_finish_dynamic_sections): Likewise.
This commit is contained in:
H.J. Lu
2017-09-02 05:05:30 -07:00
parent 6b9553e2a5
commit 9a742a902f
2 changed files with 17 additions and 15 deletions

View File

@ -1,3 +1,12 @@
2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (elf_i386_allocate_dynrelocs): Check VxWorks
with htab->is_vxworks.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(elf_i386_finish_dynamic_sections): Likewise.
2017-09-02 H.J. Lu <hongjiu.lu@intel.com> 2017-09-02 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG, * elf32-i386.c (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG,

View File

@ -1971,7 +1971,6 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
struct elf_dyn_relocs *p; struct elf_dyn_relocs *p;
unsigned plt_entry_size; unsigned plt_entry_size;
bfd_boolean resolved_to_zero; bfd_boolean resolved_to_zero;
const struct elf_i386_backend_data *bed;
if (h->root.type == bfd_link_hash_indirect) if (h->root.type == bfd_link_hash_indirect)
return TRUE; return TRUE;
@ -1983,8 +1982,6 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
if (htab == NULL) if (htab == NULL)
return FALSE; return FALSE;
bed = get_elf_i386_backend_data (info->output_bfd);
plt_entry_size = htab->plt.plt_entry_size; plt_entry_size = htab->plt.plt_entry_size;
resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info,
@ -2144,7 +2141,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
} }
} }
if (bed->os == is_vxworks && !bfd_link_pic (info)) if (htab->is_vxworks && !bfd_link_pic (info))
{ {
/* VxWorks has a second set of relocations for each PLT entry /* VxWorks has a second set of relocations for each PLT entry
in executables. They go in a separate relocation section, in executables. They go in a separate relocation section,
@ -2281,7 +2278,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
} }
} }
if (bed->os == is_vxworks) if (htab->is_vxworks)
{ {
struct elf_dyn_relocs **pp; struct elf_dyn_relocs **pp;
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
@ -2595,8 +2592,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
linker script /DISCARD/, so we'll be discarding linker script /DISCARD/, so we'll be discarding
the relocs too. */ the relocs too. */
} }
else if ((get_elf_i386_backend_data (output_bfd)->os else if (htab->is_vxworks
== is_vxworks)
&& strcmp (p->sec->output_section->name, && strcmp (p->sec->output_section->name,
".tls_vars") == 0) ".tls_vars") == 0)
{ {
@ -2927,7 +2923,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
return FALSE; return FALSE;
} }
} }
if (get_elf_i386_backend_data (output_bfd)->os == is_vxworks if (htab->is_vxworks
&& !elf_vxworks_add_dynamic_entries (output_bfd, info)) && !elf_vxworks_add_dynamic_entries (output_bfd, info))
return FALSE; return FALSE;
} }
@ -3027,8 +3023,7 @@ elf_i386_relocate_section (bfd *output_bfd,
local_tlsdesc_gotents = elf_x86_local_tlsdesc_gotent (input_bfd); local_tlsdesc_gotents = elf_x86_local_tlsdesc_gotent (input_bfd);
/* We have to handle relocations in vxworks .tls_vars sections /* We have to handle relocations in vxworks .tls_vars sections
specially, because the dynamic loader is 'weird'. */ specially, because the dynamic loader is 'weird'. */
is_vxworks_tls = ((get_elf_i386_backend_data (output_bfd)->os is_vxworks_tls = (htab->is_vxworks
== is_vxworks)
&& bfd_link_pic (info) && bfd_link_pic (info)
&& !strcmp (input_section->output_section->name, && !strcmp (input_section->output_section->name,
".tls_vars")); ".tls_vars"));
@ -4583,7 +4578,6 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
{ {
struct elf_x86_link_hash_table *htab; struct elf_x86_link_hash_table *htab;
unsigned plt_entry_size; unsigned plt_entry_size;
const struct elf_i386_backend_data *abed;
struct elf_x86_link_hash_entry *eh; struct elf_x86_link_hash_entry *eh;
bfd_boolean local_undefweak; bfd_boolean local_undefweak;
bfd_boolean use_plt_second; bfd_boolean use_plt_second;
@ -4592,7 +4586,6 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
if (htab == NULL) if (htab == NULL)
return FALSE; return FALSE;
abed = get_elf_i386_backend_data (output_bfd);
plt_entry_size = htab->plt.plt_entry_size; plt_entry_size = htab->plt.plt_entry_size;
/* Use the second PLT section only if there is .plt section. */ /* Use the second PLT section only if there is .plt section. */
@ -4701,7 +4694,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
resolved_plt->contents + plt_offset resolved_plt->contents + plt_offset
+ htab->plt.plt_got_offset); + htab->plt.plt_got_offset);
if (abed->os == is_vxworks) if (htab->is_vxworks)
{ {
int s, k, reloc_index; int s, k, reloc_index;
@ -5119,7 +5112,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
switch (dyn.d_tag) switch (dyn.d_tag)
{ {
default: default:
if (abed->os == is_vxworks if (htab->is_vxworks
&& elf_vxworks_finish_dynamic_entry (output_bfd, &dyn)) && elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
break; break;
continue; continue;
@ -5174,7 +5167,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
htab->elf.splt->contents htab->elf.splt->contents
+ htab->lazy_plt->plt0_got2_offset); + htab->lazy_plt->plt0_got2_offset);
if (abed->os == is_vxworks) if (htab->is_vxworks)
{ {
Elf_Internal_Rela rel; Elf_Internal_Rela rel;
int num_plts = (htab->elf.splt->size int num_plts = (htab->elf.splt->size