Browse Source

libc: crt's to GNU as

K. Lange 4 years ago
parent
commit
3fc0ccef4f
7 changed files with 27 additions and 55 deletions
  1. 4 4
      Makefile
  2. 7 0
      libc/crt0.S
  3. 0 15
      libc/crt0.s
  4. 9 0
      libc/crti.S
  5. 0 19
      libc/crti.s
  6. 7 0
      libc/crtn.S
  7. 0 17
      libc/crtn.s

+ 4 - 4
Makefile

@@ -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 - 0
libc/crt0.S

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

+ 0 - 15
libc/crt0.s

@@ -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 - 0
libc/crti.S

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

+ 0 - 19
libc/crti.s

@@ -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 - 0
libc/crtn.S

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

+ 0 - 17
libc/crtn.s

@@ -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