aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-runtime.c14
-rw-r--r--elf/do-lookup.h12
-rw-r--r--elf/elf.h1
3 files changed, 21 insertions, 6 deletions
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index 968e293..962f47d 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -1,5 +1,5 @@
/* On-demand PLT fixup for shared objects.
- Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -130,6 +130,9 @@ _dl_fixup (
/* And now perhaps the relocation addend. */
value = elf_machine_plt_value (l, reloc, value);
+ if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
+ value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
+
/* Finally, fix up the plt itself. */
if (__builtin_expect (GLRO(dl_bind_not), 0))
return value;
@@ -215,12 +218,21 @@ _dl_profile_fixup (
defsym != NULL
? LOOKUP_VALUE_ADDRESS (result)
+ defsym->st_value : 0);
+
+ if (__builtin_expect (ELFW(ST_TYPE) (defsym->st_info)
+ == STT_GNU_IFUNC, 0))
+ value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
}
else
{
/* We already found the symbol. The module (and therefore its load
address) is also known. */
value = DL_FIXUP_MAKE_VALUE (l, l->l_addr + refsym->st_value);
+
+ if (__builtin_expect (ELFW(ST_TYPE) (refsym->st_info)
+ == STT_GNU_IFUNC, 0))
+ value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
+
result = l;
}
/* And now perhaps the relocation addend. */
diff --git a/elf/do-lookup.h b/elf/do-lookup.h
index ebb9ed5..41e5fc1 100644
--- a/elf/do-lookup.h
+++ b/elf/do-lookup.h
@@ -1,5 +1,5 @@
/* Look up a symbol in the loaded objects.
- Copyright (C) 1995-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -88,10 +88,12 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) > STT_FUNC
&& ELFW(ST_TYPE) (sym->st_info) != STT_COMMON
- && ELFW(ST_TYPE) (sym->st_info) != STT_TLS, 0))
- /* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC, and STT_COMMON
- entries (and STT_TLS if TLS is supported) since these
- are no code/data definitions. */
+ && ELFW(ST_TYPE) (sym->st_info) != STT_TLS
+ && ELFW(ST_TYPE) (sym->st_info) != STT_GNU_IFUNC,
+ 0))
+ /* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC, STT_COMMON,
+ STT_TLS, and STT_GNU_IFUNC since these are no code/data
+ definitions. */
return NULL;
if (sym != ref && strcmp (strtab + sym->st_name, undef_name))
diff --git a/elf/elf.h b/elf/elf.h
index 2792820..cd74d51 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -459,6 +459,7 @@ typedef struct
#define STT_TLS 6 /* Symbol is thread-local data object*/
#define STT_NUM 7 /* Number of defined types. */
#define STT_LOOS 10 /* Start of OS-specific */
+#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */
#define STT_HIOS 12 /* End of OS-specific */
#define STT_LOPROC 13 /* Start of processor-specific */
#define STT_HIPROC 15 /* End of processor-specific */