This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed, PATCH] i386: Check VxWorks with htab->is_vxworks
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sat, 2 Sep 2017 05:06:36 -0700
- Subject: [committed, PATCH] i386: Check VxWorks with htab->is_vxworks
- Authentication-results: sourceware.org; auth=none
* 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.
---
bfd/ChangeLog | 9 +++++++++
bfd/elf32-i386.c | 23 ++++++++---------------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2bcee4929c..554c1e7520 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,14 @@
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>
+
* elf32-i386.c (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG,
GOT_TLS_IE_BOTH, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P,
GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Moved to ...
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 252a09d424..3d8a4ae897 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1971,7 +1971,6 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
struct elf_dyn_relocs *p;
unsigned plt_entry_size;
bfd_boolean resolved_to_zero;
- const struct elf_i386_backend_data *bed;
if (h->root.type == bfd_link_hash_indirect)
return TRUE;
@@ -1983,8 +1982,6 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
if (htab == NULL)
return FALSE;
- bed = get_elf_i386_backend_data (info->output_bfd);
-
plt_entry_size = htab->plt.plt_entry_size;
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
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;
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
the relocs too. */
}
- else if ((get_elf_i386_backend_data (output_bfd)->os
- == is_vxworks)
+ else if (htab->is_vxworks
&& strcmp (p->sec->output_section->name,
".tls_vars") == 0)
{
@@ -2927,7 +2923,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
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))
return FALSE;
}
@@ -3027,8 +3023,7 @@ elf_i386_relocate_section (bfd *output_bfd,
local_tlsdesc_gotents = elf_x86_local_tlsdesc_gotent (input_bfd);
/* We have to handle relocations in vxworks .tls_vars sections
specially, because the dynamic loader is 'weird'. */
- is_vxworks_tls = ((get_elf_i386_backend_data (output_bfd)->os
- == is_vxworks)
+ is_vxworks_tls = (htab->is_vxworks
&& bfd_link_pic (info)
&& !strcmp (input_section->output_section->name,
".tls_vars"));
@@ -4583,7 +4578,6 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
{
struct elf_x86_link_hash_table *htab;
unsigned plt_entry_size;
- const struct elf_i386_backend_data *abed;
struct elf_x86_link_hash_entry *eh;
bfd_boolean local_undefweak;
bfd_boolean use_plt_second;
@@ -4592,7 +4586,6 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
if (htab == NULL)
return FALSE;
- abed = get_elf_i386_backend_data (output_bfd);
plt_entry_size = htab->plt.plt_entry_size;
/* 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
+ htab->plt.plt_got_offset);
- if (abed->os == is_vxworks)
+ if (htab->is_vxworks)
{
int s, k, reloc_index;
@@ -5119,7 +5112,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
switch (dyn.d_tag)
{
default:
- if (abed->os == is_vxworks
+ if (htab->is_vxworks
&& elf_vxworks_finish_dynamic_entry (output_bfd, &dyn))
break;
continue;
@@ -5174,7 +5167,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
htab->elf.splt->contents
+ htab->lazy_plt->plt0_got2_offset);
- if (abed->os == is_vxworks)
+ if (htab->is_vxworks)
{
Elf_Internal_Rela rel;
int num_plts = (htab->elf.splt->size
--
2.13.5