LibC: Dummy ctr* files for i386
This allows compilation of libc for i386 targets
This commit is contained in:
parent
65750586b6
commit
7d1b7436d4
|
@ -0,0 +1,33 @@
|
|||
.section .text
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
# zero out stack frame
|
||||
pushl $0
|
||||
pushl $0
|
||||
movl %esp, %ebp
|
||||
|
||||
# FIXME: handle stack alignment
|
||||
ud2
|
||||
|
||||
# push argc, argv, environ for call to main
|
||||
pushl %edx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
# initialize libc
|
||||
pushl %edx
|
||||
call _init_libc
|
||||
addl $4, %esp
|
||||
|
||||
# call global constructos
|
||||
call _init
|
||||
|
||||
# call main, arguments are already on stack
|
||||
call main
|
||||
|
||||
# cleanly exit the process
|
||||
pushl %eax
|
||||
call exit
|
||||
|
||||
.size _start, . - _start
|
|
@ -0,0 +1,16 @@
|
|||
/* i386 crti.s */
|
||||
.section .init
|
||||
.global _init
|
||||
.type _init, @function
|
||||
_init:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
/* gcc will nicely put the contents of crtbegin.o's .init section here. */
|
||||
|
||||
.section .fini
|
||||
.global _fini
|
||||
.type _fini, @function
|
||||
_fini:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
/* gcc will nicely put the contents of crtbegin.o's .fini section here. */
|
|
@ -0,0 +1,10 @@
|
|||
/* i386 crtn.s */
|
||||
.section .init
|
||||
/* gcc will nicely put the contents of crtend.o's .init section here. */
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
.section .fini
|
||||
/* gcc will nicely put the contents of crtend.o's .fini section here. */
|
||||
popl %ebp
|
||||
ret
|
Loading…
Reference in New Issue