mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[libj6] Move _init_libc to _init_libj6
As part of the move of jsix-specific code from libc to libj6, all the library initialization is now libj6-specific, so move it all over.
This commit is contained in:
@@ -64,6 +64,7 @@ ccflags = [
|
|||||||
"-mcmodel=large",
|
"-mcmodel=large",
|
||||||
"-D__ELF__",
|
"-D__ELF__",
|
||||||
"-D__JSIX__",
|
"-D__JSIX__",
|
||||||
|
"-D_LIBCPP_HAS_THREAD_API_EXTERNAL",
|
||||||
"-isystem${source_root}/sysroot/include",
|
"-isystem${source_root}/sysroot/include",
|
||||||
"-isystem${source_root}/src/libraries/libc/include",
|
"-isystem${source_root}/src/libraries/libc/include",
|
||||||
"--sysroot='${source_root}/sysroot'"
|
"--sysroot='${source_root}/sysroot'"
|
||||||
@@ -113,6 +114,7 @@ ccflags = [
|
|||||||
"-mcmodel=large",
|
"-mcmodel=large",
|
||||||
"-D__ELF__",
|
"-D__ELF__",
|
||||||
"-D__JSIX__",
|
"-D__JSIX__",
|
||||||
|
"-D_LIBCPP_HAS_THREAD_API_EXTERNAL",
|
||||||
"-isystem${source_root}/sysroot/include",
|
"-isystem${source_root}/sysroot/include",
|
||||||
"-isystem${source_root}/src/libraries/libc/include",
|
"-isystem${source_root}/src/libraries/libc/include",
|
||||||
"--sysroot='${source_root}/sysroot'"
|
"--sysroot='${source_root}/sysroot'"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ static struct j6_init_value *__initv = 0;
|
|||||||
j6_handle_t __handle_sys = j6_handle_invalid;
|
j6_handle_t __handle_sys = j6_handle_invalid;
|
||||||
j6_handle_t __handle_self = j6_handle_invalid;
|
j6_handle_t __handle_self = j6_handle_invalid;
|
||||||
|
|
||||||
void
|
extern "C" void
|
||||||
_get_init(size_t *initc, struct j6_init_value **initv)
|
_get_init(size_t *initc, struct j6_init_value **initv)
|
||||||
{
|
{
|
||||||
if (!initc)
|
if (!initc)
|
||||||
@@ -19,8 +19,8 @@ _get_init(size_t *initc, struct j6_init_value **initv)
|
|||||||
*initv = __initv;
|
*initv = __initv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
extern "C" void
|
||||||
_init_libc(uint64_t *rsp)
|
_init_libj6(uint64_t *rsp)
|
||||||
{
|
{
|
||||||
uint64_t argc = *rsp++;
|
uint64_t argc = *rsp++;
|
||||||
rsp += argc;
|
rsp += argc;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name = "j6"
|
name = "j6"
|
||||||
kind = "lib"
|
kind = "lib"
|
||||||
includes = ["src/libraries/j6/include"]
|
includes = ["src/libraries/j6/include"]
|
||||||
sources = ["syscalls.s"]
|
sources = ["init.cpp", "syscalls.s"]
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
extern main
|
extern main
|
||||||
extern exit
|
extern exit
|
||||||
extern _init_libc
|
extern _init_libj6
|
||||||
|
|
||||||
global _start:function (_start.end - _start)
|
global _start:function (_start.end - _start)
|
||||||
_start:
|
_start:
|
||||||
mov rbp, rsp
|
mov rbp, rsp
|
||||||
mov rdi, rsp
|
mov rdi, rsp
|
||||||
|
call _init_libj6
|
||||||
call _init_libc
|
|
||||||
|
|
||||||
pop rdi
|
pop rdi
|
||||||
mov rsi, rsp
|
mov rsi, rsp
|
||||||
|
|
||||||
call main
|
call main
|
||||||
|
|
||||||
mov rdi, rax
|
mov rdi, rax
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ deps = ["j6"]
|
|||||||
sources = [
|
sources = [
|
||||||
"arch/x86_64/_Exit.s",
|
"arch/x86_64/_Exit.s",
|
||||||
"arch/x86_64/crt0.s",
|
"arch/x86_64/crt0.s",
|
||||||
"arch/x86_64/init_libc.c",
|
|
||||||
"ctype/isalnum.c",
|
"ctype/isalnum.c",
|
||||||
"ctype/isalpha.c",
|
"ctype/isalpha.c",
|
||||||
"ctype/isblank.c",
|
"ctype/isblank.c",
|
||||||
|
|||||||
Reference in New Issue
Block a user