Back to index

glibc  2.9
pt-initfini.c
Go to the documentation of this file.
00001 /* Special .init and .fini section support for S/390.
00002    Copyright (C) 2003 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
00006    and/or 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 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    The GNU C Library is distributed in the hope that it will be
00020    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00021    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022    GNU Lesser General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public
00025    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00026    write to the Free Software Foundation, 59 Temple Place - Suite 330,
00027    Boston, MA 02111-1307, USA.  */
00028 
00029 /* This file is compiled into assembly code which is then munged by a sed
00030    script into two files: crti.s and crtn.s.
00031 
00032    * crti.s puts a function prologue at the beginning of the
00033    .init and .fini sections and defines global symbols for
00034    those addresses, so they can be called as functions.
00035 
00036    * crtn.s puts the corresponding function epilogues
00037    in the .init and .fini sections. */
00038 
00039 __asm__ ("\
00040 \n\
00041 #include \"defs.h\"\n\
00042 \n\
00043 /*@HEADER_ENDS*/\n\
00044 \n\
00045 /*@TESTS_BEGIN*/\n\
00046 \n\
00047 /*@TESTS_END*/\n\
00048 \n\
00049 /*@_init_PROLOG_BEGINS*/\n\
00050 \n\
00051        .section .init\n\
00052 #NO_APP\n\
00053        .align 4\n\
00054 .globl _init\n\
00055        .type   _init,@function\n\
00056 _init:\n\
00057 #      leaf function           0\n\
00058 #      automatics              0\n\
00059 #      outgoing args           0\n\
00060 #      need frame pointer      0\n\
00061 #      call alloca             0\n\
00062 #      has varargs             0\n\
00063 #      incoming args (stack)   0\n\
00064 #      function length         36\n\
00065        STM    6,15,24(15)\n\
00066        BRAS   13,.LTN1_0\n\
00067 .LT1_0:\n\
00068 .LC13:\n\
00069        .long  __pthread_initialize_minimal_internal-.LT1_0\n\
00070 .LC14:\n\
00071        .long  __gmon_start__@GOT\n\
00072 .LC15:\n\
00073        .long  _GLOBAL_OFFSET_TABLE_-.LT1_0\n\
00074 .LTN1_0:\n\
00075        LR     1,15\n\
00076        AHI    15,-96\n\
00077        ST     1,0(15)\n\
00078        L      12,.LC15-.LT1_0(13)\n\
00079        AR     12,13\n\
00080        L     1,.LC13-.LT1_0(13)\n\
00081        LA    1,0(1,13)\n\
00082        BASR  14,1\n\
00083        L     1,.LC14-.LT1_0(13)\n\
00084        L     1,0(1,12)\n\
00085        LTR   1,1\n\
00086        JE    .L22\n\
00087        BASR  14,1\n\
00088 .L22:\n\
00089 #APP\n\
00090        .align 4,0x07\n\
00091        END_INIT\n\
00092 \n\
00093 /*@_init_PROLOG_ENDS*/\n\
00094 \n\
00095 /*@_init_EPILOG_BEGINS*/\n\
00096        .align 4\n\
00097        .section .init\n\
00098 #NO_APP\n\
00099        .align 4\n\
00100        L      4,152(15)\n\
00101        LM     6,15,120(15)\n\
00102        BR     4\n\
00103 #APP\n\
00104        END_INIT\n\
00105 \n\
00106 /*@_init_EPILOG_ENDS*/\n\
00107 \n\
00108 /*@_fini_PROLOG_BEGINS*/\n\
00109        .section .fini\n\
00110 #NO_APP\n\
00111        .align 4\n\
00112 .globl _fini\n\
00113        .type   _fini,@function\n\
00114 _fini:\n\
00115 #      leaf function           0\n\
00116 #      automatics              0\n\
00117 #      outgoing args           0\n\
00118 #      need frame pointer      0\n\
00119 #      call alloca             0\n\
00120 #      has varargs             0\n\
00121 #      incoming args (stack)   0\n\
00122 #      function length         30\n\
00123        STM    6,15,24(15)\n\
00124        BRAS   13,.LTN2_0\n\
00125 .LT2_0:\n\
00126 .LC17:\n\
00127        .long  _GLOBAL_OFFSET_TABLE_-.LT2_0\n\
00128 .LTN2_0:\n\
00129        LR     1,15\n\
00130        AHI    15,-96\n\
00131        ST     1,0(15)\n\
00132        L      12,.LC17-.LT2_0(13)\n\
00133        AR     12,13\n\
00134 #APP\n\
00135        .align 4,0x07\n\
00136        END_FINI\n\
00137 \n\
00138 /*@_fini_PROLOG_ENDS*/\n\
00139 \n\
00140 /*@_fini_EPILOG_BEGINS*/\n\
00141        .align 4\n\
00142        .section .fini\n\
00143 #NO_APP\n\
00144        .align 4\n\
00145        L      4,152(15)\n\
00146        LM     6,15,120(15)\n\
00147        BR     4\n\
00148 #APP\n\
00149        END_FINI\n\
00150 \n\
00151 /*@_fini_EPILOG_ENDS*/\n\
00152 \n\
00153 /*@TRAILER_BEGINS*/\
00154 ");