This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
uclibc initfini specs
- From: Rogelio Serrano <rogelio at smsglobal dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 30 Oct 2003 19:50:43 -0800 (PST)
- Subject: uclibc initfini specs
- Reply-to: rogelio at smsglobal dot net
How should the init and fini functions work? Im trying to build uclibc
with gcc-3.4. the initfini.S generated from initfini.c is different
from how those generated with gcc-3.3.2. I tried creating the crti.S
and crtn.S files by hand. My test programs seg fault when run though.
.file "initfini.c"
#APP
/*@HEADER_ENDS*/
/*@_init_PROLOG_BEGINS*/
.section .init
/*@_init_EPILOG_ENDS*/
/*@_fini_PROLOG_BEGINS*/
.section .fini
/*@_fini_EPILOG_ENDS*/
/*@TRAILER_BEGINS*/
#NO_APP
.text
.globl dummy
.type dummy, @function
dummy:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
testl %eax, %eax
je .L1
call *%eax
.L1:
popl %ebp
ret
.size dummy, .-dummy
.globl _fini
.type _fini, @function
_fini:
pushl %ebp
movl %esp, %ebp
pushl %ebx
call __i686.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
#APP
ALIGN
END_FINI
/*@_fini_PROLOG_ENDS*/
#NO_APP
call i_am_not_a_leaf2@PLT
#APP
/*@_fini_EPILOG_BEGINS*/
#NO_APP
popl %ebx
popl %ebp
ret
.size _fini, .-_fini
.globl _init
.type _init, @function
_init:
pushl %ebp
movl %esp, %ebp
pushl %ebx
call __i686.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
#APP
/*@_init_PROLOG_PAUSES*/
#NO_APP
call i_am_not_a_leaf@PLT
#APP
/*@_init_PROLOG_UNPAUSES*/
ALIGN
END_INIT
/*@_init_PROLOG_ENDS*/
/*@_init_EPILOG_BEGINS*/
#NO_APP
popl %ebx
popl %ebp
ret
.size _init, .-_init
.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
.globl __i686.get_pc_thunk.bx
.hidden __i686.get_pc_thunk.bx
.type __i686.get_pc_thunk.bx, @function
__i686.get_pc_thunk.bx:
movl (%esp), %ebx
ret
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.4 20031029 (experimental)"
.file "initfini.c"
.section .init
.globl _init
.hidden _init
.type _init, @function
_init:
pushl %ebp
movl %esp, %ebp
pushl %ebx
call __i686.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
.section .fini
.globl _fini
.hidden _fini
.type _fini, @function
_fini:
pushl %ebp
movl %esp, %ebp
pushl %ebx
call __i686.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
.globl __i686.get_pc_thunk.bx
.hidden __i686.get_pc_thunk.bx
.type __i686.get_pc_thunk.bx, @function
__i686.get_pc_thunk.bx:
movl (%esp), %ebx
ret
.ident "GCC: (GNU) 3.4 20031029 (experimental)"
.file "initfini.c"
.section .init
.globl _init
.type _init, @function
popl %ebx
popl %ebp
ret
.size _init, .-_init
.section .fini
.globl _fini
.type _fini, @function
popl %ebx
popl %ebp
ret
.size _fini, .-_fini
.ident "GCC: (GNU) 3.4 20031029 (experimental)"