1 ###################################-*-asm*- 2 # 3 # Copyright (C) 2009-2024 Free Software Foundation, Inc. 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 # 27 # stack_overflow_exit.S 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 36 /* An executable stack is *not* required for these functions. */ 37 #ifdef __linux__ 38 .section .note.GNU-stack,"",%progbits 39 .previous 40 #endif 41 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 68