This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: COMMITTED: Add support for STT_IFUNC
Hi Guys,
I have to apologise to everyone. I was obviously jumping the gun by
applying this patch before the feature had been fully discussed and
improved. I do believe that the feature will make it into the ELF
standard at some point, but I was premature in adding support for it to
the binutils sources.
I am going to check in the attached patch to remove the STT_IFUNC
support, for now. Assuming that it does become officially accepted at
some point I will then re-add support for it.
Cheers
Nick
bfd/ChangeLog
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.
binutils/ChangeLog
2008-12-23 Nick Clifton <nickc@redhat.com>
* objdump.c (dump_reloc_set): Remove STT_IFUNC support.
* readelf.c (dump_relocations): Likewise.
(get_symbol_type): Likewise.
* doc/binutils.texi: Likewise.
gas/ChangeLog
2008-12-23 Nick Clifton <nickc@redhat.com>
* 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.
gas/testsuite/ChangeLog
2008-12-23 Nick Clifton <nickc@redhat.com>
* gas/elf/type.s: Remove test of STT_IFUNC support.
* gas/elf/type.e: Update expected output.
include/elf/ChangeLog
2008-12-23 Nick Clifton <nickc@redhat.com>
* commmon.h (STT_IFUNC): Delete.
ld/ChangeLog
2008-12-23 Nick Clifton <nickc@redhat.com>
* NEWS: Remove mention of support for STT_IFUNC.
ld/testsuite/ChangeLog2008-12-23 Nick Clifton <nickc@redhat.com>
* 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.
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.460
diff -c -3 -p -r1.460 bfd-in2.h
*** bfd/bfd-in2.h 20 Dec 2008 00:26:36 -0000 1.460
--- bfd/bfd-in2.h 23 Dec 2008 08:42:40 -0000
*************** typedef struct bfd_symbol
*** 4472,4484 ****
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)
--- 4472,4477 ----
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.271
diff -c -3 -p -r1.271 elf-bfd.h
*** bfd/elf-bfd.h 3 Dec 2008 14:50:57 -0000 1.271
--- bfd/elf-bfd.h 23 Dec 2008 08:42:41 -0000
*************** struct bfd_elf_section_data
*** 1287,1295 ****
/* 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;
--- 1287,1292 ----
*************** extern asection * _bfd_elf_get_dynamic_r
*** 1771,1778 ****
(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
--- 1768,1773 ----
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.473
diff -c -3 -p -r1.473 elf.c
*** bfd/elf.c 3 Dec 2008 14:50:57 -0000 1.473
--- bfd/elf.c 23 Dec 2008 08:42:43 -0000
*************** Unable to find equivalent output section
*** 6427,6434 ****
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)
--- 6427,6432 ----
*************** elf_find_function (bfd *abfd ATTRIBUTE_U
*** 7122,7128 ****
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)
--- 7120,7125 ----
*************** _bfd_elf_set_osabi (bfd * abfd,
*** 8941,8950 ****
/* 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. */
bfd_boolean
_bfd_elf_is_function_type (unsigned int type)
{
! return (type == STT_FUNC || type == STT_IFUNC);
}
--- 8938,8947 ----
/* 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. */
bfd_boolean
_bfd_elf_is_function_type (unsigned int type)
{
! return (type == STT_FUNC);
}
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.161
diff -c -3 -p -r1.161 elf32-arm.c
*** bfd/elf32-arm.c 3 Dec 2008 14:50:57 -0000 1.161
--- bfd/elf32-arm.c 23 Dec 2008 08:42:46 -0000
*************** arm_elf_find_function (bfd * abf
*** 9430,9436 ****
filename = bfd_asymbol_name (&q->symbol);
break;
case STT_FUNC:
- case STT_IFUNC:
case STT_ARM_TFUNC:
case STT_NOTYPE:
/* Skip mapping symbols. */
--- 9430,9435 ----
*************** elf32_arm_adjust_dynamic_symbol (struct
*** 9556,9562 ****
/* 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
|| h->needs_plt)
{
if (h->plt.refcount <= 0
--- 9555,9561 ----
/* 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->needs_plt)
{
if (h->plt.refcount <= 0
*************** elf32_arm_swap_symbol_in (bfd * abfd,
*** 11730,11737 ****
/* 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)
&& (dst->st_value & 1))
{
dst->st_info = ELF_ST_INFO (ELF_ST_BIND (dst->st_info), STT_ARM_TFUNC);
--- 11729,11735 ----
/* 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)
&& (dst->st_value & 1))
{
dst->st_info = ELF_ST_INFO (ELF_ST_BIND (dst->st_info), STT_ARM_TFUNC);
*************** elf32_arm_additional_program_headers (bf
*** 11832,11838 ****
static bfd_boolean
elf32_arm_is_function_type (unsigned int type)
{
! return (type == STT_FUNC) || (type == STT_ARM_TFUNC) || (type == STT_IFUNC);
}
/* We use this to override swap_symbol_in and swap_symbol_out. */
--- 11830,11836 ----
static bfd_boolean
elf32_arm_is_function_type (unsigned int type)
{
! return (type == STT_FUNC) || (type == STT_ARM_TFUNC);
}
/* We use this to override swap_symbol_in and swap_symbol_out. */
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.190
diff -c -3 -p -r1.190 elf32-i386.c
*** bfd/elf32-i386.c 3 Dec 2008 14:50:57 -0000 1.190
--- bfd/elf32-i386.c 23 Dec 2008 08:42:46 -0000
*************** elf_i386_tls_transition (struct bfd_link
*** 1193,1218 ****
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. */
--- 1193,1198 ----
*************** elf_i386_check_relocs (bfd *abfd,
*** 1472,1479 ****
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
! || !h->def_regular))
! || is_indirect_symbol (abfd, h))
{
struct elf_i386_dyn_relocs *p;
struct elf_i386_dyn_relocs **head;
--- 1452,1458 ----
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
! || !h->def_regular)))
{
struct elf_i386_dyn_relocs *p;
struct elf_i386_dyn_relocs **head;
*************** elf_i386_check_relocs (bfd *abfd,
*** 1493,1501 ****
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)
--- 1472,1477 ----
*************** allocate_dynrelocs (struct elf_link_hash
*** 2057,2071 ****
}
}
}
- 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
--- 2033,2038 ----
*************** allocate_dynrelocs (struct elf_link_hash
*** 2104,2114 ****
{
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;
BFD_ASSERT (sreloc != NULL);
sreloc->size += p->count * sizeof (Elf32_External_Rel);
--- 2071,2077 ----
{
asection *sreloc;
! sreloc = elf_section_data (p->sec)->sreloc;
BFD_ASSERT (sreloc != NULL);
sreloc->size += p->count * sizeof (Elf32_External_Rel);
*************** elf_i386_relocate_section (bfd *output_b
*** 2919,2926 ****
&& ((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))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
--- 2882,2888 ----
&& ((h->def_dynamic
&& !h->def_regular)
|| h->root.type == bfd_link_hash_undefweak
! || h->root.type == bfd_link_hash_undefined)))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
*************** elf_i386_relocate_section (bfd *output_b
*** 2960,2969 ****
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;
BFD_ASSERT (sreloc != NULL && sreloc->contents != NULL);
--- 2922,2928 ----
outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
}
! sreloc = elf_section_data (input_section)->sreloc;
BFD_ASSERT (sreloc != NULL && sreloc->contents != NULL);
*************** elf_i386_relocate_section (bfd *output_b
*** 2976,2982 ****
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))
continue;
}
break;
--- 2935,2941 ----
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)
continue;
}
break;
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.150
diff -c -3 -p -r1.150 elf64-x86-64.c
*** bfd/elf64-x86-64.c 3 Dec 2008 14:50:57 -0000 1.150
--- bfd/elf64-x86-64.c 23 Dec 2008 08:42:51 -0000
*************** elf64_x86_64_tls_transition (struct bfd_
*** 974,999 ****
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. */
--- 974,979 ----
*************** elf64_x86_64_check_relocs (bfd *abfd, st
*** 1275,1284 ****
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.
- 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)
--- 1255,1262 ----
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. */
if ((info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& (((r_type != R_X86_64_PC8)
*************** elf64_x86_64_check_relocs (bfd *abfd, st
*** 1294,1301 ****
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
! || !h->def_regular))
! || is_indirect_symbol (abfd, h))
{
struct elf64_x86_64_dyn_relocs *p;
struct elf64_x86_64_dyn_relocs **head;
--- 1272,1278 ----
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
! || !h->def_regular)))
{
struct elf64_x86_64_dyn_relocs *p;
struct elf64_x86_64_dyn_relocs **head;
*************** elf64_x86_64_check_relocs (bfd *abfd, st
*** 1315,1323 ****
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)
--- 1292,1297 ----
*************** allocate_dynrelocs (struct elf_link_hash
*** 1857,1869 ****
}
}
}
- 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
--- 1831,1836 ----
*************** allocate_dynrelocs (struct elf_link_hash
*** 1902,1912 ****
{
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;
BFD_ASSERT (sreloc != NULL);
--- 1869,1875 ----
{
asection * sreloc;
! sreloc = elf_section_data (p->sec)->sreloc;
BFD_ASSERT (sreloc != NULL);
*************** elf64_x86_64_relocate_section (bfd *outp
*** 2721,2728 ****
&& ((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))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
--- 2684,2690 ----
&& ((h->def_dynamic
&& !h->def_regular)
|| h->root.type == bfd_link_hash_undefweak
! || h->root.type == bfd_link_hash_undefined)))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
*************** elf64_x86_64_relocate_section (bfd *outp
*** 2808,2817 ****
}
}
! 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;
BFD_ASSERT (sreloc != NULL && sreloc->contents != NULL);
--- 2770,2776 ----
}
}
! sreloc = elf_section_data (input_section)->sreloc;
BFD_ASSERT (sreloc != NULL && sreloc->contents != NULL);
*************** elf64_x86_64_relocate_section (bfd *outp
*** 2823,2829 ****
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))
continue;
}
--- 2782,2788 ----
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)
continue;
}
Index: bfd/elfcode.h
===================================================================
RCS file: /cvs/src/src/bfd/elfcode.h,v
retrieving revision 1.92
diff -c -3 -p -r1.92 elfcode.h
*** bfd/elfcode.h 3 Dec 2008 14:50:57 -0000 1.92
--- bfd/elfcode.h 23 Dec 2008 08:42:51 -0000
*************** elf_slurp_symbol_table (bfd *abfd, asymb
*** 1311,1319 ****
case STT_SRELC:
sym->symbol.flags |= BSF_SRELC;
break;
- case STT_IFUNC:
- sym->symbol.flags |= BSF_INDIRECT_FUNCTION;
- break;
}
if (dynamic)
--- 1311,1316 ----
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.319
diff -c -3 -p -r1.319 elflink.c
*** bfd/elflink.c 3 Dec 2008 14:50:57 -0000 1.319
--- bfd/elflink.c 23 Dec 2008 08:42:51 -0000
*************** _bfd_elf_adjust_dynamic_symbol (struct e
*** 2653,2664 ****
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;
--- 2653,2658 ----
*************** _bfd_elf_make_dynamic_reloc_section (ase
*** 12407,12477 ****
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;
- }
--- 12401,12403 ----
Index: bfd/syms.c
===================================================================
RCS file: /cvs/src/src/bfd/syms.c,v
retrieving revision 1.48
diff -c -3 -p -r1.48 syms.c
*** bfd/syms.c 3 Dec 2008 14:50:57 -0000 1.48
--- bfd/syms.c 23 Dec 2008 08:42:52 -0000
*************** CODE_FRAGMENT
*** 231,243 ****
. 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)
--- 231,236 ----
*************** bfd_print_symbol_vandf (bfd *abfd, void
*** 490,496 ****
(type & BSF_WEAK) ? 'w' : ' ',
(type & BSF_CONSTRUCTOR) ? 'C' : ' ',
(type & BSF_WARNING) ? 'W' : ' ',
! (type & BSF_INDIRECT) ? 'I' : (type & BSF_INDIRECT_FUNCTION) ? 'i' : ' ',
(type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ',
((type & BSF_FUNCTION)
? 'F'
--- 483,489 ----
(type & BSF_WEAK) ? 'w' : ' ',
(type & BSF_CONSTRUCTOR) ? 'C' : ' ',
(type & BSF_WARNING) ? 'W' : ' ',
! (type & BSF_INDIRECT) ? 'I' : ' ',
(type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ',
((type & BSF_FUNCTION)
? 'F'
*************** bfd_decode_symclass (asymbol *symbol)
*** 676,683 ****
}
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
--- 669,674 ----
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.149
diff -c -3 -p -r1.149 objdump.c
*** binutils/objdump.c 4 Dec 2008 08:04:47 -0000 1.149
--- binutils/objdump.c 23 Dec 2008 08:42:52 -0000
*************** dump_reloc_set (bfd *abfd, asection *sec
*** 2722,2729 ****
if (sym_name)
{
objdump_print_symname (abfd, NULL, *q->sym_ptr_ptr);
- if ((*q->sym_ptr_ptr)->flags & BSF_INDIRECT_FUNCTION)
- printf ("() ");
}
else
{
--- 2722,2727 ----
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.432
diff -c -3 -p -r1.432 readelf.c
*** binutils/readelf.c 9 Dec 2008 08:34:29 -0000 1.432
--- binutils/readelf.c 23 Dec 2008 08:42:55 -0000
*************** dump_relocations (FILE *file,
*** 1251,1288 ****
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);
! printf (is_32bit_elf ? " " : " ");
! }
if (psym->st_name == 0)
{
--- 1251,1259 ----
printf (" ");
! print_vma (psym->st_value, LONG_HEX);
! printf (is_32bit_elf ? " " : " ");
if (psym->st_name == 0)
{
*************** get_symbol_type (unsigned int type)
*** 7065,7078 ****
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), _("<OS specific>: %d"), type);
}
--- 7036,7041 ----
Index: binutils/doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.134
diff -c -3 -p -r1.134 binutils.texi
*** binutils/doc/binutils.texi 4 Dec 2008 10:29:15 -0000 1.134
--- binutils/doc/binutils.texi 23 Dec 2008 08:42:57 -0000
*************** The symbol is in an initialized data sec
*** 729,738 ****
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.
--- 729,734 ----
Index: gas/NEWS
===================================================================
RCS file: /cvs/src/src/gas/NEWS,v
retrieving revision 1.100
diff -c -3 -p -r1.100 NEWS
*** gas/NEWS 3 Dec 2008 14:50:58 -0000 1.100
--- gas/NEWS 23 Dec 2008 08:42:57 -0000
***************
*** 1,10 ****
-*- 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
--- 1,5 ----
Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.110
diff -c -3 -p -r1.110 obj-elf.c
*** gas/config/obj-elf.c 3 Dec 2008 14:50:58 -0000 1.110
--- gas/config/obj-elf.c 23 Dec 2008 08:42:58 -0000
*************** obj_elf_type (int ignore ATTRIBUTE_UNUSE
*** 1663,1682 ****
}
}
}
- 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)
;
--- 1663,1668 ----
Index: gas/doc/as.texinfo
===================================================================
RCS file: /cvs/src/src/gas/doc/as.texinfo,v
retrieving revision 1.193
diff -c -3 -p -r1.193 as.texinfo
*** gas/doc/as.texinfo 4 Dec 2008 10:29:15 -0000 1.193
--- gas/doc/as.texinfo 23 Dec 2008 08:43:00 -0000
*************** Mark the symbol as being a common data o
*** 6293,6306 ****
@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.
--- 6293,6298 ----
Index: gas/testsuite/gas/elf/type.e
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/elf/type.e,v
retrieving revision 1.4
diff -c -3 -p -r1.4 type.e
*** gas/testsuite/gas/elf/type.e 3 Dec 2008 14:50:59 -0000 1.4
--- gas/testsuite/gas/elf/type.e 23 Dec 2008 08:43:00 -0000
***************
*** 1,5 ****
.: 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
--- 1,4 ----
Index: gas/testsuite/gas/elf/type.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/elf/type.s,v
retrieving revision 1.4
diff -c -3 -p -r1.4 type.s
*** gas/testsuite/gas/elf/type.s 3 Dec 2008 14:50:59 -0000 1.4
--- gas/testsuite/gas/elf/type.s 23 Dec 2008 08:43:01 -0000
***************
*** 3,12 ****
.type function,%function
function:
.byte 0x0
- .size indirect_function,1
- .type indirect_function,%indirect_function
- indirect_function:
- .byte 0x0
.data
.type object,%object
.size object,1
--- 3,8 ----
Index: include/elf/common.h
===================================================================
RCS file: /cvs/src/src/include/elf/common.h,v
retrieving revision 1.101
diff -c -3 -p -r1.101 common.h
*** include/elf/common.h 3 Dec 2008 14:50:56 -0000 1.101
--- include/elf/common.h 23 Dec 2008 08:43:03 -0000
***************
*** 546,552 ****
#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 */
--- 546,551 ----
Index: ld/NEWS
===================================================================
RCS file: /cvs/src/src/ld/NEWS,v
retrieving revision 1.90
diff -c -3 -p -r1.90 NEWS
*** ld/NEWS 3 Dec 2008 14:51:00 -0000 1.90
--- ld/NEWS 23 Dec 2008 08:43:03 -0000
***************
*** 1,8 ****
-*- 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.
--- 1,4 ----
Index: ld/testsuite/ld-i386/i386.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-i386/i386.exp,v
retrieving revision 1.24
diff -c -3 -p -r1.24 i386.exp
*** ld/testsuite/ld-i386/i386.exp 3 Dec 2008 14:51:00 -0000 1.24
--- ld/testsuite/ld-i386/i386.exp 23 Dec 2008 08:43:03 -0000
*************** run_dump_test "hidden3"
*** 138,141 ****
run_dump_test "protected1"
run_dump_test "protected2"
run_dump_test "protected3"
- run_dump_test "ifunc"
--- 138,140 ----
Index: ld/testsuite/ld-x86-64/x86-64.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-x86-64/x86-64.exp,v
retrieving revision 1.10
diff -c -3 -p -r1.10 x86-64.exp
*** ld/testsuite/ld-x86-64/x86-64.exp 4 Dec 2008 11:00:18 -0000 1.10
--- ld/testsuite/ld-x86-64/x86-64.exp 23 Dec 2008 08:43:04 -0000
*************** run_dump_test "hidden3"
*** 92,95 ****
run_dump_test "protected1"
run_dump_test "protected2"
run_dump_test "protected3"
! run_dump_test "ifunc"
--- 92,95 ----
run_dump_test "protected1"
run_dump_test "protected2"
run_dump_test "protected3"
!