Back to index

glibc  2.9
pt-initfini.c
Go to the documentation of this file.
00001 /* Special .init and .fini section support for 64 bit S/390.
00002    Copyright (C) 2001 Free Software Foundation, Inc.
00003    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
00004    This file is part of the GNU C Library.
00005 
00006    The GNU C Library is free software; you can redistribute it
00007    and/or modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    In addition to the permissions in the GNU Lesser General Public
00012    License, the Free Software Foundation gives you unlimited
00013    permission to link the compiled version of this file with other
00014    programs, and to distribute those programs without any restriction
00015    coming from the use of this file.  (The Lesser General Public
00016    License restrictions do apply in other respects; for example, they
00017    cover modification of the file, and distribution when not linked
00018    into another program.)
00019 
00020    The GNU C Library is distributed in the hope that it will be
00021    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00022    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023    GNU Lesser General Public License for more details.
00024 
00025    You should have received a copy of the GNU Lesser General Public
00026    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00027    write to the Free Software Foundation, 59 Temple Place - Suite 330,
00028    Boston, MA 02111-1307, USA.  */
00029 
00030 /* This file is compiled into assembly code which is then munged by a sed
00031    script into two files: crti.s and crtn.s.
00032 
00033    * crti.s puts a function prologue at the beginning of the
00034    .init and .fini sections and defines global symbols for
00035    those addresses, so they can be called as functions.
00036 
00037    * crtn.s puts the corresponding function epilogues
00038    in the .init and .fini sections. */
00039 
00040 __asm__ ("\
00041 \n\
00042 #include \"defs.h\"\n\
00043 \n\
00044 /*@HEADER_ENDS*/\n\
00045 \n\
00046 /*@TESTS_BEGIN*/\n\
00047 \n\
00048 /*@TESTS_END*/\n\
00049 \n\
00050 /*@_init_PROLOG_BEGINS*/\n\
00051 \n\
00052        .section .init\n\
00053 #NO_APP\n\
00054        .align 4\n\
00055 .globl _init\n\
00056        .type   _init,@function\n\
00057 _init:\n\
00058 #      leaf function           0\n\
00059 #      automatics              0\n\
00060 #      outgoing args           0\n\
00061 #      need frame pointer      0\n\
00062 #      call alloca             0\n\
00063 #      has varargs             0\n\
00064 #      incoming args (stack)   0\n\
00065 #      function length         36\n\
00066        STMG   6,15,48(15)\n\
00067        LGR    1,15\n\
00068        AGHI   15,-160\n\
00069        STG    1,0(15)\n\
00070        LARL   12,_GLOBAL_OFFSET_TABLE_\n\
00071        BRASL  14,__pthread_initialize_minimal@PLT\n\
00072        LARL   1,__gmon_start__@GOTENT\n\
00073        LG     1,0(1)\n\
00074        LTGR   1,1\n\
00075        JE     .L22\n\
00076        BASR   14,1\n\
00077 .L22:\n\
00078 #APP\n\
00079        .align 4,0x07\n\
00080        END_INIT\n\
00081 \n\
00082 /*@_init_PROLOG_ENDS*/\n\
00083 \n\
00084 /*@_init_EPILOG_BEGINS*/\n\
00085        .align 4\n\
00086        .section .init\n\
00087 #NO_APP\n\
00088        .align 4\n\
00089        LG     4,272(15)\n\
00090        LMG    6,15,208(15)\n\
00091        BR     4\n\
00092 #APP\n\
00093        END_INIT\n\
00094 \n\
00095 /*@_init_EPILOG_ENDS*/\n\
00096 \n\
00097 /*@_fini_PROLOG_BEGINS*/\n\
00098        .section .fini\n\
00099 #NO_APP\n\
00100        .align 4\n\
00101 .globl _fini\n\
00102        .type   _fini,@function\n\
00103 _fini:\n\
00104 #      leaf function           0\n\
00105 #      automatics              0\n\
00106 #      outgoing args           0\n\
00107 #      need frame pointer      0\n\
00108 #      call alloca             0\n\
00109 #      has varargs             0\n\
00110 #      incoming args (stack)   0\n\
00111 #      function length         30\n\
00112        STMG   6,15,48(15)\n\
00113        LGR    1,15\n\
00114        AGHI   15,-160\n\
00115        STG    1,0(15)\n\
00116        LARL   12,_GLOBAL_OFFSET_TABLE_\n\
00117 #APP\n\
00118        .align 4,0x07\n\
00119        END_FINI\n\
00120 \n\
00121 /*@_fini_PROLOG_ENDS*/\n\
00122 \n\
00123 /*@_fini_EPILOG_BEGINS*/\n\
00124        .align 4\n\
00125        .section .fini\n\
00126 #NO_APP\n\
00127        .align 4\n\
00128        LG     4,272(15)\n\
00129        LMG    6,15,208(15)\n\
00130        BR     4\n\
00131 #APP\n\
00132        END_FINI\n\
00133 \n\
00134 /*@_fini_EPILOG_ENDS*/\n\
00135 \n\
00136 /*@TRAILER_BEGINS*/\n\
00137        ");