|
|
abe59f |
commit acdcca72940e060270e4e54d9c0457398110f409
|
|
|
abe59f |
Author: John David Anglin <danglin@gcc.gnu.org>
|
|
|
abe59f |
Date: Mon Mar 30 21:58:06 2020 +0000
|
|
|
abe59f |
|
|
|
abe59f |
Add new file missed in previous hppa commit.
|
|
|
abe59f |
|
|
|
abe59f |
diff --git a/sysdeps/hppa/dl-runtime.c b/sysdeps/hppa/dl-runtime.c
|
|
|
abe59f |
new file mode 100644
|
|
|
abe59f |
index 0000000000000000..885a3f1837cbc56d
|
|
|
abe59f |
--- /dev/null
|
|
|
abe59f |
+++ b/sysdeps/hppa/dl-runtime.c
|
|
|
abe59f |
@@ -0,0 +1,58 @@
|
|
|
abe59f |
+/* On-demand PLT fixup for shared objects. HPPA version.
|
|
|
abe59f |
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
abe59f |
+ This file is part of the GNU C Library.
|
|
|
abe59f |
+
|
|
|
abe59f |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
abe59f |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
abe59f |
+ License as published by the Free Software Foundation; either
|
|
|
abe59f |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
abe59f |
+
|
|
|
abe59f |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
abe59f |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
abe59f |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
abe59f |
+ Lesser General Public License for more details.
|
|
|
abe59f |
+
|
|
|
abe59f |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
abe59f |
+ License along with the GNU C Library; if not, write to the Free
|
|
|
abe59f |
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
abe59f |
+ 02111-1307 USA. */
|
|
|
abe59f |
+
|
|
|
abe59f |
+/* Clear PA_GP_RELOC bit in relocation offset. */
|
|
|
abe59f |
+#define reloc_offset (reloc_arg & ~PA_GP_RELOC)
|
|
|
abe59f |
+#define reloc_index (reloc_arg & ~PA_GP_RELOC) / sizeof (PLTREL)
|
|
|
abe59f |
+
|
|
|
abe59f |
+#include <elf/dl-runtime.c>
|
|
|
abe59f |
+
|
|
|
abe59f |
+/* The caller has encountered a partially relocated function descriptor.
|
|
|
abe59f |
+ The gp of the descriptor has been updated, but not the ip. We find
|
|
|
abe59f |
+ the function descriptor again and compute the relocation offset and
|
|
|
abe59f |
+ return that to the caller. The caller will continue on to call
|
|
|
abe59f |
+ _dl_fixup with the relocation offset. */
|
|
|
abe59f |
+
|
|
|
abe59f |
+ElfW(Word)
|
|
|
abe59f |
+attribute_hidden __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
|
|
|
abe59f |
+_dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l)
|
|
|
abe59f |
+{
|
|
|
abe59f |
+ Elf32_Addr l_addr, iplt, jmprel, end_jmprel, r_type;
|
|
|
abe59f |
+ const Elf32_Rela *reloc;
|
|
|
abe59f |
+
|
|
|
abe59f |
+ l_addr = l->l_addr;
|
|
|
abe59f |
+ jmprel = D_PTR(l, l_info[DT_JMPREL]);
|
|
|
abe59f |
+ end_jmprel = jmprel + l->l_info[DT_PLTRELSZ]->d_un.d_val;
|
|
|
abe59f |
+
|
|
|
abe59f |
+ /* Look for the entry... */
|
|
|
abe59f |
+ for (iplt = jmprel; iplt < end_jmprel; iplt += sizeof (Elf32_Rela))
|
|
|
abe59f |
+ {
|
|
|
abe59f |
+ reloc = (const Elf32_Rela *) iplt;
|
|
|
abe59f |
+ r_type = ELF32_R_TYPE (reloc->r_info);
|
|
|
abe59f |
+
|
|
|
abe59f |
+ if (__builtin_expect (r_type == R_PARISC_IPLT, 1)
|
|
|
abe59f |
+ && fptr == (struct fdesc *) (reloc->r_offset + l_addr))
|
|
|
abe59f |
+ /* Found entry. Return the reloc offset. */
|
|
|
abe59f |
+ return iplt - jmprel;
|
|
|
abe59f |
+ }
|
|
|
abe59f |
+
|
|
|
abe59f |
+ /* Crash if we weren't passed a valid function pointer. */
|
|
|
abe59f |
+ ABORT_INSTRUCTION;
|
|
|
abe59f |
+ return 0;
|
|
|
abe59f |
+}
|