2005-01-07 11:36:07 +00:00
|
|
|
/* PLT trampolines. PPC64 version.
|
2020-01-01 00:14:33 +00:00
|
|
|
Copyright (C) 2005-2020 Free Software Foundation, Inc.
|
2005-01-07 11:36:07 +00:00
|
|
|
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
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2005-01-07 11:36:07 +00:00
|
|
|
|
|
|
|
#include <sysdep.h>
|
2005-03-19 02:49:03 +00:00
|
|
|
#include <rtld-global-offsets.h>
|
2005-01-07 11:36:07 +00:00
|
|
|
|
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
.section ".text"
|
|
|
|
/* On entry r0 contains the index of the PLT entry we need to fixup
|
|
|
|
and r11 contains the link_map (from PLT0+16). The link_map becomes
|
|
|
|
parm1 (r3) and the index (r0) need to be converted to an offset
|
|
|
|
(index * 24) in parm2 (r4). */
|
2005-07-07 02:39:45 +00:00
|
|
|
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
#define FRAME_SIZE (FRAME_MIN_SIZE+64)
|
2005-01-07 11:36:07 +00:00
|
|
|
/* We need to save the registers used to pass parameters, ie. r3 thru
|
2010-08-12 16:19:19 +00:00
|
|
|
r10; Use local var space rather than the parameter save area,
|
|
|
|
because gcc as of 2010/05 doesn't allocate a proper stack frame for
|
|
|
|
a function that makes no calls except for __tls_get_addr and we
|
|
|
|
might be here resolving the __tls_get_addr call. */
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
#define INT_PARMS FRAME_MIN_SIZE
|
PowerPC64 ENTRY_TOCLESS
A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use
or change r2, yet declare a global entry that sets up r2. This patch
fixes that problem, and consolidates the ENTRY and EALIGN macros.
* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
(NOPS, ENTRY_3): New macros.
(ENTRY): Rewrite.
(ENTRY_TOCLESS): Define.
(EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5,
EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete.
* sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY.
* sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
* sysdeps/powerpc/powerpc64/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
* sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS.
* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
* sysdeps/powerpc/powerpc64/lshift.S: Likewise.
* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/mul_1.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l):
Likewise.
* sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise.
* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier. Don't
add nop when SHARED.
* sysdeps/powerpc/powerpc64/start.S: Fix comment.
* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't
define.
(ENTRY_TOCLESS): Define.
* sysdeps/powerpc/powerpc32/sysdep.h (ENTRY_TOCLESS): Define.
* sysdeps/powerpc/fpu/s_fma.S: Use ENTRY_TOCLESS.
* sysdeps/powerpc/fpu/s_fmaf.S: Likewise.
2017-06-14 01:15:50 +00:00
|
|
|
ENTRY (_dl_runtime_resolve, 4)
|
2010-08-12 16:19:19 +00:00
|
|
|
stdu r1,-FRAME_SIZE(r1)
|
|
|
|
cfi_adjust_cfa_offset (FRAME_SIZE)
|
|
|
|
std r3,INT_PARMS+0(r1)
|
2005-01-08 05:41:58 +00:00
|
|
|
mr r3,r11
|
2010-08-12 16:19:19 +00:00
|
|
|
std r4,INT_PARMS+8(r1)
|
2005-01-08 05:41:58 +00:00
|
|
|
sldi r4,r0,1
|
2010-08-12 16:19:19 +00:00
|
|
|
std r5,INT_PARMS+16(r1)
|
2005-01-08 05:41:58 +00:00
|
|
|
add r4,r4,r0
|
2010-08-12 16:19:19 +00:00
|
|
|
std r6,INT_PARMS+24(r1)
|
2005-01-08 05:41:58 +00:00
|
|
|
sldi r4,r4,3
|
2010-08-12 16:19:19 +00:00
|
|
|
std r7,INT_PARMS+32(r1)
|
2005-01-08 05:41:58 +00:00
|
|
|
mflr r0
|
2010-08-12 16:19:19 +00:00
|
|
|
std r8,INT_PARMS+40(r1)
|
|
|
|
/* Store the LR in the LR Save area. */
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
std r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
|
|
|
|
cfi_offset (lr, FRAME_LR_SAVE)
|
2010-08-12 16:19:19 +00:00
|
|
|
std r9,INT_PARMS+48(r1)
|
|
|
|
std r10,INT_PARMS+56(r1)
|
2005-01-07 11:36:07 +00:00
|
|
|
bl JUMPTARGET(_dl_fixup)
|
2010-08-12 16:19:19 +00:00
|
|
|
#ifndef SHARED
|
|
|
|
nop
|
|
|
|
#endif
|
2005-01-07 11:36:07 +00:00
|
|
|
/* Put the registers back. */
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
|
2010-08-12 16:19:19 +00:00
|
|
|
ld r10,INT_PARMS+56(r1)
|
|
|
|
ld r9,INT_PARMS+48(r1)
|
|
|
|
ld r8,INT_PARMS+40(r1)
|
|
|
|
ld r7,INT_PARMS+32(r1)
|
2005-01-08 05:41:58 +00:00
|
|
|
mtlr r0
|
2010-08-12 16:19:19 +00:00
|
|
|
ld r6,INT_PARMS+24(r1)
|
|
|
|
ld r5,INT_PARMS+16(r1)
|
|
|
|
ld r4,INT_PARMS+8(r1)
|
2013-12-04 12:49:15 +00:00
|
|
|
/* Prepare for calling the function returned by fixup. */
|
|
|
|
PPC64_LOAD_FUNCPTR r3
|
2010-08-12 16:19:19 +00:00
|
|
|
ld r3,INT_PARMS+0(r1)
|
PowerPC64 ELFv2 ABI 3/6: PLT local entry point optimization
This is a follow-on to the previous patch to support the ELFv2 ABI in the
dynamic loader, split off into its own patch since it is just an optional
optimization.
In the ELFv2 ABI, most functions define both a global and a local entry
point; the local entry requires r2 to be already set up by the caller
to point to the callee's TOC; while the global entry does not require
the caller to know about the callee's TOC, but it needs to set up r12
to the callee's entry point address.
Now, when setting up a PLT slot, the dynamic linker will usually need
to enter the target function's global entry point. However, if the
linker can prove that the target function is in the same DSO as the
PLT slot itself, and the whole DSO only uses a single TOC (which the
linker will let ld.so know via a DT_PPC64_OPT entry), then it is
possible to actually enter the local entry point address into the
PLT slot, for a slight improvement in performance.
Note that this uncovered a problem on the first call via _dl_runtime_resolve,
because that routine neglected to restore the caller's TOC before calling
the target function for the first time, since it assumed that function
would always reload its own TOC anyway ...
2013-12-04 12:52:40 +00:00
|
|
|
#if _CALL_ELF == 2
|
|
|
|
/* Restore the caller's TOC in case we jump to a local entry point. */
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
ld r2,FRAME_SIZE+FRAME_TOC_SAVE(r1)
|
PowerPC64 ELFv2 ABI 3/6: PLT local entry point optimization
This is a follow-on to the previous patch to support the ELFv2 ABI in the
dynamic loader, split off into its own patch since it is just an optional
optimization.
In the ELFv2 ABI, most functions define both a global and a local entry
point; the local entry requires r2 to be already set up by the caller
to point to the callee's TOC; while the global entry does not require
the caller to know about the callee's TOC, but it needs to set up r12
to the callee's entry point address.
Now, when setting up a PLT slot, the dynamic linker will usually need
to enter the target function's global entry point. However, if the
linker can prove that the target function is in the same DSO as the
PLT slot itself, and the whole DSO only uses a single TOC (which the
linker will let ld.so know via a DT_PPC64_OPT entry), then it is
possible to actually enter the local entry point address into the
PLT slot, for a slight improvement in performance.
Note that this uncovered a problem on the first call via _dl_runtime_resolve,
because that routine neglected to restore the caller's TOC before calling
the target function for the first time, since it assumed that function
would always reload its own TOC anyway ...
2013-12-04 12:52:40 +00:00
|
|
|
#endif
|
2005-01-07 11:36:07 +00:00
|
|
|
/* Unwind the stack frame, and jump. */
|
2010-08-12 16:19:19 +00:00
|
|
|
addi r1,r1,FRAME_SIZE
|
2005-01-07 11:36:07 +00:00
|
|
|
bctr
|
|
|
|
END(_dl_runtime_resolve)
|
2010-08-12 16:19:19 +00:00
|
|
|
#undef FRAME_SIZE
|
|
|
|
#undef INT_PARMS
|
2005-01-07 11:36:07 +00:00
|
|
|
|
2013-12-04 12:59:37 +00:00
|
|
|
/* Stack layout: ELFv2 ABI.
|
|
|
|
+752 previous backchain
|
|
|
|
+744 spill_r31
|
|
|
|
+736 spill_r30
|
|
|
|
+720 v8
|
|
|
|
+704 v7
|
|
|
|
+688 v6
|
|
|
|
+672 v5
|
|
|
|
+656 v4
|
|
|
|
+640 v3
|
|
|
|
+624 v2
|
|
|
|
+608 v1
|
|
|
|
+600 fp10
|
|
|
|
ELFv1 ABI +592 fp9
|
|
|
|
+592 previous backchain +584 fp8
|
|
|
|
+584 spill_r31 +576 fp7
|
|
|
|
+576 spill_r30 +568 fp6
|
|
|
|
+560 v1 +560 fp5
|
|
|
|
+552 fp4 +552 fp4
|
|
|
|
+544 fp3 +544 fp3
|
|
|
|
+536 fp2 +536 fp2
|
|
|
|
+528 fp1 +528 fp1
|
|
|
|
+520 r4 +520 r4
|
|
|
|
+512 r3 +512 r3
|
2005-03-19 02:49:03 +00:00
|
|
|
return values
|
|
|
|
+504 free
|
|
|
|
+496 stackframe
|
|
|
|
+488 lr
|
|
|
|
+480 r1
|
|
|
|
+464 v13
|
|
|
|
+448 v12
|
|
|
|
+432 v11
|
|
|
|
+416 v10
|
|
|
|
+400 v9
|
|
|
|
+384 v8
|
|
|
|
+368 v7
|
|
|
|
+352 v6
|
|
|
|
+336 v5
|
|
|
|
+320 v4
|
|
|
|
+304 v3
|
|
|
|
+288 v2
|
|
|
|
* VMX Parms in V2-V13, V0-V1 are scratch
|
|
|
|
+284 vrsave
|
|
|
|
+280 free
|
|
|
|
+272 fp13
|
|
|
|
+264 fp12
|
|
|
|
+256 fp11
|
|
|
|
+248 fp10
|
|
|
|
+240 fp9
|
|
|
|
+232 fp8
|
|
|
|
+224 fp7
|
|
|
|
+216 fp6
|
|
|
|
+208 fp5
|
|
|
|
+200 fp4
|
|
|
|
+192 fp3
|
|
|
|
+184 fp2
|
|
|
|
+176 fp1
|
|
|
|
* FP Parms in FP1-FP13, FP0 is a scratch register
|
|
|
|
+168 r10
|
|
|
|
+160 r9
|
|
|
|
+152 r8
|
|
|
|
+144 r7
|
|
|
|
+136 r6
|
|
|
|
+128 r5
|
|
|
|
+120 r4
|
|
|
|
+112 r3
|
|
|
|
* Integer parms in R3-R10, R0 is scratch, R1 SP, R2 is TOC
|
|
|
|
+104 parm8
|
|
|
|
+96 parm7
|
|
|
|
+88 parm6
|
|
|
|
+80 parm5
|
|
|
|
+72 parm4
|
|
|
|
+64 parm3
|
|
|
|
+56 parm2
|
|
|
|
+48 parm1
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
* Parameter save area
|
|
|
|
* (v1 ABI: Allocated by the call, at least 8 double words)
|
|
|
|
+40 v1 ABI: TOC save area
|
|
|
|
+32 v1 ABI: Reserved for linker
|
|
|
|
+24 v1 ABI: Reserved for compiler / v2 ABI: TOC save area
|
2005-07-07 02:39:45 +00:00
|
|
|
+16 LR save area
|
2005-03-19 02:49:03 +00:00
|
|
|
+8 CR save area
|
|
|
|
r1+0 stack back chain
|
|
|
|
*/
|
2013-12-04 12:59:37 +00:00
|
|
|
#if _CALL_ELF == 2
|
|
|
|
# define FRAME_SIZE 752
|
|
|
|
# define VR_RTN 608
|
|
|
|
#else
|
|
|
|
# define FRAME_SIZE 592
|
|
|
|
# define VR_RTN 560
|
|
|
|
#endif
|
2005-03-19 02:49:03 +00:00
|
|
|
#define INT_RTN 512
|
|
|
|
#define FPR_RTN 528
|
|
|
|
#define STACK_FRAME 496
|
|
|
|
#define CALLING_LR 488
|
|
|
|
#define CALLING_SP 480
|
|
|
|
#define INT_PARMS 112
|
|
|
|
#define FPR_PARMS 176
|
|
|
|
#define VR_PARMS 288
|
|
|
|
#define VR_VRSAVE 284
|
|
|
|
.section ".toc","aw"
|
|
|
|
.LC__dl_hwcap:
|
|
|
|
# ifdef SHARED
|
2012-05-16 20:40:23 +00:00
|
|
|
.tc _rtld_local_ro[TC],_rtld_local_ro
|
2005-03-19 02:49:03 +00:00
|
|
|
# else
|
|
|
|
.tc _dl_hwcap[TC],_dl_hwcap
|
|
|
|
# endif
|
|
|
|
.section ".text"
|
2005-01-07 11:36:07 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
.machine "altivec"
|
|
|
|
/* On entry r0 contains the index of the PLT entry we need to fixup
|
|
|
|
and r11 contains the link_map (from PLT0+16). The link_map becomes
|
|
|
|
parm1 (r3) and the index (r0) needs to be converted to an offset
|
|
|
|
(index * 24) in parm2 (r4). */
|
2005-07-07 02:39:45 +00:00
|
|
|
#ifndef PROF
|
PowerPC64 ENTRY_TOCLESS
A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use
or change r2, yet declare a global entry that sets up r2. This patch
fixes that problem, and consolidates the ENTRY and EALIGN macros.
* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
(NOPS, ENTRY_3): New macros.
(ENTRY): Rewrite.
(ENTRY_TOCLESS): Define.
(EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5,
EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete.
* sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY.
* sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
* sysdeps/powerpc/powerpc64/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
* sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS.
* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
* sysdeps/powerpc/powerpc64/lshift.S: Likewise.
* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/mul_1.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l):
Likewise.
* sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise.
* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier. Don't
add nop when SHARED.
* sysdeps/powerpc/powerpc64/start.S: Fix comment.
* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't
define.
(ENTRY_TOCLESS): Define.
* sysdeps/powerpc/powerpc32/sysdep.h (ENTRY_TOCLESS): Define.
* sysdeps/powerpc/fpu/s_fma.S: Use ENTRY_TOCLESS.
* sysdeps/powerpc/fpu/s_fmaf.S: Likewise.
2017-06-14 01:15:50 +00:00
|
|
|
ENTRY (_dl_profile_resolve, 4)
|
2005-03-19 02:49:03 +00:00
|
|
|
/* Spill r30, r31 to preserve the link_map* and reloc_addr, in case we
|
|
|
|
need to call _dl_call_pltexit. */
|
|
|
|
std r31,-8(r1)
|
|
|
|
std r30,-16(r1)
|
2005-01-07 11:36:07 +00:00
|
|
|
/* We need to save the registers used to pass parameters, ie. r3 thru
|
|
|
|
r10; the registers are saved in a stack frame. */
|
2005-03-19 02:49:03 +00:00
|
|
|
stdu r1,-FRAME_SIZE(r1)
|
2006-01-07 03:58:05 +00:00
|
|
|
cfi_adjust_cfa_offset (FRAME_SIZE)
|
2010-08-12 16:19:19 +00:00
|
|
|
cfi_offset(r31,-8)
|
|
|
|
cfi_offset(r30,-16)
|
2005-03-19 02:49:03 +00:00
|
|
|
std r3,INT_PARMS+0(r1)
|
2005-01-08 07:10:00 +00:00
|
|
|
mr r3,r11
|
2005-03-19 02:49:03 +00:00
|
|
|
std r4,INT_PARMS+8(r1)
|
|
|
|
sldi r4,r0,1 /* index * 2 */
|
|
|
|
std r5,INT_PARMS+16(r1)
|
|
|
|
add r4,r4,r0 /* index * 3 */
|
|
|
|
std r6,INT_PARMS+24(r1)
|
|
|
|
sldi r4,r4,3 /* index * 24 == PLT offset */
|
2005-01-08 07:10:00 +00:00
|
|
|
mflr r5
|
2005-03-19 02:49:03 +00:00
|
|
|
std r7,INT_PARMS+32(r1)
|
|
|
|
std r8,INT_PARMS+40(r1)
|
2013-12-04 12:59:37 +00:00
|
|
|
/* Store the LR in the LR Save area. */
|
2005-03-19 02:49:03 +00:00
|
|
|
la r8,FRAME_SIZE(r1)
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
std r5,FRAME_SIZE+FRAME_LR_SAVE(r1)
|
|
|
|
cfi_offset (lr, FRAME_LR_SAVE)
|
2005-03-19 02:49:03 +00:00
|
|
|
std r5,CALLING_LR(r1)
|
|
|
|
std r9,INT_PARMS+48(r1)
|
|
|
|
std r10,INT_PARMS+56(r1)
|
|
|
|
std r8,CALLING_SP(r1)
|
|
|
|
ld r12,.LC__dl_hwcap@toc(r2)
|
|
|
|
#ifdef SHARED
|
2012-05-16 20:40:23 +00:00
|
|
|
/* Load _rtld_local_ro._dl_hwcap. */
|
2005-03-19 02:49:03 +00:00
|
|
|
ld r12,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r12)
|
|
|
|
#else
|
|
|
|
ld r12,0(r12) /* Load extern _dl_hwcap. */
|
|
|
|
#endif
|
|
|
|
andis. r0,r12,(PPC_FEATURE_HAS_ALTIVEC >> 16)
|
|
|
|
beq L(saveFP)
|
|
|
|
la r10,(VR_PARMS+0)(r1)
|
|
|
|
la r9,(VR_PARMS+16)(r1)
|
|
|
|
li r11,32
|
|
|
|
li r12,64
|
|
|
|
stvx v2,0,r10
|
|
|
|
stvx v3,0,r9
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
stvx v4,r11,r10
|
|
|
|
stvx v5,r11,r9
|
|
|
|
addi r11,r11,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
stvx v6,r12,r10
|
|
|
|
stvx v7,r12,r9
|
|
|
|
addi r12,r12,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
stvx v8,r11,r10
|
|
|
|
stvx v9,r11,r9
|
|
|
|
addi r11,r11,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
stvx v10,r12,r10
|
|
|
|
stvx v11,r12,r9
|
|
|
|
mfspr r0,VRSAVE
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
stvx v12,r11,r10
|
|
|
|
stvx v13,r11,r9
|
|
|
|
L(saveFP):
|
|
|
|
stw r0,VR_VRSAVE(r1)
|
2005-01-08 07:10:00 +00:00
|
|
|
/* Save floating registers. */
|
2005-03-19 02:49:03 +00:00
|
|
|
stfd fp1,FPR_PARMS+0(r1)
|
|
|
|
stfd fp2,FPR_PARMS+8(r1)
|
|
|
|
stfd fp3,FPR_PARMS+16(r1)
|
|
|
|
stfd fp4,FPR_PARMS+24(r1)
|
|
|
|
stfd fp5,FPR_PARMS+32(r1)
|
|
|
|
stfd fp6,FPR_PARMS+40(r1)
|
|
|
|
stfd fp7,FPR_PARMS+48(r1)
|
|
|
|
stfd fp8,FPR_PARMS+56(r1)
|
|
|
|
stfd fp9,FPR_PARMS+64(r1)
|
|
|
|
stfd fp10,FPR_PARMS+72(r1)
|
|
|
|
stfd fp11,FPR_PARMS+80(r1)
|
2005-01-08 07:10:00 +00:00
|
|
|
li r0,-1
|
2005-03-19 02:49:03 +00:00
|
|
|
stfd fp12,FPR_PARMS+88(r1)
|
|
|
|
stfd fp13,FPR_PARMS+96(r1)
|
|
|
|
/* Load the extra parameters. */
|
|
|
|
addi r6,r1,INT_PARMS
|
|
|
|
addi r7,r1,STACK_FRAME
|
|
|
|
/* Save link_map* and reloc_addr parms for later. */
|
|
|
|
mr r31,r3
|
|
|
|
mr r30,r4
|
|
|
|
std r0,0(r7)
|
2005-01-07 11:36:07 +00:00
|
|
|
bl JUMPTARGET(_dl_profile_fixup)
|
2010-08-12 16:19:19 +00:00
|
|
|
#ifndef SHARED
|
2005-03-19 02:49:03 +00:00
|
|
|
nop
|
2010-08-12 16:19:19 +00:00
|
|
|
#endif
|
2005-03-19 02:49:03 +00:00
|
|
|
/* Test *framesizep > 0 to see if need to do pltexit processing. */
|
|
|
|
ld r0,STACK_FRAME(r1)
|
2005-07-07 02:39:45 +00:00
|
|
|
/* Put the registers back. */
|
2005-03-19 02:49:03 +00:00
|
|
|
lwz r12,VR_VRSAVE(r1)
|
|
|
|
cmpdi cr1,r0,0
|
|
|
|
cmpdi cr0,r12,0
|
|
|
|
bgt cr1,L(do_pltexit)
|
|
|
|
la r10,(VR_PARMS+0)(r1)
|
|
|
|
la r9,(VR_PARMS+16)(r1)
|
|
|
|
/* VRSAVE must be non-zero if VMX is present and VRs are in use. */
|
|
|
|
beq L(restoreFXR)
|
|
|
|
li r11,32
|
|
|
|
li r12,64
|
|
|
|
lvx v2,0,r10
|
|
|
|
lvx v3,0,r9
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v4,r11,r10
|
|
|
|
lvx v5,r11,r9
|
|
|
|
addi r11,r11,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v6,r12,r10
|
|
|
|
lvx v7,r12,r9
|
|
|
|
addi r12,r12,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v8,r11,r10
|
|
|
|
lvx v9,r11,r9
|
|
|
|
addi r11,r11,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v10,r12,r10
|
|
|
|
lvx v11,r12,r9
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v12,r11,r10
|
|
|
|
lvx v13,r11,r9
|
|
|
|
L(restoreFXR):
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
|
2005-03-19 02:49:03 +00:00
|
|
|
ld r10,INT_PARMS+56(r1)
|
|
|
|
ld r9,INT_PARMS+48(r1)
|
|
|
|
ld r8,INT_PARMS+40(r1)
|
|
|
|
ld r7,INT_PARMS+32(r1)
|
2005-01-08 07:10:00 +00:00
|
|
|
mtlr r0
|
2005-03-19 02:49:03 +00:00
|
|
|
ld r6,INT_PARMS+24(r1)
|
|
|
|
ld r5,INT_PARMS+16(r1)
|
|
|
|
ld r4,INT_PARMS+8(r1)
|
2013-12-04 12:49:15 +00:00
|
|
|
/* Prepare for calling the function returned by fixup. */
|
|
|
|
PPC64_LOAD_FUNCPTR r3
|
2005-03-19 02:49:03 +00:00
|
|
|
ld r3,INT_PARMS+0(r1)
|
PowerPC64 ELFv2 ABI 3/6: PLT local entry point optimization
This is a follow-on to the previous patch to support the ELFv2 ABI in the
dynamic loader, split off into its own patch since it is just an optional
optimization.
In the ELFv2 ABI, most functions define both a global and a local entry
point; the local entry requires r2 to be already set up by the caller
to point to the callee's TOC; while the global entry does not require
the caller to know about the callee's TOC, but it needs to set up r12
to the callee's entry point address.
Now, when setting up a PLT slot, the dynamic linker will usually need
to enter the target function's global entry point. However, if the
linker can prove that the target function is in the same DSO as the
PLT slot itself, and the whole DSO only uses a single TOC (which the
linker will let ld.so know via a DT_PPC64_OPT entry), then it is
possible to actually enter the local entry point address into the
PLT slot, for a slight improvement in performance.
Note that this uncovered a problem on the first call via _dl_runtime_resolve,
because that routine neglected to restore the caller's TOC before calling
the target function for the first time, since it assumed that function
would always reload its own TOC anyway ...
2013-12-04 12:52:40 +00:00
|
|
|
#if _CALL_ELF == 2
|
|
|
|
/* Restore the caller's TOC in case we jump to a local entry point. */
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
ld r2,FRAME_SIZE+FRAME_TOC_SAVE(r1)
|
PowerPC64 ELFv2 ABI 3/6: PLT local entry point optimization
This is a follow-on to the previous patch to support the ELFv2 ABI in the
dynamic loader, split off into its own patch since it is just an optional
optimization.
In the ELFv2 ABI, most functions define both a global and a local entry
point; the local entry requires r2 to be already set up by the caller
to point to the callee's TOC; while the global entry does not require
the caller to know about the callee's TOC, but it needs to set up r12
to the callee's entry point address.
Now, when setting up a PLT slot, the dynamic linker will usually need
to enter the target function's global entry point. However, if the
linker can prove that the target function is in the same DSO as the
PLT slot itself, and the whole DSO only uses a single TOC (which the
linker will let ld.so know via a DT_PPC64_OPT entry), then it is
possible to actually enter the local entry point address into the
PLT slot, for a slight improvement in performance.
Note that this uncovered a problem on the first call via _dl_runtime_resolve,
because that routine neglected to restore the caller's TOC before calling
the target function for the first time, since it assumed that function
would always reload its own TOC anyway ...
2013-12-04 12:52:40 +00:00
|
|
|
#endif
|
2005-01-08 07:10:00 +00:00
|
|
|
/* Load the floating point registers. */
|
2005-03-19 02:49:03 +00:00
|
|
|
lfd fp1,FPR_PARMS+0(r1)
|
|
|
|
lfd fp2,FPR_PARMS+8(r1)
|
|
|
|
lfd fp3,FPR_PARMS+16(r1)
|
|
|
|
lfd fp4,FPR_PARMS+24(r1)
|
|
|
|
lfd fp5,FPR_PARMS+32(r1)
|
|
|
|
lfd fp6,FPR_PARMS+40(r1)
|
|
|
|
lfd fp7,FPR_PARMS+48(r1)
|
|
|
|
lfd fp8,FPR_PARMS+56(r1)
|
|
|
|
lfd fp9,FPR_PARMS+64(r1)
|
|
|
|
lfd fp10,FPR_PARMS+72(r1)
|
|
|
|
lfd fp11,FPR_PARMS+80(r1)
|
|
|
|
lfd fp12,FPR_PARMS+88(r1)
|
|
|
|
lfd fp13,FPR_PARMS+96(r1)
|
2005-01-07 11:36:07 +00:00
|
|
|
/* Unwind the stack frame, and jump. */
|
2013-12-04 12:59:37 +00:00
|
|
|
ld r31,FRAME_SIZE-8(r1)
|
|
|
|
ld r30,FRAME_SIZE-16(r1)
|
2005-03-19 02:49:03 +00:00
|
|
|
addi r1,r1,FRAME_SIZE
|
2005-01-07 11:36:07 +00:00
|
|
|
bctr
|
2013-12-04 12:59:37 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
L(do_pltexit):
|
|
|
|
la r10,(VR_PARMS+0)(r1)
|
|
|
|
la r9,(VR_PARMS+16)(r1)
|
|
|
|
beq L(restoreFXR2)
|
|
|
|
li r11,32
|
|
|
|
li r12,64
|
|
|
|
lvx v2,0,r10
|
|
|
|
lvx v3,0,r9
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v4,r11,r10
|
|
|
|
lvx v5,r11,r9
|
|
|
|
addi r11,r11,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v6,r12,r10
|
|
|
|
lvx v7,r12,r9
|
|
|
|
addi r12,r12,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v8,r11,r10
|
|
|
|
lvx v9,r11,r9
|
|
|
|
addi r11,r11,64
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v10,r12,r10
|
|
|
|
lvx v11,r12,r9
|
2005-07-07 02:39:45 +00:00
|
|
|
|
2005-03-19 02:49:03 +00:00
|
|
|
lvx v12,r11,r10
|
|
|
|
lvx v13,r11,r9
|
|
|
|
L(restoreFXR2):
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
|
2005-03-19 02:49:03 +00:00
|
|
|
ld r10,INT_PARMS+56(r1)
|
|
|
|
ld r9,INT_PARMS+48(r1)
|
|
|
|
ld r8,INT_PARMS+40(r1)
|
|
|
|
ld r7,INT_PARMS+32(r1)
|
|
|
|
mtlr r0
|
|
|
|
ld r6,INT_PARMS+24(r1)
|
|
|
|
ld r5,INT_PARMS+16(r1)
|
|
|
|
ld r4,INT_PARMS+8(r1)
|
2013-12-04 12:49:15 +00:00
|
|
|
/* Prepare for calling the function returned by fixup. */
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
std r2,FRAME_TOC_SAVE(r1)
|
2013-12-04 12:49:15 +00:00
|
|
|
PPC64_LOAD_FUNCPTR r3
|
2005-03-19 02:49:03 +00:00
|
|
|
ld r3,INT_PARMS+0(r1)
|
|
|
|
/* Load the floating point registers. */
|
|
|
|
lfd fp1,FPR_PARMS+0(r1)
|
|
|
|
lfd fp2,FPR_PARMS+8(r1)
|
|
|
|
lfd fp3,FPR_PARMS+16(r1)
|
|
|
|
lfd fp4,FPR_PARMS+24(r1)
|
|
|
|
lfd fp5,FPR_PARMS+32(r1)
|
|
|
|
lfd fp6,FPR_PARMS+40(r1)
|
|
|
|
lfd fp7,FPR_PARMS+48(r1)
|
|
|
|
lfd fp8,FPR_PARMS+56(r1)
|
|
|
|
lfd fp9,FPR_PARMS+64(r1)
|
|
|
|
lfd fp10,FPR_PARMS+72(r1)
|
|
|
|
lfd fp11,FPR_PARMS+80(r1)
|
|
|
|
lfd fp12,FPR_PARMS+88(r1)
|
|
|
|
lfd fp13,FPR_PARMS+96(r1)
|
|
|
|
/* Call the target function. */
|
|
|
|
bctrl
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
ld r2,FRAME_TOC_SAVE(r1)
|
2005-03-19 02:49:03 +00:00
|
|
|
lwz r12,VR_VRSAVE(r1)
|
|
|
|
/* But return here and store the return values. */
|
|
|
|
std r3,INT_RTN(r1)
|
|
|
|
std r4,INT_RTN+8(r1)
|
2013-12-04 12:59:37 +00:00
|
|
|
stfd fp1,FPR_RTN+0(r1)
|
|
|
|
stfd fp2,FPR_RTN+8(r1)
|
2005-03-19 02:49:03 +00:00
|
|
|
cmpdi cr0,r12,0
|
|
|
|
la r10,VR_RTN(r1)
|
2013-12-04 12:59:37 +00:00
|
|
|
stfd fp3,FPR_RTN+16(r1)
|
|
|
|
stfd fp4,FPR_RTN+24(r1)
|
|
|
|
#if _CALL_ELF == 2
|
|
|
|
la r12,VR_RTN+16(r1)
|
|
|
|
stfd fp5,FPR_RTN+32(r1)
|
|
|
|
stfd fp6,FPR_RTN+40(r1)
|
|
|
|
li r5,32
|
|
|
|
li r6,64
|
|
|
|
stfd fp7,FPR_RTN+48(r1)
|
|
|
|
stfd fp8,FPR_RTN+56(r1)
|
|
|
|
stfd fp9,FPR_RTN+64(r1)
|
|
|
|
stfd fp10,FPR_RTN+72(r1)
|
|
|
|
#endif
|
2005-03-19 02:49:03 +00:00
|
|
|
mr r3,r31
|
|
|
|
mr r4,r30
|
|
|
|
beq L(callpltexit)
|
|
|
|
stvx v2,0,r10
|
2013-12-04 12:59:37 +00:00
|
|
|
#if _CALL_ELF == 2
|
|
|
|
stvx v3,0,r12
|
|
|
|
stvx v4,r5,r10
|
|
|
|
stvx v5,r5,r12
|
|
|
|
addi r5,r5,64
|
|
|
|
stvx v6,r6,r10
|
|
|
|
stvx v7,r6,r12
|
|
|
|
stvx v8,r5,r10
|
|
|
|
stvx v9,r5,r12
|
|
|
|
#endif
|
2005-03-19 02:49:03 +00:00
|
|
|
L(callpltexit):
|
|
|
|
addi r5,r1,INT_PARMS
|
|
|
|
addi r6,r1,INT_RTN
|
|
|
|
bl JUMPTARGET(_dl_call_pltexit)
|
2010-08-12 16:19:19 +00:00
|
|
|
#ifndef SHARED
|
2005-03-19 02:49:03 +00:00
|
|
|
nop
|
2010-08-12 16:19:19 +00:00
|
|
|
#endif
|
2005-07-07 02:39:45 +00:00
|
|
|
/* Restore the return values from target function. */
|
2005-03-19 02:49:03 +00:00
|
|
|
lwz r12,VR_VRSAVE(r1)
|
|
|
|
ld r3,INT_RTN(r1)
|
|
|
|
ld r4,INT_RTN+8(r1)
|
2013-12-04 12:59:37 +00:00
|
|
|
lfd fp1,FPR_RTN+0(r1)
|
|
|
|
lfd fp2,FPR_RTN+8(r1)
|
2005-03-19 02:49:03 +00:00
|
|
|
cmpdi cr0,r12,0
|
2013-12-04 12:59:37 +00:00
|
|
|
la r11,VR_RTN(r1)
|
|
|
|
lfd fp3,FPR_RTN+16(r1)
|
|
|
|
lfd fp4,FPR_RTN+24(r1)
|
|
|
|
#if _CALL_ELF == 2
|
|
|
|
la r12,VR_RTN+16(r1)
|
|
|
|
lfd fp5,FPR_RTN+32(r1)
|
|
|
|
lfd fp6,FPR_RTN+40(r1)
|
|
|
|
li r30,32
|
|
|
|
li r31,64
|
|
|
|
lfd fp7,FPR_RTN+48(r1)
|
|
|
|
lfd fp8,FPR_RTN+56(r1)
|
|
|
|
lfd fp9,FPR_RTN+64(r1)
|
|
|
|
lfd fp10,FPR_RTN+72(r1)
|
|
|
|
#endif
|
2005-03-19 02:49:03 +00:00
|
|
|
beq L(pltexitreturn)
|
2013-12-04 12:59:37 +00:00
|
|
|
lvx v2,0,r11
|
|
|
|
#if _CALL_ELF == 2
|
|
|
|
lvx v3,0,r12
|
|
|
|
lvx v4,r30,r11
|
|
|
|
lvx v5,r30,r12
|
|
|
|
addi r30,r30,64
|
|
|
|
lvx v6,r31,r11
|
|
|
|
lvx v7,r31,r12
|
|
|
|
lvx v8,r30,r11
|
|
|
|
lvx v9,r30,r12
|
|
|
|
#endif
|
2005-03-19 02:49:03 +00:00
|
|
|
L(pltexitreturn):
|
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the
stack frame layout. These are described in more detail here:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
Specifically, the "compiler and linker doublewords" were removed,
which has the effect that the save slot for the TOC register is
now at offset 24 rather than 40 to the stack pointer.
In addition, a function may now no longer necessarily assume that
its caller has set up a 64-byte register save area its use.
To address the first change, the patch goes through all assembler
files and replaces immediate offsets in instructions accessing the
ABI-defined stack slots by symbolic offsets. Those already were
defined in ucontext_i.sym and used in some of the context routines,
but that doesn't really seem like the right place for those defines.
The patch instead defines those symbolic offsets in sysdeps.h,
in two variants for the old and new ABI, and uses them systematically
in all assembler files, not just the context routines.
The second change only affected a few assembler files that used
the save area to temporarily store some registers. In those
cases where this happens within a leaf function, this patch
changes the code to store those registers to the "red zone"
below the stack pointer. Otherwise, the functions already allocate
a stack frame, and the patch changes them to add extra space in
these frames as temporary space for the ELFv2 ABI.
2013-12-04 12:55:03 +00:00
|
|
|
ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
|
2013-12-04 12:59:37 +00:00
|
|
|
ld r31,FRAME_SIZE-8(r1)
|
|
|
|
ld r30,FRAME_SIZE-16(r1)
|
2005-03-19 02:49:03 +00:00
|
|
|
mtlr r0
|
|
|
|
ld r1,0(r1)
|
|
|
|
blr
|
2005-01-07 11:36:07 +00:00
|
|
|
END(_dl_profile_resolve)
|
2005-07-07 02:39:45 +00:00
|
|
|
#endif
|