diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 28 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 7 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 5 | ||||
-rw-r--r-- | bfd/elf.c | 7 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 8 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 51 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 53 | ||||
-rw-r--r-- | bfd/elfcode.h | 3 | ||||
-rw-r--r-- | bfd/elflink.c | 74 | ||||
-rw-r--r-- | bfd/syms.c | 11 |
10 files changed, 45 insertions, 202 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6cd350f..02ae371 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,31 @@ +2008-12-23 Nick Clifton <nickc@redhat.com> + + * elf-bfd.h (struct bfd_elf_section_data): Remove indirect_relocs + field. + (_bfd_elf_make_ifunc_reloc_section): Remove prototype. + * elf.c (swap_out_syms): Remove STT_IFUNC support. + (elf_find_function): Likewise. + * elf32-arm.c (arm_elf_find_function): Likewise. + (elf32_arm_adjust_dynamic_symbol): Likewise. + (elf32_arm_swap_symbol_in): Likewise. + (elf32_arm_is_function_type): Likewise. + * elf32-i386.c (is_indirect_symbol): Delete. + (elf_i386_check_relocs): Remove STT_IFUNC support. + (allocate_dynrelocs): Likewise. + (elf_i386_relocate_section): Likewise. + * elf64-x86-64.c (is_indirect_symbol): Delete. + (elf64_x86_64_check_relocs): Remove STT_IFUNC support. + (allocate_dynrelocs): Likewise. + (elf64_x86_64_relocate_section): Likewise. + * elfcode.h (elf_slurp_symbol_table): Likewise. + * elflink.c (_bfd_elf_adjust_symbol): Likewise. + (get_ifunc_reloc_section_name): Delete. + (_bfd_elf_make_ifunc_reloc_section): Delete. + * syms.c (BSF_INDIRECT_FUNCTION): Delete. + (bfd_print_symbol_vandf): Remove STT_IFUNC support. + (bfd_decode_symclass): Likewise. + * bfd-in2.h: Regenerate. + 2008-12-20 Hans-Peter Nilsson <hp@axis.com> * elf32-cris.c (cris_elf_howto_table): Add entry for R_CRIS_32_IE. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 37c24b7..75c7785 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -4472,13 +4472,6 @@ typedef struct bfd_symbol perhaps others someday. */ #define BSF_FUNCTION (1 << 3) - /* The symbol is an indirect code object. Unrelated to BSF_INDIRECT. - Relocations against a symbol with this flag have to evaluated at - run-time, where the function pointed to by this symbol is invoked - in order to determine the value to be used in the relocation. - BSF_FUNCTION must also be set for symbols with this flag. */ -#define BSF_INDIRECT_FUNCTION (1 << 4) - /* Used by the linker. */ #define BSF_KEEP (1 << 5) #define BSF_KEEP_G (1 << 6) diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index effa344..5418e7f 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1287,9 +1287,6 @@ struct bfd_elf_section_data /* A pointer to the bfd section used for dynamic relocs. */ asection *sreloc; - /* A pointer to the bfd section used for dynamic relocs against ifunc symbols. */ - asection *indirect_relocs; - union { /* Group name, if this section is a member of a group. */ const char *name; @@ -1771,8 +1768,6 @@ extern asection * _bfd_elf_get_dynamic_reloc_section (bfd *, asection *, bfd_boolean); extern asection * _bfd_elf_make_dynamic_reloc_section (asection *, bfd *, unsigned int, bfd *, bfd_boolean); -extern asection * _bfd_elf_make_ifunc_reloc_section - (bfd *, asection *, bfd *, unsigned int); extern long _bfd_elf_get_dynamic_reloc_upper_bound (bfd *); extern long _bfd_elf_canonicalize_dynamic_reloc @@ -6427,8 +6427,6 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"), if ((flags & BSF_THREAD_LOCAL) != 0) type = STT_TLS; - else if ((flags & BSF_INDIRECT_FUNCTION) != 0) - type = STT_IFUNC; else if ((flags & BSF_FUNCTION) != 0) type = STT_FUNC; else if ((flags & BSF_OBJECT) != 0) @@ -7122,7 +7120,6 @@ elf_find_function (bfd *abfd ATTRIBUTE_UNUSED, continue; case STT_NOTYPE: case STT_FUNC: - case STT_IFUNC: if (bfd_get_section (&q->symbol) == section && q->symbol.value >= low_func && q->symbol.value <= offset) @@ -8941,10 +8938,10 @@ _bfd_elf_set_osabi (bfd * abfd, /* Return TRUE for ELF symbol types that represent functions. This is the default version of this function, which is sufficient for - most targets. It returns true if TYPE is STT_FUNC or STT_IFUNC. */ + most targets. It returns true if TYPE is STT_FUNC. */ bfd_boolean _bfd_elf_is_function_type (unsigned int type) { - return (type == STT_FUNC || type == STT_IFUNC); + return (type == STT_FUNC); } diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index dacbc16..24fa76a 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -9430,7 +9430,6 @@ arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED, filename = bfd_asymbol_name (&q->symbol); break; case STT_FUNC: - case STT_IFUNC: case STT_ARM_TFUNC: case STT_NOTYPE: /* Skip mapping symbols. */ @@ -9556,7 +9555,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ - if (h->type == STT_FUNC || h->type == STT_ARM_TFUNC || h->type == STT_IFUNC + if (h->type == STT_FUNC || h->type == STT_ARM_TFUNC || h->needs_plt) { if (h->plt.refcount <= 0 @@ -11730,8 +11729,7 @@ elf32_arm_swap_symbol_in (bfd * abfd, /* New EABI objects mark thumb function symbols by setting the low bit of the address. Turn these into STT_ARM_TFUNC. */ - if ((ELF_ST_TYPE (dst->st_info) == STT_FUNC - || ELF_ST_TYPE (dst->st_info) == STT_IFUNC) + if ((ELF_ST_TYPE (dst->st_info) == STT_FUNC) && (dst->st_value & 1)) { dst->st_info = ELF_ST_INFO (ELF_ST_BIND (dst->st_info), STT_ARM_TFUNC); @@ -11832,7 +11830,7 @@ elf32_arm_additional_program_headers (bfd *abfd, static bfd_boolean elf32_arm_is_function_type (unsigned int type) { - return (type == STT_FUNC) || (type == STT_ARM_TFUNC) || (type == STT_IFUNC); + return (type == STT_FUNC) || (type == STT_ARM_TFUNC); } /* We use this to override swap_symbol_in and swap_symbol_out. */ diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index ec0c16f..dda6e1f 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1193,26 +1193,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_IFUNC - && bed != NULL - && (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. */ @@ -1472,8 +1452,7 @@ elf_i386_check_relocs (bfd *abfd, && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak - || !h->def_regular)) - || is_indirect_symbol (abfd, h)) + || !h->def_regular))) { struct elf_i386_dyn_relocs *p; struct elf_i386_dyn_relocs **head; @@ -1493,9 +1472,6 @@ elf_i386_check_relocs (bfd *abfd, return FALSE; } - if (is_indirect_symbol (abfd, h)) - (void) _bfd_elf_make_ifunc_reloc_section (abfd, sec, htab->elf.dynobj, 2); - /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) @@ -2057,15 +2033,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } } } - else if (is_indirect_symbol (info->output_bfd, h)) - { - if (h->dynindx == -1 - && !h->forced_local) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - } else if (ELIMINATE_COPY_RELOCS) { /* For the non-shared case, discard space for relocs against @@ -2104,11 +2071,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { asection *sreloc; - if (! info->shared - && is_indirect_symbol (info->output_bfd, h)) - sreloc = elf_section_data (p->sec)->indirect_relocs; - else - sreloc = elf_section_data (p->sec)->sreloc; + sreloc = elf_section_data (p->sec)->sreloc; BFD_ASSERT (sreloc != NULL); sreloc->size += p->count * sizeof (Elf32_External_Rel); @@ -2919,8 +2882,7 @@ elf_i386_relocate_section (bfd *output_bfd, && ((h->def_dynamic && !h->def_regular) || h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_undefined)) - || is_indirect_symbol (output_bfd, h)) + || h->root.type == bfd_link_hash_undefined))) { Elf_Internal_Rela outrel; bfd_byte *loc; @@ -2960,10 +2922,7 @@ elf_i386_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE); } - if ((! info->shared) && is_indirect_symbol (output_bfd, h)) - sreloc = elf_section_data (input_section)->indirect_relocs; - else - sreloc = elf_section_data (input_section)->sreloc; + sreloc = elf_section_data (input_section)->sreloc; BFD_ASSERT (sreloc != NULL && sreloc->contents != NULL); @@ -2976,7 +2935,7 @@ elf_i386_relocate_section (bfd *output_bfd, not want to fiddle with the addend. Otherwise, we need to include the symbol value so that it becomes an addend for the dynamic reloc. */ - if (! relocate || is_indirect_symbol (output_bfd, h)) + if (! relocate) continue; } break; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 1ea033b..7e8a0fd 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -974,26 +974,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_IFUNC - && bed != NULL - && (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. */ @@ -1275,10 +1255,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, If on the other hand, we are creating an executable, we may need to keep relocations for symbols satisfied by a dynamic library if we manage to avoid copy relocs for the - symbol. + symbol. */ - Also we must keep any relocations against IFUNC symbols as - they will be evaluated at load time. */ if ((info->shared && (sec->flags & SEC_ALLOC) != 0 && (((r_type != R_X86_64_PC8) @@ -1294,8 +1272,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak - || !h->def_regular)) - || is_indirect_symbol (abfd, h)) + || !h->def_regular))) { struct elf64_x86_64_dyn_relocs *p; struct elf64_x86_64_dyn_relocs **head; @@ -1315,9 +1292,6 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, return FALSE; } - if (is_indirect_symbol (abfd, h)) - (void) _bfd_elf_make_ifunc_reloc_section (abfd, sec, htab->elf.dynobj, 2); - /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) @@ -1857,13 +1831,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) } } } - else if (is_indirect_symbol (info->output_bfd, h)) - { - if (h->dynindx == -1 - && ! h->forced_local - && ! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } else if (ELIMINATE_COPY_RELOCS) { /* For the non-shared case, discard space for relocs against @@ -1902,11 +1869,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { asection * sreloc; - if (! info->shared - && is_indirect_symbol (info->output_bfd, h)) - sreloc = elf_section_data (p->sec)->indirect_relocs; - else - sreloc = elf_section_data (p->sec)->sreloc; + sreloc = elf_section_data (p->sec)->sreloc; BFD_ASSERT (sreloc != NULL); @@ -2721,8 +2684,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && ((h->def_dynamic && !h->def_regular) || h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_undefined)) - || is_indirect_symbol (output_bfd, h)) + || h->root.type == bfd_link_hash_undefined))) { Elf_Internal_Rela outrel; bfd_byte *loc; @@ -2808,10 +2770,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } } - if ((! info->shared) && is_indirect_symbol (output_bfd, h)) - sreloc = elf_section_data (input_section)->indirect_relocs; - else - sreloc = elf_section_data (input_section)->sreloc; + sreloc = elf_section_data (input_section)->sreloc; BFD_ASSERT (sreloc != NULL && sreloc->contents != NULL); @@ -2823,7 +2782,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, not want to fiddle with the addend. Otherwise, we need to include the symbol value so that it becomes an addend for the dynamic reloc. */ - if (! relocate || is_indirect_symbol (output_bfd, h)) + if (! relocate) continue; } diff --git a/bfd/elfcode.h b/bfd/elfcode.h index cd8ffe4..b42229f 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1311,9 +1311,6 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic) case STT_SRELC: sym->symbol.flags |= BSF_SRELC; break; - case STT_IFUNC: - sym->symbol.flags |= BSF_INDIRECT_FUNCTION; - break; } if (dynamic) diff --git a/bfd/elflink.c b/bfd/elflink.c index 952b4e0..92b40e9 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2653,12 +2653,6 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) dynobj = elf_hash_table (eif->info)->dynobj; bed = get_elf_backend_data (dynobj); - if (h->type == STT_IFUNC - && (bed->elf_osabi == ELFOSABI_LINUX - /* GNU/Linux is still using the default value 0. */ - || bed->elf_osabi == ELFOSABI_NONE)) - h->needs_plt = 1; - if (! (*bed->elf_backend_adjust_dynamic_symbol) (eif->info, h)) { eif->failed = TRUE; @@ -12407,71 +12401,3 @@ _bfd_elf_make_dynamic_reloc_section (asection * sec, return reloc_sec; } - -#define IFUNC_INFIX ".ifunc" - -/* Returns the name of the ifunc-using-dynamic-reloc section associated with SEC. */ - -static const char * -get_ifunc_reloc_section_name (bfd * abfd, - asection * sec) -{ - const char * dot; - char * name; - const char * base_name; - unsigned int strndx = elf_elfheader (abfd)->e_shstrndx; - unsigned int shnam = elf_section_data (sec)->rel_hdr.sh_name; - - base_name = bfd_elf_string_from_elf_section (abfd, strndx, shnam); - if (base_name == NULL) - return NULL; - - dot = strchr (base_name + 1, '.'); - name = bfd_alloc (abfd, strlen (base_name) + strlen (IFUNC_INFIX) + 1); - sprintf (name, "%.*s%s%s", (int)(dot - base_name), base_name, IFUNC_INFIX, dot); - - return name; -} - -/* Like _bfd_elf_make_dynamic_reloc_section but it creates a - section for holding relocs against symbols with the STT_IFUNC - type. The section is attached to the OWNER bfd but it is created - with a name based on SEC from ABFD. */ - -asection * -_bfd_elf_make_ifunc_reloc_section (bfd * abfd, - asection * sec, - bfd * owner, - unsigned int align) -{ - asection * reloc_sec = elf_section_data (sec)->indirect_relocs; - - if (reloc_sec == NULL) - { - const char * name = get_ifunc_reloc_section_name (abfd, sec); - - if (name == NULL) - return NULL; - - reloc_sec = bfd_get_section_by_name (owner, name); - - if (reloc_sec == NULL) - { - flagword flags; - - flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if ((sec->flags & SEC_ALLOC) != 0) - flags |= SEC_ALLOC | SEC_LOAD; - - reloc_sec = bfd_make_section_with_flags (owner, name, flags); - - if (reloc_sec != NULL - && ! bfd_set_section_alignment (owner, reloc_sec, align)) - reloc_sec = NULL; - } - - elf_section_data (sec)->indirect_relocs = reloc_sec; - } - - return reloc_sec; -} @@ -231,13 +231,6 @@ CODE_FRAGMENT . perhaps others someday. *} .#define BSF_FUNCTION (1 << 3) . -. {* The symbol is an indirect code object. Unrelated to BSF_INDIRECT. -. Relocations against a symbol with this flag have to evaluated at -. run-time, where the function pointed to by this symbol is invoked -. in order to determine the value to be used in the relocation. -. BSF_FUNCTION must also be set for symbols with this flag. *} -.#define BSF_INDIRECT_FUNCTION (1 << 4) -. . {* Used by the linker. *} .#define BSF_KEEP (1 << 5) .#define BSF_KEEP_G (1 << 6) @@ -490,7 +483,7 @@ bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol) (type & BSF_WEAK) ? 'w' : ' ', (type & BSF_CONSTRUCTOR) ? 'C' : ' ', (type & BSF_WARNING) ? 'W' : ' ', - (type & BSF_INDIRECT) ? 'I' : (type & BSF_INDIRECT_FUNCTION) ? 'i' : ' ', + (type & BSF_INDIRECT) ? 'I' : ' ', (type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ', ((type & BSF_FUNCTION) ? 'F' @@ -676,8 +669,6 @@ bfd_decode_symclass (asymbol *symbol) } if (bfd_is_ind_section (symbol->section)) return 'I'; - if (symbol->flags & BSF_INDIRECT_FUNCTION) - return 'i'; if (symbol->flags & BSF_WEAK) { /* If weak, determine if it's specifically an object |