Back to index

glibc  2.9
initfini.c
Go to the documentation of this file.
00001 /* Special .init and .fini section support for S/390.
00002    Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    In addition to the permissions in the GNU Lesser General Public
00011    License, the Free Software Foundation gives you unlimited
00012    permission to link the compiled version of this file with other
00013    programs, and to distribute those programs without any restriction
00014    coming from the use of this file. (The GNU Lesser General Public
00015    License restrictions do apply in other respects; for example, they
00016    cover modification of the file, and distribution when not linked
00017    into another program.)
00018 
00019    Note that people who make modified versions of this file are not
00020    obligated to grant this special exception for their modified
00021    versions; it is their choice whether to do so. The GNU Lesser
00022    General Public License gives permission to release a modified
00023    version without this exception; this exception also makes it
00024    possible to release a modified version which carries forward this
00025    exception.
00026 
00027    The GNU C Library is distributed in the hope that it will be useful,
00028    but WITHOUT ANY WARRANTY; without even the implied warranty of
00029    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00030    Lesser General Public License for more details.
00031 
00032    You should have received a copy of the GNU Lesser General Public
00033    License along with the GNU C Library; if not, write to the Free
00034    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00035    02111-1307 USA.  */
00036 
00037 /* This file is compiled into assembly code which is then munged by a sed
00038    script into two files: crti.s and crtn.s.
00039 
00040    * crti.s puts a function prologue at the beginning of the
00041    .init and .fini sections and defines global symbols for
00042    those addresses, so they can be called as functions.
00043 
00044    * crtn.s puts the corresponding function epilogues
00045    in the .init and .fini sections. */
00046 
00047 __asm__ ("\
00048 \n\
00049 #include \"defs.h\"\n\
00050 \n\
00051 /*@HEADER_ENDS*/\n\
00052 \n\
00053 /*@TESTS_BEGIN*/\n\
00054 \n\
00055 /*@TESTS_END*/\n\
00056 \n\
00057 /*@_init_PROLOG_BEGINS*/\n\
00058 \n\
00059        .section .init\n\
00060 #NO_APP\n\
00061        .align 4\n\
00062 .globl _init\n\
00063        .type   _init,@function\n\
00064 _init:\n\
00065 #      leaf function           0\n\
00066 #      automatics              0\n\
00067 #      outgoing args           0\n\
00068 #      need frame pointer      0\n\
00069 #      call alloca             0\n\
00070 #      has varargs             0\n\
00071 #      incoming args (stack)   0\n\
00072 #      function length         36\n\
00073        STM    6,15,24(15)\n\
00074        BRAS   13,.LTN1_0\n\
00075 .LT1_0:\n\
00076 .LC14:\n\
00077        .long  __gmon_start__@GOT\n\
00078 .LC15:\n\
00079        .long  _GLOBAL_OFFSET_TABLE_-.LT1_0\n\
00080 .LTN1_0:\n\
00081        LR     1,15\n\
00082        AHI    15,-96\n\
00083        ST     1,0(15)\n\
00084        L      12,.LC15-.LT1_0(13)\n\
00085        AR     12,13\n\
00086        L     1,.LC14-.LT1_0(13)\n\
00087        L     1,0(1,12)\n\
00088        LTR   1,1\n\
00089        JE    .L22\n\
00090        BASR  14,1\n\
00091 .L22:\n\
00092 #APP\n\
00093        .align 4,0x07\n\
00094        END_INIT\n\
00095 \n\
00096 /*@_init_PROLOG_ENDS*/\n\
00097 \n\
00098 /*@_init_EPILOG_BEGINS*/\n\
00099        .align 4\n\
00100        .section .init\n\
00101 #NO_APP\n\
00102        .align 4\n\
00103        L      4,152(15)\n\
00104        LM     6,15,120(15)\n\
00105        BR     4\n\
00106 #APP\n\
00107        END_INIT\n\
00108 \n\
00109 /*@_init_EPILOG_ENDS*/\n\
00110 \n\
00111 /*@_fini_PROLOG_BEGINS*/\n\
00112        .section .fini\n\
00113 #NO_APP\n\
00114        .align 4\n\
00115 .globl _fini\n\
00116        .type   _fini,@function\n\
00117 _fini:\n\
00118 #      leaf function           0\n\
00119 #      automatics              0\n\
00120 #      outgoing args           0\n\
00121 #      need frame pointer      0\n\
00122 #      call alloca             0\n\
00123 #      has varargs             0\n\
00124 #      incoming args (stack)   0\n\
00125 #      function length         30\n\
00126        STM    6,15,24(15)\n\
00127        BRAS   13,.LTN2_0\n\
00128 .LT2_0:\n\
00129 .LC17:\n\
00130        .long  _GLOBAL_OFFSET_TABLE_-.LT2_0\n\
00131 .LTN2_0:\n\
00132        LR     1,15\n\
00133        AHI    15,-96\n\
00134        ST     1,0(15)\n\
00135        L      12,.LC17-.LT2_0(13)\n\
00136        AR     12,13\n\
00137 #APP\n\
00138        .align 4,0x07\n\
00139        END_FINI\n\
00140 \n\
00141 /*@_fini_PROLOG_ENDS*/\n\
00142 \n\
00143 /*@_fini_EPILOG_BEGINS*/\n\
00144        .align 4\n\
00145        .section .fini\n\
00146 #NO_APP\n\
00147        .align 4\n\
00148        L      4,152(15)\n\
00149        LM     6,15,120(15)\n\
00150        BR     4\n\
00151 #APP\n\
00152        END_FINI\n\
00153 \n\
00154 /*@_fini_EPILOG_ENDS*/\n\
00155 \n\
00156 /*@TRAILER_BEGINS*/\
00157 ");