diff mbox

bfd/elf-ifunc.c: Add header size arg to _bfd_elf_allocate_ifunc_dyn_relocs.

Message ID 5188D156.2070602@linaro.org
State Accepted
Headers show

Commit Message

Will Newton May 7, 2013, 10:03 a.m. UTC
bfd/ChangeLog:

2013-05-07  Will Newton  <will.newton@linaro.org>

	* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Add a
	plt_header_size argument for ports where it differs from
	plt_entry_size.
	* elf-bfd.h: Likewise.
	* elf32-i386.c: Pass plt_header_size to
	_bfd_elf_allocate_ifunc_dyn_relocs.
	* elf64-x86-64.c: Likewise.
---
 bfd/elf-bfd.h      | 2 +-
 bfd/elf-ifunc.c    | 3 ++-
 bfd/elf32-i386.c   | 3 ++-
 bfd/elf64-x86-64.c | 1 +
 4 files changed, 6 insertions(+), 3 deletions(-)

Comments

H.J. Lu May 7, 2013, 4:31 p.m. UTC | #1
On Tue, May 7, 2013 at 3:03 AM, Will Newton <will.newton@linaro.org> wrote:
>
> bfd/ChangeLog:
>
> 2013-05-07  Will Newton  <will.newton@linaro.org>
>
>         * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Add a
>         plt_header_size argument for ports where it differs from
>         plt_entry_size.
>         * elf-bfd.h: Likewise.
>         * elf32-i386.c: Pass plt_header_size to
>         _bfd_elf_allocate_ifunc_dyn_relocs.
>         * elf64-x86-64.c: Likewise.
> ---
>  bfd/elf-bfd.h      | 2 +-
>  bfd/elf-ifunc.c    | 3 ++-
>  bfd/elf32-i386.c   | 3 ++-
>  bfd/elf64-x86-64.c | 1 +
>  4 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
> index d1a7e26..4a67d02 100644
> --- a/bfd/elf-bfd.h
> +++ b/bfd/elf-bfd.h
> @@ -2380,7 +2380,7 @@ extern bfd_boolean _bfd_elf_create_ifunc_sections
>    (bfd *, struct bfd_link_info *);
>  extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs
>    (struct bfd_link_info *, struct elf_link_hash_entry *,
> -   struct elf_dyn_relocs **, unsigned int, unsigned int);
> +   struct elf_dyn_relocs **, unsigned int, unsigned int, unsigned int);
>
>  extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *);
>  extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *);
> diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
> index ea08329..8d48e66 100644
> --- a/bfd/elf-ifunc.c
> +++ b/bfd/elf-ifunc.c
> @@ -112,6 +112,7 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
>                                     struct elf_link_hash_entry *h,
>                                     struct elf_dyn_relocs **head,
>                                     unsigned int plt_entry_size,
> +                                   unsigned int plt_header_size,
>                                     unsigned int got_entry_size)
>  {
>    asection *plt, *gotplt, *relplt;
> @@ -193,7 +194,7 @@ keep:
>        /* If this is the first .plt entry, make room for the special
>          first entry.  */
>        if (plt->size == 0)
> -       plt->size += plt_entry_size;
> +       plt->size += plt_header_size;
>      }
>    else
>      {
> diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
> index 2609130..cc8b48e 100644
> --- a/bfd/elf32-i386.c
> +++ b/bfd/elf32-i386.c
> @@ -2197,7 +2197,8 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
>    if (h->type == STT_GNU_IFUNC
>        && h->def_regular)
>      return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs,
> -                                               plt_entry_size, 4);
> +                                               plt_entry_size,
> +                                              plt_entry_size, 4);
>    else if (htab->elf.dynamic_sections_created
>            && h->plt.refcount > 0)
>      {
> diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
> index 9adc959..758231e 100644
> --- a/bfd/elf64-x86-64.c
> +++ b/bfd/elf64-x86-64.c
> @@ -2260,6 +2260,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
>      return _bfd_elf_allocate_ifunc_dyn_relocs (info, h,
>                                                &eh->dyn_relocs,
>                                                plt_entry_size,
> +                                              plt_entry_size,
>                                                GOT_ENTRY_SIZE);
>    else if (htab->elf.dynamic_sections_created
>            && h->plt.refcount > 0)
> --
> 1.8.1.4
>

OK.  Thanks.

--
H.J.
Will Newton May 7, 2013, 5:04 p.m. UTC | #2
On 7 May 2013 17:31, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, May 7, 2013 at 3:03 AM, Will Newton <will.newton@linaro.org> wrote:
>>
>> bfd/ChangeLog:
>>
>> 2013-05-07  Will Newton  <will.newton@linaro.org>
>>
>>         * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Add a
>>         plt_header_size argument for ports where it differs from
>>         plt_entry_size.
>>         * elf-bfd.h: Likewise.
>>         * elf32-i386.c: Pass plt_header_size to
>>         _bfd_elf_allocate_ifunc_dyn_relocs.
>>         * elf64-x86-64.c: Likewise.
>> ---
>>  bfd/elf-bfd.h      | 2 +-
>>  bfd/elf-ifunc.c    | 3 ++-
>>  bfd/elf32-i386.c   | 3 ++-
>>  bfd/elf64-x86-64.c | 1 +
>>  4 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
>> index d1a7e26..4a67d02 100644
>> --- a/bfd/elf-bfd.h
>> +++ b/bfd/elf-bfd.h
>> @@ -2380,7 +2380,7 @@ extern bfd_boolean _bfd_elf_create_ifunc_sections
>>    (bfd *, struct bfd_link_info *);
>>  extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs
>>    (struct bfd_link_info *, struct elf_link_hash_entry *,
>> -   struct elf_dyn_relocs **, unsigned int, unsigned int);
>> +   struct elf_dyn_relocs **, unsigned int, unsigned int, unsigned int);
>>
>>  extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *);
>>  extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *);
>> diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
>> index ea08329..8d48e66 100644
>> --- a/bfd/elf-ifunc.c
>> +++ b/bfd/elf-ifunc.c
>> @@ -112,6 +112,7 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
>>                                     struct elf_link_hash_entry *h,
>>                                     struct elf_dyn_relocs **head,
>>                                     unsigned int plt_entry_size,
>> +                                   unsigned int plt_header_size,
>>                                     unsigned int got_entry_size)
>>  {
>>    asection *plt, *gotplt, *relplt;
>> @@ -193,7 +194,7 @@ keep:
>>        /* If this is the first .plt entry, make room for the special
>>          first entry.  */
>>        if (plt->size == 0)
>> -       plt->size += plt_entry_size;
>> +       plt->size += plt_header_size;
>>      }
>>    else
>>      {
>> diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
>> index 2609130..cc8b48e 100644
>> --- a/bfd/elf32-i386.c
>> +++ b/bfd/elf32-i386.c
>> @@ -2197,7 +2197,8 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
>>    if (h->type == STT_GNU_IFUNC
>>        && h->def_regular)
>>      return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs,
>> -                                               plt_entry_size, 4);
>> +                                               plt_entry_size,
>> +                                              plt_entry_size, 4);
>>    else if (htab->elf.dynamic_sections_created
>>            && h->plt.refcount > 0)
>>      {
>> diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
>> index 9adc959..758231e 100644
>> --- a/bfd/elf64-x86-64.c
>> +++ b/bfd/elf64-x86-64.c
>> @@ -2260,6 +2260,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
>>      return _bfd_elf_allocate_ifunc_dyn_relocs (info, h,
>>                                                &eh->dyn_relocs,
>>                                                plt_entry_size,
>> +                                              plt_entry_size,
>>                                                GOT_ENTRY_SIZE);
>>    else if (htab->elf.dynamic_sections_created
>>            && h->plt.refcount > 0)
>> --
>> 1.8.1.4
>>
>
> OK.  Thanks.
>
> --
> H.J.

Thanks, I applied both patches.

--
Will Newton
Toolchain Working Group, Linaro
diff mbox

Patch

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index d1a7e26..4a67d02 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2380,7 +2380,7 @@  extern bfd_boolean _bfd_elf_create_ifunc_sections
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs
   (struct bfd_link_info *, struct elf_link_hash_entry *,
-   struct elf_dyn_relocs **, unsigned int, unsigned int);
+   struct elf_dyn_relocs **, unsigned int, unsigned int, unsigned int);

 extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *);
 extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *);
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index ea08329..8d48e66 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -112,6 +112,7 @@  _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
 				    struct elf_link_hash_entry *h,
 				    struct elf_dyn_relocs **head,
 				    unsigned int plt_entry_size,
+				    unsigned int plt_header_size,
 				    unsigned int got_entry_size)
 {
   asection *plt, *gotplt, *relplt;
@@ -193,7 +194,7 @@  keep:
       /* If this is the first .plt entry, make room for the special
 	 first entry.  */
       if (plt->size == 0)
-	plt->size += plt_entry_size;
+	plt->size += plt_header_size;
     }
   else
     {
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 2609130..cc8b48e 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2197,7 +2197,8 @@  elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   if (h->type == STT_GNU_IFUNC
       && h->def_regular)
     return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs,
-                                               plt_entry_size, 4);
+                                               plt_entry_size,
+					       plt_entry_size, 4);
   else if (htab->elf.dynamic_sections_created
 	   && h->plt.refcount > 0)
     {
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 9adc959..758231e 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2260,6 +2260,7 @@  elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
     return _bfd_elf_allocate_ifunc_dyn_relocs (info, h,
 					       &eh->dyn_relocs,
 					       plt_entry_size,
+					       plt_entry_size,
 					       GOT_ENTRY_SIZE);
   else if (htab->elf.dynamic_sections_created
 	   && h->plt.refcount > 0)