Home | History | Annotate | Line # | Download | only in microblaze
      1 /* crti.s for __init, __fini
      2    This file supplies the prologue for __init and __fini routines
      3 
      4    Copyright (C) 2009-2024 Free Software Foundation, Inc.
      5 
      6    Contributed by Michael Eager <eager (at) 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 /* An executable stack is *not* required for these functions.  */
     28 #ifdef __linux__
     29 .section .note.GNU-stack,"",%progbits
     30 .previous
     31 #endif
     32 
     33     .section .init, "ax"
     34     .global __init
     35 
     36     .weak _stack
     37     .set  _stack, 0xffffffff
     38     .weak _stack_end
     39     .set  _stack_end, 0
     40 
     41     .align 2
     42 __init:
     43     addik   r1, r1, -8
     44     sw      r15, r0, r1
     45     la      r11, r0, _stack
     46     mts     rshr, r11
     47     la      r11, r0, _stack_end
     48     mts     rslr, r11
     49 
     50     .section .fini, "ax"
     51     .global __fini
     52     .align 2
     53 __fini:
     54     addik   r1, r1, -8
     55     sw      r15, r0, r1
     56