]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/arm/____longjmp_chk.S
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / arm / ____longjmp_chk.S
CommitLineData
04277e02 1/* Copyright (C) 2009-2019 Free Software Foundation, Inc.
ef889ffe
JM
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
22423683 14 You should have received a copy of the GNU Lesser General Public
ab84e3ff 15 License along with the GNU C Library. If not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
ef889ffe 17
53df8bce 18#include <sysdep.h>
ef889ffe
JM
19
20 .section .rodata.str1.1,"aMS",%progbits,1
21 .type longjmp_msg,%object
22longjmp_msg:
23 .string "longjmp causes uninitialized stack frame"
24 .size longjmp_msg, .-longjmp_msg
25 .text
26
27#define __longjmp ____longjmp_chk
28
29#ifdef PIC
30# define CALL_FAIL \
31 ldr sl, .L_GOT; \
01b32e73 32 cfi_undefined (sl); \
ef889ffe
JM
33.L_GOT_OFF: \
34 add sl, pc, sl; \
35 ldr r0, .Lstr; \
36 add r0, sl, r0; \
37 B PLTJMP(HIDDEN_JUMPTARGET(__fortify_fail)); \
38.L_GOT: \
39 .word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8); \
40.Lstr: \
41 .word longjmp_msg(GOTOFF);
42#else
43# define CALL_FAIL \
44 ldr r0, .Lstr; \
45 B HIDDEN_JUMPTARGET(__fortify_fail); \
46.Lstr: \
47 .word longjmp_msg;
48#endif
49
50#define CHECK_SP(reg) \
01b32e73 51 cfi_remember_state; \
53df8bce 52 cmp sp, reg; \
bf89c0e2 53 bls .Lok; \
55668624 54 push { r7 }; \
420d6ddd
RT
55 cfi_adjust_cfa_offset (4); \
56 cfi_rel_offset (r7, 0); \
53df8bce 57 mov r5, r0; \
01b32e73 58 cfi_undefined (r5); \
53df8bce
JM
59 mov r7, #SYS_ify(sigaltstack); \
60 mov r0, #0; \
420d6ddd
RT
61 sub sp, sp, #12; /* == sizeof (stack_t) */ \
62 cfi_adjust_cfa_offset (12); \
01b32e73 63 cfi_remember_state; \
53df8bce
JM
64 mov r1, sp; \
65 swi #0; \
66 cmp r0, #0; \
67 bne .Lok2; \
68 ldr r1, [sp, #4]; \
69 tst r1, #1; \
70 beq .Lfail; \
71 ldr r2, [sp, #0]; \
72 ldr r3, [sp, #8]; \
73 add r2, r2, r3; \
74 sub r2, r2, reg; \
75 cmp r2, r3; \
76 bhi .Lok2; \
77.Lfail: \
420d6ddd
RT
78 add sp, sp, #12; \
79 cfi_adjust_cfa_offset (-12); \
55668624 80 pop { r7 }; \
420d6ddd
RT
81 cfi_adjust_cfa_offset (-4); \
82 cfi_restore (r7); \
ef889ffe 83 CALL_FAIL \
01b32e73 84 cfi_restore_state; \
53df8bce
JM
85.Lok2: \
86 mov r0, r5; \
01b32e73 87 cfi_restore_state; \
ef889ffe
JM
88.Lok:
89
90#include <__longjmp.S>