diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 11 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 16 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 16 |
3 files changed, 39 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3cc8839..3727e35 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2015-05-16 H.J. Lu <hongjiu.lu@intel.com> + + * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section + for now binding. + (elf_i386_allocate_dynrelocs): Use .plt.got section for now + binding. + * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got + section for now binding. + (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now + binding. + 2015-05-14 H.J. Lu <hongjiu.lu@intel.com> * bfd.c (bfd_update_compression_header): Also write the zlib diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 815473d..c6ff746 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1885,7 +1885,7 @@ do_size: if (use_plt_got && h != NULL && h->plt.refcount > 0 - && h->got.refcount > 0 + && ((info->flags & DF_BIND_NOW) || h->got.refcount > 0) && htab->plt_got == NULL) { /* Create the GOT procedure linkage table. */ @@ -2321,7 +2321,19 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else if (htab->elf.dynamic_sections_created && (h->plt.refcount > 0 || eh->plt_got.refcount > 0)) { - bfd_boolean use_plt_got = eh->plt_got.refcount > 0; + bfd_boolean use_plt_got; + + if ((info->flags & DF_BIND_NOW)) + { + /* Don't use the regular PLT for DF_BIND_NOW. */ + h->plt.offset = (bfd_vma) -1; + + /* Use the GOT PLT. */ + h->got.refcount = 1; + eh->plt_got.refcount = 1; + } + + use_plt_got = eh->plt_got.refcount > 0; /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index e9b5601..01df230 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2080,7 +2080,7 @@ do_size: if (use_plt_got && h != NULL && h->plt.refcount > 0 - && h->got.refcount > 0 + && ((info->flags & DF_BIND_NOW) || h->got.refcount > 0) && htab->plt_got == NULL) { /* Create the GOT procedure linkage table. */ @@ -2540,7 +2540,19 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) else if (htab->elf.dynamic_sections_created && (h->plt.refcount > 0 || eh->plt_got.refcount > 0)) { - bfd_boolean use_plt_got = eh->plt_got.refcount > 0; + bfd_boolean use_plt_got; + + if ((info->flags & DF_BIND_NOW)) + { + /* Don't use the regular PLT for DF_BIND_NOW. */ + h->plt.offset = (bfd_vma) -1; + + /* Use the GOT PLT. */ + h->got.refcount = 1; + eh->plt_got.refcount = 1; + } + + use_plt_got = eh->plt_got.refcount > 0; /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ |