summaryrefslogtreecommitdiff
path: root/libc/elf/dl-runtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/elf/dl-runtime.c')
-rw-r--r--libc/elf/dl-runtime.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/libc/elf/dl-runtime.c b/libc/elf/dl-runtime.c
index 2e02a218e..19543aa44 100644
--- a/libc/elf/dl-runtime.c
+++ b/libc/elf/dl-runtime.c
@@ -1,5 +1,5 @@
/* On-demand PLT fixup for shared objects.
- Copyright (C) 1995-2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1995-2012 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
@@ -56,7 +56,6 @@
to that address. Future calls will bounce directly from the PLT to the
function. */
-#ifndef ELF_MACHINE_NO_PLT
DL_FIXUP_VALUE_TYPE
__attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
_dl_fixup (
@@ -150,9 +149,8 @@ _dl_fixup (
return elf_machine_fixup_plt (l, result, reloc, rel_addr, value);
}
-#endif
-#if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__
+#if !defined PROF && !__BOUNDED_POINTERS__
DL_FIXUP_VALUE_TYPE
__attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
_dl_profile_fixup (
@@ -164,6 +162,26 @@ _dl_profile_fixup (
{
void (*mcount_fct) (ElfW(Addr), ElfW(Addr)) = INTUSE(_dl_mcount);
+ if (l->l_reloc_result == NULL)
+ {
+ /* BZ #14843: ELF_DYNAMIC_RELOCATE is called before l_reloc_result
+ is allocated. We will get here if ELF_DYNAMIC_RELOCATE calls a
+ resolver function to resolve an IRELATIVE relocation and that
+ resolver calls a function that is not yet resolved (lazy). For
+ example, the resolver in x86-64 libm.so calls __get_cpu_features
+ defined in libc.so. Skip audit and resolve the external function
+ in this case. */
+ *framesizep = -1;
+ return _dl_fixup (
+# ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
+# ifndef ELF_MACHINE_RUNTIME_FIXUP_PARAMS
+# error Please define ELF_MACHINE_RUNTIME_FIXUP_PARAMS.
+# endif
+ ELF_MACHINE_RUNTIME_FIXUP_PARAMS,
+# endif
+ l, reloc_arg);
+ }
+
/* This is the address in the array where we store the result of previous
relocations. */
struct reloc_result *reloc_result = &l->l_reloc_result[reloc_index];
@@ -417,7 +435,7 @@ _dl_profile_fixup (
return value;
}
-#endif /* PROF && ELF_MACHINE_NO_PLT */
+#endif /* PROF */
#include <stdio.h>