From 0f88be7a13937526f4789565a7dee988bf1369d5 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 23 Dec 2008 09:01:51 +0000 Subject: [PATCH] Remove STT_IFUNC support. --- bfd/ChangeLog | 28 +++++ bfd/bfd-in2.h | 7 -- bfd/elf-bfd.h | 5 - bfd/elf.c | 7 +- bfd/elf32-arm.c | 8 +- bfd/elf32-i386.c | 51 +------- bfd/elf64-x86-64.c | 53 +------- bfd/elfcode.h | 3 - bfd/elflink.c | 74 ----------- bfd/syms.c | 11 +- binutils/ChangeLog | 7 ++ binutils/doc/binutils.texi | 4 - binutils/objdump.c | 2 - binutils/readelf.c | 41 +------ gas/ChangeLog | 6 + gas/NEWS | 5 - gas/config/obj-elf.c | 14 --- gas/doc/as.texinfo | 8 -- gas/testsuite/ChangeLog | 5 + gas/testsuite/gas/elf/type.e | 1 - gas/testsuite/gas/elf/type.s | 4 - include/elf/ChangeLog | 4 + include/elf/common.h | 1 - ld/ChangeLog | 4 + ld/NEWS | 4 - ld/testsuite/ChangeLog | 9 ++ ld/testsuite/ld-i386/i386.exp | 1 - ld/testsuite/ld-i386/ifunc.d | 14 --- ld/testsuite/ld-i386/ifunc.s | 128 ------------------- ld/testsuite/ld-x86-64/ifunc.d | 14 --- ld/testsuite/ld-x86-64/ifunc.s | 198 ------------------------------ ld/testsuite/ld-x86-64/x86-64.exp | 2 +- 32 files changed, 83 insertions(+), 640 deletions(-) delete mode 100644 ld/testsuite/ld-i386/ifunc.d delete mode 100644 ld/testsuite/ld-i386/ifunc.s delete mode 100644 ld/testsuite/ld-x86-64/ifunc.d delete mode 100644 ld/testsuite/ld-x86-64/ifunc.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6cd350fd8ac..02ae371ad13 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,31 @@ +2008-12-23 Nick Clifton + + * 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 * 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 37c24b7eed7..75c7785a860 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 effa34478b3..5418e7f82ef 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 diff --git a/bfd/elf.c b/bfd/elf.c index 7597d010ca9..70ed7656d0b 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -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 dacbc16c60e..24fa76a4361 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 ec0c16fd83e..dda6e1fa225 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 1ea033bda04..7e8a0fd980f 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 cd8ffe4d805..b42229f007b 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 952b4e0bb97..92b40e9d9f7 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; -} diff --git a/bfd/syms.c b/bfd/syms.c index 9b4c6524497..9a7cbdaad04 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -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 diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 87f139ce7f8..241e6b0f976 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2008-12-23 Nick Clifton + + * objdump.c (dump_reloc_set): Remove STT_IFUNC support. + * readelf.c (dump_relocations): Likewise. + (get_symbol_type): Likewise. + * doc/binutils.texi: Likewise. + 2008-12-18 Ralf Wildenhues * configure: Regenerate. diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 4c1f02423a1..d816e7a1965 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -729,10 +729,6 @@ The symbol is in an initialized data section for small objects. Some object file formats permit more efficient access to small data objects, such as a global int variable as opposed to a large global array. -@item I -The symbol is an indirect reference to another symbol. This is a @sc{gnu} -extension to the a.out object file format which is rarely used. - @item i The symbol is in a section specific to the implementation of DLLs. diff --git a/binutils/objdump.c b/binutils/objdump.c index ac5fa0d4afd..8bfb2a5eb5b 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -2722,8 +2722,6 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) if (sym_name) { objdump_print_symname (abfd, NULL, *q->sym_ptr_ptr); - if ((*q->sym_ptr_ptr)->flags & BSF_INDIRECT_FUNCTION) - printf ("() "); } else { diff --git a/binutils/readelf.c b/binutils/readelf.c index 81cde343e59..21af7b33db2 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -1251,38 +1251,9 @@ dump_relocations (FILE *file, printf (" "); - if (ELF_ST_TYPE (psym->st_info) == STT_IFUNC) - { - const char * name; - unsigned int len; - unsigned int width = is_32bit_elf ? 8 : 14; - - /* Relocations against IFUNC symbols do not use the value of - the symbol as the address to relocate against. Instead - they invoke the function named by the symbol and use its - result as the address for relocation. - - To indicate this to the user, do not display the value of - the symbol in the "Symbols's Value" field. Instead show - its name followed by () as a hint that the symbol is - invoked. */ - - if (strtab == NULL - || psym->st_name == 0 - || psym->st_name >= strtablen) - name = "??"; - else - name = strtab + psym->st_name; - - len = print_symbol (width, name); - printf ("()%-*s", len <= width ? (width + 1) - len : 1, " "); - } - else - { - print_vma (psym->st_value, LONG_HEX); + print_vma (psym->st_value, LONG_HEX); - printf (is_32bit_elf ? " " : " "); - } + printf (is_32bit_elf ? " " : " "); if (psym->st_name == 0) { @@ -7065,14 +7036,6 @@ get_symbol_type (unsigned int type) if (type == STT_HP_STUB) return "HP_STUB"; } - else if (elf_header.e_ident[EI_OSABI] == ELFOSABI_LINUX - || elf_header.e_ident[EI_OSABI] == ELFOSABI_HURD - /* GNU/Linux is still using the default value 0. */ - || elf_header.e_ident[EI_OSABI] == ELFOSABI_NONE) - { - if (type == STT_IFUNC) - return "IFUNC"; - } snprintf (buff, sizeof (buff), _(": %d"), type); } diff --git a/gas/ChangeLog b/gas/ChangeLog index adf99e2d24e..27e0f82ed00 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2008-12-23 Nick Clifton + + * NEWS :Remove mention of STT_IFUNC support. + * config/obj-elf.c (obj_elf_type): Remove STT_IFUNC support. + * doc/as.texinfo: Remove mention of STT_IFUNC support. + 2008-12-21 Hans-Peter Nilsson * config/tc-cris.c (s_cris_dtpoff): New function. diff --git a/gas/NEWS b/gas/NEWS index 327782f2985..16324d6ce3a 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -1,10 +1,5 @@ -*- text -*- -* The .type pseudo-op now accepts a type of STT_IFUNC which can be used to - indicate that if the symbol is the target of a relocation, its value should - not be used. Instead the function should be invoked and its result used as - the value. - Changes in 2.19: * New pseudo op .cfi_val_encoded_addr, to record constant addresses in unwind diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 0f0c7d30406..cf3177087ab 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -1663,20 +1663,6 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED) } } } - else if (strcmp (typename, "indirect_function") == 0 - || strcmp (typename, "10") == 0 - || strcmp (typename, "STT_IFUNC") == 0) - { - const struct elf_backend_data *bed; - - bed = get_elf_backend_data (stdoutput); - if (!(bed->elf_osabi == ELFOSABI_LINUX - /* GNU/Linux is still using the default value 0. */ - || bed->elf_osabi == ELFOSABI_NONE)) - as_bad (_("symbol type \"%s\" is supported only by GNU targets"), - typename); - type = BSF_FUNCTION | BSF_INDIRECT_FUNCTION; - } #ifdef md_elf_symbol_type else if ((type = md_elf_symbol_type (typename, sym, elfsym)) != -1) ; diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index d1f60dd2177..d8748dd5129 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -6293,14 +6293,6 @@ Mark the symbol as being a common data object. @itemx notype Does not mark the symbol in any way. It is supported just for completeness. -@item STT_IFUNC -@itemx indirect_function -Mark the symbol as an indirect function. This has the same semantics as -STT_FUNC except when the symbol is referenced by a relocation. In this case -the symbol's value is not used in the relocation but instead the symbol is -invoked as a function taking no arguments and the return value is used in the -relocation. This also means that processing of the relocation must be delayed -until run-time. (This is only supported on some targets). @end table Note: Some targets support extra types in addition to those listed above. diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 9dae6c3fbf1..587c0704bbd 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-12-23 Nick Clifton + + * gas/elf/type.s: Remove test of STT_IFUNC support. + * gas/elf/type.e: Update expected output. + 2008-12-21 Hans-Peter Nilsson * gas/cris/rd-dtpoffd1.d, gas/cris/rd-dtpoffd1.s: New test. diff --git a/gas/testsuite/gas/elf/type.e b/gas/testsuite/gas/elf/type.e index 2eb352d1d06..50a49ab9572 100644 --- a/gas/testsuite/gas/elf/type.e +++ b/gas/testsuite/gas/elf/type.e @@ -1,5 +1,4 @@ .: 0+0 1 FUNC LOCAL DEFAULT . function - .: 0+1 1 IFUNC LOCAL DEFAULT . indirect_function .: 0+0 1 OBJECT LOCAL DEFAULT . object .: 0+1 1 TLS LOCAL DEFAULT . tls_object .: 0+2 1 NOTYPE LOCAL DEFAULT . notype diff --git a/gas/testsuite/gas/elf/type.s b/gas/testsuite/gas/elf/type.s index 5a6476cd20c..11f75bf53c7 100644 --- a/gas/testsuite/gas/elf/type.s +++ b/gas/testsuite/gas/elf/type.s @@ -2,10 +2,6 @@ .size function,1 .type function,%function function: - .byte 0x0 - .size indirect_function,1 - .type indirect_function,%indirect_function -indirect_function: .byte 0x0 .data .type object,%object diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index b4025b1dcf8..1737327b213 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,7 @@ +2008-12-23 Nick Clifton + + * commmon.h (STT_IFUNC): Delete. + 2008-12-20 Hans-Peter Nilsson * cris.h (R_CRIS_32_IE): New relocation. diff --git a/include/elf/common.h b/include/elf/common.h index 2424e64549d..5a0c322996d 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -546,7 +546,6 @@ #define STT_RELC 8 /* Complex relocation expression */ #define STT_SRELC 9 /* Signed Complex relocation expression */ #define STT_LOOS 10 /* OS-specific semantics */ -#define STT_IFUNC 10 /* Symbol is an indirect code object */ #define STT_HIOS 12 /* OS-specific semantics */ #define STT_LOPROC 13 /* Application-specific semantics */ #define STT_HIPROC 15 /* Application-specific semantics */ diff --git a/ld/ChangeLog b/ld/ChangeLog index b631ccb9f48..5eccb4e74a1 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2008-12-23 Nick Clifton + + * NEWS: Remove mention of support for STT_IFUNC. + 2008-12-18 Ralf Wildenhues * configure: Regenerate. diff --git a/ld/NEWS b/ld/NEWS index 4c7dc1e6dd9..6cf68389727 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -1,8 +1,4 @@ -*- text -*- -* For GNU/Linux systems the linker will now forego processing any relocations - made against symbols of the STT_IFUNC type and instead emit them into - the resulting binary for processing by the loader. - * Add CR16 ELF --embedded-relocs (used to embedded relocations into binaries for Embedded-PIC code) option. diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 94215620e72..de2862f5010 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2008-12-23 Nick Clifton + + * ld-i386/i386.exp: Do not run ifunc test. + * ld-i386/ifunc.s: Delete. + * ld-i386/ifunc.d: Delete. + * ld-x86-64/x86-64.exp: Do not run ifunc test. + * ld-x86-64/ifunc.s: Delete. + * ld-x86-64/ifunc.d: Delete. + 2008-12-20 Hans-Peter Nilsson * ld-cris/tls-err-77.d, ld-cris/tls-gc-79.d, ld-cris/tls-ie-8e.s, diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 0446f18fff0..6f75f3ae375 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -138,4 +138,3 @@ run_dump_test "hidden3" run_dump_test "protected1" run_dump_test "protected2" run_dump_test "protected3" -run_dump_test "ifunc" diff --git a/ld/testsuite/ld-i386/ifunc.d b/ld/testsuite/ld-i386/ifunc.d deleted file mode 100644 index f5a7584d18a..00000000000 --- a/ld/testsuite/ld-i386/ifunc.d +++ /dev/null @@ -1,14 +0,0 @@ -#name: Generation of dynamic relocs for STT_IFUNC symbols -#source: ifunc.s -#as: --32 -#ld: -melf_i386 -lc --defsym _start=0 -L/usr/lib -#readelf: --relocs --syms - -Relocation section '.rel.ifunc.dyn' at offset 0x[0-9a-f]+ contains 2 entries: - +Offset +Info +Type +Sym.Value +Sym. Name -[0-9a-f]+ 0+0202 R_386_PC32 func\(\) func -[0-9a-f]+ 0+0102 R_386_PC32 long_fun\(\) long_func_name -#... - ..: [0-9a-f]+ .. IFUNC GLOBAL DEFAULT .. long_func_name - ..: [0-9a-f]+ .. IFUNC GLOBAL DEFAULT .. func -#pass diff --git a/ld/testsuite/ld-i386/ifunc.s b/ld/testsuite/ld-i386/ifunc.s deleted file mode 100644 index 3f34cfbfb5a..00000000000 --- a/ld/testsuite/ld-i386/ifunc.s +++ /dev/null @@ -1,128 +0,0 @@ - .file "ifunc.c" -#APP - .type func, %indirect_function - .type long_func_name, %indirect_function - .section .rodata.str1.1,"aMS",@progbits,1 -.LC0: - .string "arg is %d\n" -#NO_APP - .text - .p2align 4,,15 -.globl bar - .type bar, @function -bar: - pushl %ebp - movl %esp, %ebp - subl $8, %esp - movl 8(%ebp), %eax - movl $.LC0, (%esp) - movl %eax, 4(%esp) - call printf - leave - ret - .size bar, .-bar - .section .rodata.str1.1 -.LC1: - .string "main: calling func" - .section .rodata.str1.4,"aMS",@progbits,1 - .align 4 -.LC2: - .string "main: func finished, calling long_func_name" - .section .rodata.str1.1 -.LC3: - .string "main: long_func_name finished" - .text - .p2align 4,,15 -.globl main - .type main, @function -main: - leal 4(%esp), %ecx - andl $-16, %esp - pushl -4(%ecx) - pushl %ebp - movl %esp, %ebp - pushl %ecx - subl $4, %esp - movl $.LC1, (%esp) - call puts - call func - movl $.LC2, (%esp) - call puts - call long_func_name - movl $.LC3, (%esp) - call puts - addl $4, %esp - xorl %eax, %eax - popl %ecx - popl %ebp - leal -4(%ecx), %esp - ret - .size main, .-main - .p2align 4,,15 -.globl long_func_name - .type long_func_name, @function -long_func_name: - pushl %ebp - movl %esp, %ebp - subl $8, %esp - call rand - movl $func0, %edx - testl %eax, %eax - jne .L7 - movl $func1, %edx -.L7: - movl %edx, %eax - leave - ret - .size long_func_name, .-long_func_name - .p2align 4,,15 -.globl func - .type func, @function -func: - pushl %ebp - movl %esp, %ebp - subl $8, %esp - call rand - movl $func0, %edx - testl %eax, %eax - jne .L12 - movl $func1, %edx -.L12: - movl %edx, %eax - leave - ret - .size func, .-func - .section .rodata.str1.1 -.LC4: - .string "func1\n" - .text - .p2align 4,,15 -.globl func1 - .type func1, @function -func1: - pushl %ebp - movl %esp, %ebp - subl $8, %esp - movl $.LC4, (%esp) - call puts - leave - ret - .size func1, .-func1 - .section .rodata.str1.1 -.LC5: - .string "func0\n" - .text - .p2align 4,,15 -.globl func0 - .type func0, @function -func0: - pushl %ebp - movl %esp, %ebp - subl $8, %esp - movl $.LC5, (%esp) - call puts - leave - ret - .size func0, .-func0 - .ident "GCC: (GNU) 4.3.0 20080428 (Red Hat 4.3.0-8)" - .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-x86-64/ifunc.d b/ld/testsuite/ld-x86-64/ifunc.d deleted file mode 100644 index 1f147e3de02..00000000000 --- a/ld/testsuite/ld-x86-64/ifunc.d +++ /dev/null @@ -1,14 +0,0 @@ -#name: Generation of dynamic relocs for STT_IFUNC symbols -#source: ifunc.s -#ld: --defsym _start=0 --defsym puts=0 --defsym rand=0 --defsym printf=0 -#readelf: --relocs --syms - -Relocation section '.rela.ifunc.dyn' at offset 0x[0-9a-f]+ contains 2 entries: - +Offset +Info +Type +Sym. Value +Sym. Name \+ Addend -[0-9a-f]+ 0+20+2 R_X86_64_PC32 .* -[0-9a-f]+ 0+10+2 R_X86_64_PC32 .* -#... - ..: [0-9a-f]+ .. IFUNC GLOBAL DEFAULT .. long_func_name -#... - ..: [0-9a-f]+ .. IFUNC GLOBAL DEFAULT .. func -#pass diff --git a/ld/testsuite/ld-x86-64/ifunc.s b/ld/testsuite/ld-x86-64/ifunc.s deleted file mode 100644 index 4a6a62e115a..00000000000 --- a/ld/testsuite/ld-x86-64/ifunc.s +++ /dev/null @@ -1,198 +0,0 @@ - .file "ifunc.c" -#APP - .type func, %indirect_function - .type long_func_name, %indirect_function - .section .rodata.str1.1,"aMS",@progbits,1 -.LC0: - .string "arg is %d\n" -#NO_APP - .text - .p2align 4,,15 -.globl bar - .type bar, @function -bar: -.LFB25: - movl %edi, %esi - xorl %eax, %eax - movl $.LC0, %edi - jmp printf -.LFE25: - .size bar, .-bar - .section .rodata.str1.1 -.LC1: - .string "main: calling func" - .section .rodata.str1.8,"aMS",@progbits,1 - .align 8 -.LC2: - .string "main: func finished, calling long_func_name" - .section .rodata.str1.1 -.LC3: - .string "main: long_func_name finished" - .text - .p2align 4,,15 -.globl main - .type main, @function -main: -.LFB24: - subq $8, %rsp -.LCFI0: - movl $.LC1, %edi - call puts - call func - movl $.LC2, %edi - call puts - call long_func_name - movl $.LC3, %edi - call puts - xorl %eax, %eax - addq $8, %rsp - ret -.LFE24: - .size main, .-main - .p2align 4,,15 -.globl long_func_name - .type long_func_name, @function -long_func_name: -.LFB23: - subq $8, %rsp -.LCFI1: - call rand - movl %eax, %edx - movl $func1, %eax - testl %edx, %edx - movl $func0, %edx - cmovne %rdx, %rax - addq $8, %rsp - ret -.LFE23: - .size long_func_name, .-long_func_name - .p2align 4,,15 -.globl func - .type func, @function -func: -.LFB22: - subq $8, %rsp -.LCFI2: - call rand - movl %eax, %edx - movl $func1, %eax - testl %edx, %edx - movl $func0, %edx - cmovne %rdx, %rax - addq $8, %rsp - ret -.LFE22: - .size func, .-func - .section .rodata.str1.1 -.LC4: - .string "func1\n" - .text - .p2align 4,,15 -.globl func1 - .type func1, @function -func1: -.LFB21: - movl $.LC4, %edi - jmp puts -.LFE21: - .size func1, .-func1 - .section .rodata.str1.1 -.LC5: - .string "func0\n" - .text - .p2align 4,,15 -.globl func0 - .type func0, @function -func0: -.LFB20: - movl $.LC5, %edi - jmp puts -.LFE20: - .size func0, .-func0 - .section .eh_frame,"a",@progbits -.Lframe1: - .long .LECIE1-.LSCIE1 -.LSCIE1: - .long 0x0 - .byte 0x1 - .string "zR" - .uleb128 0x1 - .sleb128 -8 - .byte 0x10 - .uleb128 0x1 - .byte 0x3 - .byte 0xc - .uleb128 0x7 - .uleb128 0x8 - .byte 0x90 - .uleb128 0x1 - .align 8 -.LECIE1: -.LSFDE1: - .long .LEFDE1-.LASFDE1 -.LASFDE1: - .long .LASFDE1-.Lframe1 - .long .LFB25 - .long .LFE25-.LFB25 - .uleb128 0x0 - .align 8 -.LEFDE1: -.LSFDE3: - .long .LEFDE3-.LASFDE3 -.LASFDE3: - .long .LASFDE3-.Lframe1 - .long .LFB24 - .long .LFE24-.LFB24 - .uleb128 0x0 - .byte 0x4 - .long .LCFI0-.LFB24 - .byte 0xe - .uleb128 0x10 - .align 8 -.LEFDE3: -.LSFDE5: - .long .LEFDE5-.LASFDE5 -.LASFDE5: - .long .LASFDE5-.Lframe1 - .long .LFB23 - .long .LFE23-.LFB23 - .uleb128 0x0 - .byte 0x4 - .long .LCFI1-.LFB23 - .byte 0xe - .uleb128 0x10 - .align 8 -.LEFDE5: -.LSFDE7: - .long .LEFDE7-.LASFDE7 -.LASFDE7: - .long .LASFDE7-.Lframe1 - .long .LFB22 - .long .LFE22-.LFB22 - .uleb128 0x0 - .byte 0x4 - .long .LCFI2-.LFB22 - .byte 0xe - .uleb128 0x10 - .align 8 -.LEFDE7: -.LSFDE9: - .long .LEFDE9-.LASFDE9 -.LASFDE9: - .long .LASFDE9-.Lframe1 - .long .LFB21 - .long .LFE21-.LFB21 - .uleb128 0x0 - .align 8 -.LEFDE9: -.LSFDE11: - .long .LEFDE11-.LASFDE11 -.LASFDE11: - .long .LASFDE11-.Lframe1 - .long .LFB20 - .long .LFE20-.LFB20 - .uleb128 0x0 - .align 8 -.LEFDE11: - .ident "GCC: (GNU) 4.3.0 20080428 (Red Hat 4.3.0-8)" - .section .note.GNU-stack,"",@progbits diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index d3608f6e735..0b8e6146602 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -92,4 +92,4 @@ run_dump_test "hidden3" run_dump_test "protected1" run_dump_test "protected2" run_dump_test "protected3" -run_dump_test "ifunc" + -- 2.30.2