From 68d7e96a436ae00396227dca4668999b7a4bceef Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 26 May 2009 22:18:22 +0000 Subject: [PATCH] 2009-05-26 H.J. Lu * elf-bfd.h (_bfd_elf_is_ifunc_symbol): New. * elf32-i386.c (is_indirect_symbol): Renamed to ... * elflink.c (_bfd_elf_is_ifunc_symbol): This. * elf32-i386.c (allocate_dynrelocs): Updated. (elf_i386_relocate_section): Likewise. * elf64-x86-64.c (allocate_dynrelocs): Likewise. (elf64_x86_64_relocate_section): Likewise. * elf64-x86-64.c (is_indirect_symbol): Removed. --- bfd/ChangeLog | 14 ++++++++++++++ bfd/elf-bfd.h | 3 +++ bfd/elf32-i386.c | 25 +++---------------------- bfd/elf64-x86-64.c | 25 +++---------------------- bfd/elflink.c | 19 +++++++++++++++++++ 5 files changed, 42 insertions(+), 44 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b0b5bd80d2..8d2283e34e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2009-05-26 H.J. Lu + + * elf-bfd.h (_bfd_elf_is_ifunc_symbol): New. + + * elf32-i386.c (is_indirect_symbol): Renamed to ... + * elflink.c (_bfd_elf_is_ifunc_symbol): This. + + * elf32-i386.c (allocate_dynrelocs): Updated. + (elf_i386_relocate_section): Likewise. + * elf64-x86-64.c (allocate_dynrelocs): Likewise. + (elf64_x86_64_relocate_section): Likewise. + + * elf64-x86-64.c (is_indirect_symbol): Removed. + 2009-05-26 Nick Clifton * po/id.po: Updated Indonesian translation. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 2fbff305e1..adac206e45 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -2155,6 +2155,9 @@ extern asection * _bfd_elf_make_ifunc_reloc_section /* Large common section. */ extern asection _bfd_elf_large_com_section; +extern bfd_boolean _bfd_elf_is_ifunc_symbol + (bfd *, struct elf_link_hash_entry *); + /* This is the condition under which finish_dynamic_symbol will be called. If our finish_dynamic_symbol isn't called, we'll need to do something about initializing any .plt and .got entries in relocate_section. */ diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index c0276c0cc6..88aa1ec238 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1196,25 +1196,6 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd, return TRUE; } -/* Returns true if the hash entry refers to a symbol - marked for indirect handling during reloc processing. */ - -static bfd_boolean -is_indirect_symbol (bfd * abfd, struct elf_link_hash_entry * h) -{ - const struct elf_backend_data * bed; - - if (abfd == NULL || h == NULL) - return FALSE; - - bed = get_elf_backend_data (abfd); - - return h->type == STT_GNU_IFUNC - && (bed->elf_osabi == ELFOSABI_LINUX - /* GNU/Linux is still using the default value 0. */ - || bed->elf_osabi == ELFOSABI_NONE); -} - /* Look through the relocs for a section during the first phase, and calculate needed space in the global offset table, procedure linkage table, and dynamic reloc sections. */ @@ -2062,7 +2043,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } } } - else if (is_indirect_symbol (info->output_bfd, h) + else if (_bfd_elf_is_ifunc_symbol (info->output_bfd, h) && h->dynindx == -1 && ! h->forced_local) { @@ -2921,7 +2902,7 @@ elf_i386_relocate_section (bfd *output_bfd, && h->dynindx != -1 && ! h->forced_local && ((struct elf_i386_link_hash_entry *) h)->dyn_relocs != NULL - && is_indirect_symbol (output_bfd, h)) + && _bfd_elf_is_ifunc_symbol (output_bfd, h)) || (ELIMINATE_COPY_RELOCS && !info->shared && h != NULL @@ -2974,7 +2955,7 @@ elf_i386_relocate_section (bfd *output_bfd, && h != NULL && h->dynindx != -1 && ! h->forced_local - && is_indirect_symbol (output_bfd, h) + && _bfd_elf_is_ifunc_symbol (output_bfd, h) && elf_section_data (input_section)->indirect_relocs != NULL && elf_section_data (input_section)->indirect_relocs->contents != NULL) sreloc = elf_section_data (input_section)->indirect_relocs; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index b82bcd11b7..6b7f17ac6e 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -983,25 +983,6 @@ elf64_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd, return TRUE; } -/* Returns true if the hash entry refers to a symbol - marked for indirect handling during reloc processing. */ - -static bfd_boolean -is_indirect_symbol (bfd * abfd, struct elf_link_hash_entry * h) -{ - const struct elf_backend_data * bed; - - if (abfd == NULL || h == NULL) - return FALSE; - - bed = get_elf_backend_data (abfd); - - return h->type == STT_GNU_IFUNC - && (bed->elf_osabi == ELFOSABI_LINUX - /* GNU/Linux is still using the default value 0. */ - || bed->elf_osabi == ELFOSABI_NONE); -} - /* Look through the relocs for a section during the first phase, and calculate needed space in the global offset table, procedure linkage table, and dynamic reloc sections. */ @@ -1860,7 +1841,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) return FALSE; } } - else if (is_indirect_symbol (info->output_bfd, h) + else if (_bfd_elf_is_ifunc_symbol (info->output_bfd, h) && h->dynindx == -1 && ! h->forced_local) { @@ -2718,7 +2699,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && h->dynindx != -1 && ! h->forced_local && ((struct elf64_x86_64_link_hash_entry *) h)->dyn_relocs != NULL - && is_indirect_symbol (output_bfd, h)) + && _bfd_elf_is_ifunc_symbol (output_bfd, h)) || (ELIMINATE_COPY_RELOCS && !info->shared && h != NULL @@ -2814,7 +2795,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && h != NULL && h->dynindx != -1 && ! h->forced_local - && is_indirect_symbol (output_bfd, h) + && _bfd_elf_is_ifunc_symbol (output_bfd, h) && elf_section_data (input_section)->indirect_relocs != NULL && elf_section_data (input_section)->indirect_relocs->contents != NULL) sreloc = elf_section_data (input_section)->indirect_relocs; diff --git a/bfd/elflink.c b/bfd/elflink.c index 5e36d125fa..cb5ca09404 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -12553,3 +12553,22 @@ _bfd_elf_make_ifunc_reloc_section (bfd * abfd, return reloc_sec; } + +/* Returns true if the hash entry refers to a symbol marked for + indirect handling during reloc processing. */ + +bfd_boolean +_bfd_elf_is_ifunc_symbol (bfd *abfd, struct elf_link_hash_entry *h) +{ + const struct elf_backend_data * bed; + + if (abfd == NULL || h == NULL) + return FALSE; + + bed = get_elf_backend_data (abfd); + + /* GNU/Linux is still using the default value ELFOSABI_NONE. */ + return (h->type == STT_GNU_IFUNC + && (bed->elf_osabi == ELFOSABI_LINUX + || bed->elf_osabi == ELFOSABI_NONE)); +}