Link every executable binary with crt{i,n}.o
This commit is contained in:
parent
d5d96defdd
commit
26c8bb115c
7
src/kernel/crti.S
Normal file
7
src/kernel/crti.S
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* $Id$ */
|
||||||
|
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
|
||||||
|
/* This file is part of DeforaOS uKernel */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "common/crti.S"
|
7
src/kernel/crtn.S
Normal file
7
src/kernel/crtn.S
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* $Id$ */
|
||||||
|
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
|
||||||
|
/* This file is part of DeforaOS uKernel */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "common/crtn.S"
|
|
@ -18,11 +18,11 @@ command=cp -f -- `$(CC) -print-file-name=crtend.o` $(OBJDIR)crtend.o
|
||||||
|
|
||||||
[crti.o]
|
[crti.o]
|
||||||
type=object
|
type=object
|
||||||
sources=../common/crti.S
|
sources=crti.S
|
||||||
|
|
||||||
[crtn.o]
|
[crtn.o]
|
||||||
type=object
|
type=object
|
||||||
sources=../common/crtn.S
|
sources=crtn.S
|
||||||
|
|
||||||
[uKernel.bin]
|
[uKernel.bin]
|
||||||
type=binary
|
type=binary
|
||||||
|
@ -34,11 +34,11 @@ depends=$(OBJDIR)crtbegin.o,$(OBJDIR)crtend.o,$(OBJDIR)crti.o,$(OBJDIR)crtn.o,$(
|
||||||
[arch.S]
|
[arch.S]
|
||||||
depends=../arch/i386/ioport.S
|
depends=../arch/i386/ioport.S
|
||||||
|
|
||||||
[../common/crti.S]
|
[crti.S]
|
||||||
depends=../arch/amd64/crti.S,../arch/i386/crti.S
|
depends=../common/crti.S,../arch/amd64/crti.S,../arch/i386/crti.S
|
||||||
|
|
||||||
[../common/crtn.S]
|
[crtn.S]
|
||||||
depends=../arch/amd64/crtn.S,../arch/i386/crtn.S
|
depends=../common/crtn.S,../arch/amd64/crtn.S,../arch/i386/crtn.S
|
||||||
|
|
||||||
[multiboot.c]
|
[multiboot.c]
|
||||||
depends=../loader/multiboot.c,../drivers/boot/multiboot.h
|
depends=../loader/multiboot.c,../drivers/boot/multiboot.h
|
||||||
|
|
7
src/loader/crti.S
Normal file
7
src/loader/crti.S
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* $Id$ */
|
||||||
|
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
|
||||||
|
/* This file is part of DeforaOS uKernel */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "common/crti.S"
|
7
src/loader/crtn.S
Normal file
7
src/loader/crtn.S
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* $Id$ */
|
||||||
|
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
|
||||||
|
/* This file is part of DeforaOS uKernel */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "common/crtn.S"
|
|
@ -18,11 +18,11 @@ command=cp -f -- `$(CC) -m32 -print-file-name=crtend.o` $(OBJDIR)crtend.o
|
||||||
|
|
||||||
[crti.o]
|
[crti.o]
|
||||||
type=object
|
type=object
|
||||||
sources=../common/crti.S
|
sources=crti.S
|
||||||
|
|
||||||
[crtn.o]
|
[crtn.o]
|
||||||
type=object
|
type=object
|
||||||
sources=../common/crtn.S
|
sources=crtn.S
|
||||||
|
|
||||||
[libuLoader]
|
[libuLoader]
|
||||||
type=library
|
type=library
|
||||||
|
@ -31,19 +31,13 @@ sources=boot/multiboot.c,bus.c,bus/cmos.c,bus/ioport.c,bus/vga.c,console.c,conso
|
||||||
[uLoader.bin]
|
[uLoader.bin]
|
||||||
type=binary
|
type=binary
|
||||||
sources=arch.S,gdt.c,main.c,multiboot.c,start.S
|
sources=arch.S,gdt.c,main.c,multiboot.c,start.S
|
||||||
ldflags=$(OBJDIR)crti.o $(OBJDIR)crtbegin.o $(OBJDIR)crtend.o $(OBJDIR)crtn.o $(OBJDIR)libuLoader.a `$(CC) -print-libgcc-file-name`
|
ldflags=$(OBJDIR)crti.o $(OBJDIR)crtbegin.o $(OBJDIR)libuLoader.a $(OBJDIR)crtend.o $(OBJDIR)crtn.o `$(CC) -print-libgcc-file-name`
|
||||||
depends=$(OBJDIR)crtbegin.o,$(OBJDIR)crtend.o,$(OBJDIR)crti.o,$(OBJDIR)crtn.o,$(OBJDIR)libuLoader.a,../arch/amd64/uKernel.ld,../arch/i386/uKernel.ld
|
depends=$(OBJDIR)crtbegin.o,$(OBJDIR)crtend.o,$(OBJDIR)crti.o,$(OBJDIR)crtn.o,$(OBJDIR)libuLoader.a,../arch/amd64/uKernel.ld,../arch/i386/uKernel.ld
|
||||||
|
|
||||||
#sources
|
#sources
|
||||||
[arch.S]
|
[arch.S]
|
||||||
depends=../arch/i386/ioport.S
|
depends=../arch/i386/ioport.S
|
||||||
|
|
||||||
[../common/crti.S]
|
|
||||||
depends=../arch/amd64/crti.S,../arch/i386/crti.S
|
|
||||||
|
|
||||||
[../common/crtn.S]
|
|
||||||
depends=../arch/amd64/crtn.S,../arch/i386/crtn.S
|
|
||||||
|
|
||||||
[bus.c]
|
[bus.c]
|
||||||
depends=../drivers/bus.c
|
depends=../drivers/bus.c
|
||||||
|
|
||||||
|
@ -59,6 +53,12 @@ depends=../drivers/console.c
|
||||||
[console/uart.c]
|
[console/uart.c]
|
||||||
depends=../drivers/console/uart.c
|
depends=../drivers/console/uart.c
|
||||||
|
|
||||||
|
[crti.S]
|
||||||
|
depends=../common/crti.S,../arch/amd64/crti.S,../arch/i386/crti.S
|
||||||
|
|
||||||
|
[crtn.S]
|
||||||
|
depends=../common/crtn.S,../arch/amd64/crtn.S,../arch/i386/crtn.S
|
||||||
|
|
||||||
[display.c]
|
[display.c]
|
||||||
depends=../drivers/display.c
|
depends=../drivers/display.c
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,9 @@ _start:
|
||||||
/* call the global constructors */
|
/* call the global constructors */
|
||||||
call _init
|
call _init
|
||||||
|
|
||||||
|
/* initialize the userland */
|
||||||
|
call init
|
||||||
|
|
||||||
/* run the userland kernel */
|
/* run the userland kernel */
|
||||||
call main
|
call main
|
||||||
#if defined(__ELF__)
|
#if defined(__ELF__)
|
||||||
|
@ -110,10 +113,14 @@ _start:
|
||||||
#else
|
#else
|
||||||
add $0xc, %esp
|
add $0xc, %esp
|
||||||
#endif
|
#endif
|
||||||
|
push %eax
|
||||||
|
|
||||||
|
/* call the global destructors */
|
||||||
|
call _fini
|
||||||
|
|
||||||
/* exit the userland kernel */
|
/* exit the userland kernel */
|
||||||
push %eax
|
|
||||||
call exit
|
call exit
|
||||||
|
add $0x4, %esp
|
||||||
|
|
||||||
hlt
|
hlt
|
||||||
|
|
||||||
|
|
7
tools/crti.S
Normal file
7
tools/crti.S
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* $Id$ */
|
||||||
|
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
|
||||||
|
/* This file is part of DeforaOS uKernel */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "common/crti.S"
|
7
tools/crtn.S
Normal file
7
tools/crtn.S
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/* $Id$ */
|
||||||
|
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
|
||||||
|
/* This file is part of DeforaOS uKernel */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "common/crtn.S"
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
int _init(void)
|
int init(void)
|
||||||
{
|
{
|
||||||
ukBus * bus;
|
ukBus * bus;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
targets=crtbegin.o,crtend.o,start.o,uKernel
|
targets=crtbegin.o,crtend.o,crti.o,crtn.o,start.o,uKernel
|
||||||
cppflags_force=-nostdinc -isystem ../include -I../src
|
cppflags_force=-nostdinc -isystem ../include -I../src
|
||||||
cflags_force=`../tools/platform.sh -V NATIVE_CFLAGS -C "$$ARCH"`
|
cflags_force=`../tools/platform.sh -V NATIVE_CFLAGS -C "$$ARCH"`
|
||||||
cflags=-W -Wall -g -O2
|
cflags=-W -Wall -g -O2
|
||||||
|
@ -16,6 +16,14 @@ command=cp -f -- `$(CC) -print-file-name=crtbegin.o` $(OBJDIR)crtbegin.o
|
||||||
type=command
|
type=command
|
||||||
command=cp -f -- `$(CC) -print-file-name=crtend.o` $(OBJDIR)crtend.o
|
command=cp -f -- `$(CC) -print-file-name=crtend.o` $(OBJDIR)crtend.o
|
||||||
|
|
||||||
|
[crti.o]
|
||||||
|
type=object
|
||||||
|
sources=crti.S
|
||||||
|
|
||||||
|
[crtn.o]
|
||||||
|
type=object
|
||||||
|
sources=crtn.S
|
||||||
|
|
||||||
[start.o]
|
[start.o]
|
||||||
type=object
|
type=object
|
||||||
sources=start.S
|
sources=start.S
|
||||||
|
@ -23,7 +31,7 @@ sources=start.S
|
||||||
[uKernel]
|
[uKernel]
|
||||||
type=binary
|
type=binary
|
||||||
sources=bus.c,clock.c,console.c,init.c,main.c
|
sources=bus.c,clock.c,console.c,init.c,main.c
|
||||||
ldflags=$(OBJDIR)crtbegin.o $(OBJDIR)crtend.o $(OBJDIR)start.o $(OBJDIR)../src/lib/libuKernel.a $(OBJDIR)../src/drivers/clock/sys.o $(OBJDIR)../src/drivers/console/stdio.o `$(CC) -print-libgcc-file-name`
|
ldflags=$(OBJDIR)crti.o $(OBJDIR)crtbegin.o $(OBJDIR)start.o $(OBJDIR)../src/lib/libuKernel.a $(OBJDIR)../src/drivers/clock/sys.o $(OBJDIR)../src/drivers/console/stdio.o $(OBJDIR)crtend.o $(OBJDIR)crtn.o `$(CC) -print-libgcc-file-name`
|
||||||
depends=$(OBJDIR)crtbegin.o,$(OBJDIR)crtend.o,$(OBJDIR)start.o,$(OBJDIR)../src/lib/libuKernel.a,$(OBJDIR)../src/drivers/clock/sys.o,$(OBJDIR)../src/drivers/console/stdio.o
|
depends=$(OBJDIR)crtbegin.o,$(OBJDIR)crtend.o,$(OBJDIR)start.o,$(OBJDIR)../src/lib/libuKernel.a,$(OBJDIR)../src/drivers/clock/sys.o,$(OBJDIR)../src/drivers/console/stdio.o
|
||||||
|
|
||||||
#sources
|
#sources
|
||||||
|
@ -33,6 +41,12 @@ depends=../src/drivers/bus.c,../src/drivers/bus/tty.c
|
||||||
[console.c]
|
[console.c]
|
||||||
depends=../src/drivers/console.h
|
depends=../src/drivers/console.h
|
||||||
|
|
||||||
|
[crti.S]
|
||||||
|
depends=../src/common/crti.S,../src/arch/amd64/crti.S,../src/arch/i386/crti.S
|
||||||
|
|
||||||
|
[crtn.S]
|
||||||
|
depends=../src/common/crtn.S,../src/arch/amd64/crtn.S,../src/arch/i386/crtn.S
|
||||||
|
|
||||||
[main.c]
|
[main.c]
|
||||||
depends=../src/kernel/main.c
|
depends=../src/kernel/main.c
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user