]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / powerpc / powerpc32 / ____longjmp_chk.S
CommitLineData
2b778ceb 1/* Copyright (C) 2009-2021 Free Software Foundation, Inc.
0323b051
AS
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
0323b051
AS
17
18#include <sysdep.h>
19#include <rtld-global-offsets.h>
20
15efafdf
AS
21 .section .rodata.str1.4,"aMS",@progbits,1
22 .align 2
0323b051
AS
23.LC0:
24 .string "longjmp causes uninitialized stack frame"
25 .text
26
eb5ad6b9 27#define __longjmp_symbol ____longjmp_chk
0323b051 28
80a98966 29#ifdef PIC
80a98966 30# define LOAD_ARG \
91d2a845
WS
31 SETUP_GOT_ACCESS(r3,got_label2); \
32 addis r3,r3,_GLOBAL_OFFSET_TABLE_-got_label2@ha; \
33 addi r3,r3,_GLOBAL_OFFSET_TABLE_-got_label2@l; \
80a98966 34 lwz r3,.LC0@got(r3)
80a98966
AS
35#else
36# define LOAD_ARG \
37 lis r3,.LC0@ha; \
38 la r3,.LC0@l(r3)
39#endif
40
0323b051
AS
41#define CHECK_SP(reg) \
42 cmplw reg, r1; \
43 bge+ .Lok; \
15efafdf
AS
44 mflr r0; \
45 stwu r1,-32(r1); \
46 cfi_remember_state; \
47 cfi_adjust_cfa_offset (32); \
48 stw r0,36(r1); \
49 cfi_offset (lr, 4); \
50 mr r31,r3; \
51 mr r30,r4; \
52 li r3,0; \
53 addi r4,r1,8; \
54 li r0,__NR_sigaltstack; \
55 sc; \
56 /* Without working sigaltstack we cannot perform the test. */ \
57 bso .Lok2; \
58 lwz r0,12(r1); \
59 andi. r3,r0,1; \
60 beq .Lfail; \
61 lwz r0,16(r1); \
62 lwz r3,8(r1); \
63 add r3,r3,r0; \
64 sub r3,r3,reg; \
65 cmplw r3,r0; \
66 bge+ .Lok2; \
67.Lfail: \
80a98966 68 LOAD_ARG; \
0323b051 69 bl HIDDEN_JUMPTARGET (__fortify_fail); \
15efafdf
AS
70.Lok2: \
71 mr r3,r31; \
72 mr r4,r30; \
73 cfi_restore_state; \
0323b051
AS
74.Lok:
75
76#include <__longjmp-common.S>