]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/config/microblaze/stack_overflow_exit.S
Enable no-exec stacks for more targets using the Linux kernel.
[thirdparty/gcc.git] / libgcc / config / microblaze / stack_overflow_exit.S
CommitLineData
80920132
ME
1###################################-*-asm*-
2#
cbe34bb5 3# Copyright (C) 2009-2017 Free Software Foundation, Inc.
80920132
ME
4#
5#
6# Contributed by Michael Eager <eager@eagercon.com>.
7#
8# This file is free software; you can redistribute it and/or modify it
9# under the terms of the GNU General Public License as published by the
10# Free Software Foundation; either version 3, or (at your option) any
11# later version.
12#
13# GCC is distributed in the hope that it will be useful, but WITHOUT
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16# License for more details.
17#
18# Under Section 7 of GPL version 3, you are granted additional
19# permissions described in the GCC Runtime Library Exception, version
20# 3.1, as published by the Free Software Foundation.
21#
22# You should have received a copy of the GNU General Public License and
23# a copy of the GCC Runtime Library Exception along with this program;
24# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25# <http://www.gnu.org/licenses/>.
26#
f9989b51 27# stack_overflow_exit.S
80920132
ME
28#
29# Checks for stack overflows and sets the global variable
30# stack_overflow_error with the value of current stack pointer
31#
32# This routine exits from the program
33#
34#######################################
35
938b6f1e
JM
36/* An executable stack is *not* required for these functions. */
37#ifdef __linux__
38.section .note.GNU-stack,"",%progbits
39.previous
40#endif
41
80920132
ME
42 .globl _stack_overflow_error
43 .data
44 .align 2
45 .type _stack_overflow_error,@object
46 .size _stack_overflow_error,4
47_stack_overflow_error:
48 .data32 0
49
50 .text
51 .globl _stack_overflow_exit
52 .ent _stack_overflow_exit
53 .type _stack_overflow_exit,@function
54
55_stack_overflow_exit:
56#ifdef __PIC__
57 mfs r20,rpc
58 addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
59 swi r1,r20,_stack_overflow_error@GOTOFF
60 bri exit@PLT
61#else
62 swi r1,r0,_stack_overflow_error
63 bri exit
64#endif
65
66 .end _stack_overflow_exit
67 .size _stack_overflow_exit,. - _stack_overflow_exit