diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/sysdeps/nios2/dl-trampoline.S | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.gz glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.xz glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.zip |
Prepare for radical source tree reorganization. zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/sysdeps/nios2/dl-trampoline.S')
-rw-r--r-- | REORG.TODO/sysdeps/nios2/dl-trampoline.S | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/REORG.TODO/sysdeps/nios2/dl-trampoline.S b/REORG.TODO/sysdeps/nios2/dl-trampoline.S new file mode 100644 index 0000000000..1dbf5c14eb --- /dev/null +++ b/REORG.TODO/sysdeps/nios2/dl-trampoline.S @@ -0,0 +1,79 @@ +/* PLT trampolines. Nios II version. + Copyright (C) 2005-2017 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <sysdep.h> +#include <libc-symbols.h> + + .text + .globl _dl_runtime_resolve + cfi_startproc +_dl_runtime_resolve: +/* The runtime resolver receives the original function arguments in r4 + through r7, the shared library identifier from GOT[1]? in r14, and the + relocation index times four in r15. It updates the corresponding PLT GOT + entry so that the PLT entry will transfer control directly to the target + in the future, and then transfers control to the target. */ + /* Save arguments and return address. */ + subi sp, sp, 28 + cfi_adjust_cfa_offset (28) + stw r22, 24(sp) + cfi_rel_offset (r22, 24) + stw r8, 20(sp) /* save r8, because this might be a call to mcount */ + cfi_rel_offset (r8, 20) + stw r7, 16(sp) + cfi_rel_offset (r7, 16) + stw r6, 12(sp) + cfi_rel_offset (r6, 12) + stw r5, 8(sp) + cfi_rel_offset (r5, 8) + stw r4, 4(sp) + cfi_rel_offset (r4, 4) + stw ra, 0(sp) + cfi_rel_offset (ra, 0) + + /* Get pointer to linker struct. */ + mov r4, r14 + + /* Get the relocation offset. We're given a multiple of 4 and + need a multiple of 12, so multiply by 3. */ + slli r5, r15, 1 + add r5, r5, r15 + + /* Call the fixup routine. */ + nextpc r22 +1: movhi r2, %hiadj(_gp_got - 1b) + addi r2, r2, %lo(_gp_got - 1b) + add r22, r22, r2 + ldw r2, %call(_dl_fixup)(r22) + callr r2 + + /* Restore the arguments and return address. */ + ldw ra, 0(sp) + ldw r4, 4(sp) + ldw r5, 8(sp) + ldw r6, 12(sp) + ldw r7, 16(sp) + ldw r8, 20(sp) + ldw r22, 24(sp) + addi sp, sp, 28 + cfi_adjust_cfa_offset (-28) + + /* Jump to the newly found address. */ + jmp r2 + + cfi_endproc |