lib: c: implement runtime initialisation
This commit is contained in:
@@ -8,13 +8,17 @@ foreach (dir ${source_dirs})
|
||||
set(headers ${headers} ${dir_headers})
|
||||
endforeach (dir)
|
||||
|
||||
set(component_sources ${sources} PARENT_SCOPE)
|
||||
file(GLOB sys_sources
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sys/${CMAKE_SYSTEM_PROCESSOR}/*.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sys/${CMAKE_SYSTEM_PROCESSOR}/*.S)
|
||||
|
||||
set(component_sources ${sources} ${sys_sources} PARENT_SCOPE)
|
||||
set(component_headers ${headers} PARENT_SCOPE)
|
||||
|
||||
rosetta_add_library(STATIC
|
||||
NAME libc-core
|
||||
PUBLIC_INCLUDE_DIRS ${public_include_dirs}
|
||||
SOURCES ${sources}
|
||||
SOURCES ${sources} ${sys_sources}
|
||||
HEADERS ${headers})
|
||||
|
||||
sysroot_add_library(
|
||||
|
||||
18
lib/libc/core/sys/x86_64/init.c
Normal file
18
lib/libc/core/sys/x86_64/init.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <mango/log.h>
|
||||
#include <rosetta/bootstrap.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern int main(int, const char **, const char **);
|
||||
|
||||
void *__attribute__((weak)) pthread_self(void)
|
||||
{
|
||||
/* Nothing */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int __libc_init(const struct rosetta_bootstrap *bsinfo)
|
||||
{
|
||||
(volatile void)pthread_self();
|
||||
kern_logf("bsinfo = %p", bsinfo);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user