libc: crt's to GNU as

This commit is contained in:
K. Lange 2018-10-13 15:53:16 +09:00
parent 076426f101
commit 3fc0ccef4f
7 changed files with 27 additions and 55 deletions

View File

@ -160,8 +160,8 @@ dirs: base/dev base/tmp base/proc base/bin base/lib base/cdrom fatbase/efi/boot
crts: base/lib/crt0.o base/lib/crti.o base/lib/crtn.o | dirs
base/lib/crt%.o: libc/crt%.s
yasm -f elf -o $@ $<
base/lib/crt%.o: libc/crt%.S
$(AS) -o $@ $<
libc/setjmp.o: libc/setjmp.S
$(AS) -o $@ $<
@ -184,7 +184,7 @@ base/lib/ld.so: linker/linker.c base/lib/libc.a | dirs
$(CC) -static -Wl,-static $(CFLAGS) -o $@ -Os -T linker/link.ld $<
# Shared Libraries
.make/%.lmak: lib/%.c util/auto-dep.py | dirs
.make/%.lmak: lib/%.c util/auto-dep.py | dirs crts
util/auto-dep.py --makelib $< > $@
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
@ -201,7 +201,7 @@ fatbase/netinit: util/netinit.c base/lib/libc.a | dirs
# Userspace applications
.make/%.mak: apps/%.c util/auto-dep.py | dirs
.make/%.mak: apps/%.c util/auto-dep.py | dirs crts
util/auto-dep.py --make $< > $@
ifeq (,$(findstring clean,$(MAKECMDGOALS)))

7
libc/crt0.S Normal file
View File

@ -0,0 +1,7 @@
.global _start
_start:
pop %eax
push $main
call pre_main

View File

@ -1,15 +0,0 @@
; ToAruOS User CRT0
BITS 32
global _start
_start: ; Global entry point
pop eax ; Our stack is slightly off
extern pre_main ;
extern main
push main
call pre_main ; call C main function
; vim:syntax=nasm
; vim:noexpandtab
; vim:tabstop=4
; vim:shiftwidth=4

9
libc/crti.S Normal file
View File

@ -0,0 +1,9 @@
.global _init
.section .init
_init:
push %ebp
.global _fini
.section .fini
_fini:
push %ebp

View File

@ -1,19 +0,0 @@
; ToAruOS User CRT0
BITS 32
section .init
global _init
_init:
push ebp
; .init goes here
section .fini
global _fini
_fini:
push ebp
; .fini goes here
; vim:syntax=nasm
; vim:noexpandtab
; vim:tabstop=4
; vim:shiftwidth=4

7
libc/crtn.S Normal file
View File

@ -0,0 +1,7 @@
.section .init
pop %ebp
ret
.section .fini
pop %ebp
ret

View File

@ -1,17 +0,0 @@
; ToAruOS User CRT0
BITS 32
section .init
; .init goes here
pop ebp
ret
section .fini
; .fini goes here
pop ebp
ret
; vim:syntax=nasm
; vim:noexpandtab
; vim:tabstop=4
; vim:shiftwidth=4