urt: Add user run-time library groundwork
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (c) 2026, Chloe M.
|
||||
# Provided under the BSD-3 clause
|
||||
#
|
||||
# Description: User run-time build script
|
||||
# Author: Chloe M.
|
||||
#
|
||||
|
||||
include ../mk/user.mk
|
||||
|
||||
.PHONY: urt
|
||||
urt: machine
|
||||
|
||||
.PHONY: machine
|
||||
machine:
|
||||
cd arch/$(PT_TARGET_ARCH)/; $(MAKE) $(PASSDOWN_ARGS)
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (c) 2026, Chloe M.
|
||||
# Provided under the BSD-3 clause
|
||||
#
|
||||
# Description: User run-time machdep build script
|
||||
# Author: Chloe M.
|
||||
#
|
||||
|
||||
ASMFILES = $(shell find . -name "*.S")
|
||||
ASMOFILES = $(ASMFILES:.S=.S.o)
|
||||
|
||||
CFLAGS = $(SYS_CFLAGS)
|
||||
|
||||
.PHONY: all
|
||||
all: $(ASMOFILES)
|
||||
|
||||
%.S.o: %.S
|
||||
$(SYS_CC) -c $< $(CFLAGS) -o $@
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Chloe M.
|
||||
* Provided under the BSD-3 clause.
|
||||
*
|
||||
* Description: C-runtime entry
|
||||
* Author: Chloe M.
|
||||
*/
|
||||
|
||||
.text
|
||||
.globl _start
|
||||
_start:
|
||||
xor %rbp, %rbp /* Terminate callstack */
|
||||
call Main /* Enter program main */
|
||||
1: pause
|
||||
jmp 1b
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Chloe M.
|
||||
* Provided under the BSD-3 clause.
|
||||
*
|
||||
* Description: User linker script
|
||||
* Author: Chloe M.
|
||||
*/
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS {
|
||||
/* User programs live here */
|
||||
. = 0x9000;
|
||||
|
||||
.text : {
|
||||
*(.text .text.*)
|
||||
}
|
||||
|
||||
.data : {
|
||||
*(.data .data.*)
|
||||
}
|
||||
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
*(COMMON)
|
||||
}
|
||||
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
}
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame .eh_frame.*)
|
||||
*(.note .note.*)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user