Back to index

glibc  2.9
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 and/or
00007    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 GNU 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    Note that people who make modified versions of this file are not
00021    obligated to grant this special exception for their modified
00022    versions; it is their choice whether to do so. The GNU Lesser
00023    General Public License gives permission to release a modified
00024    version without this exception; this exception also makes it
00025    possible to release a modified version which carries forward this
00026    exception.
00027 
00028    The GNU C Library is distributed in the hope that it will be useful,
00029    but WITHOUT ANY WARRANTY; without even the implied warranty of
00030    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00031    Lesser General Public License for more details.
00032 
00033    You should have received a copy of the GNU Lesser General Public
00034    License along with the GNU C Library; if not, write to the Free
00035    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00036    02111-1307 USA.  */
00037 
00038 /* This file is compiled into assembly code which is then munged by a sed
00039    script into two files: crti.s and crtn.s.
00040 
00041    * crti.s puts a function prologue at the beginning of the
00042    .init and .fini sections and defines global symbols for
00043    those addresses, so they can be called as functions.
00044 
00045    * crtn.s puts the corresponding function epilogues
00046    in the .init and .fini sections. */
00047 
00048 __asm__ ("\
00049 \n\
00050 #include \"defs.h\"\n\
00051 \n\
00052 /*@HEADER_ENDS*/\n\
00053 \n\
00054 /*@TESTS_BEGIN*/\n\
00055 \n\
00056 /*@TESTS_END*/\n\
00057 \n\
00058 /*@_init_PROLOG_BEGINS*/\n\
00059 \n\
00060        .section .init\n\
00061 #NO_APP\n\
00062        .align 4\n\
00063 .globl _init\n\
00064        .type   _init,@function\n\
00065 _init:\n\
00066 #      leaf function           0\n\
00067 #      automatics              0\n\
00068 #      outgoing args           0\n\
00069 #      need frame pointer      0\n\
00070 #      call alloca             0\n\
00071 #      has varargs             0\n\
00072 #      incoming args (stack)   0\n\
00073 #      function length         36\n\
00074        STMG   6,15,48(15)\n\
00075        LGR    1,15\n\
00076        AGHI   15,-160\n\
00077        STG    1,0(15)\n\
00078         LARL    12,_GLOBAL_OFFSET_TABLE_\n\
00079        LARL    1,__gmon_start__@GOTENT\n\
00080        LG      1,0(1)\n\
00081        LTGR    1,1\n\
00082        JE      .L22\n\
00083        BASR    14,1\n\
00084 .L22:\n\
00085 #APP\n\
00086        .align 4,0x07\n\
00087        END_INIT\n\
00088 \n\
00089 /*@_init_PROLOG_ENDS*/\n\
00090 \n\
00091 /*@_init_EPILOG_BEGINS*/\n\
00092        .align 4\n\
00093        .section .init\n\
00094 #NO_APP\n\
00095        .align 4\n\
00096        LG     4,272(15)\n\
00097        LMG    6,15,208(15)\n\
00098        BR     4\n\
00099 #APP\n\
00100        END_INIT\n\
00101 \n\
00102 /*@_init_EPILOG_ENDS*/\n\
00103 \n\
00104 /*@_fini_PROLOG_BEGINS*/\n\
00105        .section .fini\n\
00106 #NO_APP\n\
00107        .align 4\n\
00108 .globl _fini\n\
00109        .type   _fini,@function\n\
00110 _fini:\n\
00111 #      leaf function           0\n\
00112 #      automatics              0\n\
00113 #      outgoing args           0\n\
00114 #      need frame pointer      0\n\
00115 #      call alloca             0\n\
00116 #      has varargs             0\n\
00117 #      incoming args (stack)   0\n\
00118 #      function length         30\n\
00119        STMG   6,15,48(15)\n\
00120        LGR    1,15\n\
00121        AGHI   15,-160\n\
00122        STG    1,0(15)\n\
00123        LARL   12,_GLOBAL_OFFSET_TABLE_\n\
00124 #APP\n\
00125        .align 4,0x07\n\
00126        END_FINI\n\
00127 \n\
00128 /*@_fini_PROLOG_ENDS*/\n\
00129 \n\
00130 /*@_fini_EPILOG_BEGINS*/\n\
00131        .align 4\n\
00132        .section .fini\n\
00133 #NO_APP\n\
00134        .align 4\n\
00135        LG     4,272(15)\n\
00136        LMG    6,15,208(15)\n\
00137        BR     4\n\
00138 #APP\n\
00139        END_FINI\n\
00140 \n\
00141 /*@_fini_EPILOG_ENDS*/\n\
00142 \n\
00143        /*@TRAILER_BEGINS*/\
00144 ");