mirror of
https://github.com/hmaxnl/based.git
synced 2025-01-18 09:24:20 +01:00
refactor(shared): Library order changed
Changed library linking order: cli (executable) <= runtime(static) <= based (shared)
This commit is contained in:
parent
a60a14b6b6
commit
d49e725846
|
@ -1,3 +1,6 @@
|
|||
# Public include
|
||||
|
||||
target_sources(based PUBLIC
|
||||
"base.h")
|
||||
|
||||
add_subdirectory(based)
|
|
@ -8,8 +8,9 @@
|
|||
|
||||
#ifndef BASE_H
|
||||
#define BASE_H
|
||||
#include "env/envb.h"
|
||||
|
||||
#include "based/env/envb.h"
|
||||
extern int main(int argc, char** argv, char** envp);
|
||||
extern int rt_initialize_lib();
|
||||
// ========================================
|
||||
// Definitions
|
||||
// ========================================
|
|
@ -1,2 +1,3 @@
|
|||
# Public based include
|
||||
|
||||
add_subdirectory(env)
|
4
include/based/env/CMakeLists.txt
vendored
Executable file
4
include/based/env/CMakeLists.txt
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
# based => include => env
|
||||
|
||||
target_sources(based PUBLIC
|
||||
"envb.h")
|
|
@ -3,7 +3,7 @@
|
|||
add_library(based SHARED "base.c")
|
||||
|
||||
target_compile_features(based PRIVATE c_std_99)
|
||||
target_link_libraries(based PUBLIC runtime)
|
||||
#target_link_libraries(based PUBLIC runtime)
|
||||
|
||||
target_include_directories(based
|
||||
PUBLIC
|
||||
|
@ -13,5 +13,6 @@ target_include_directories(based
|
|||
${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
|
||||
add_subdirectory(include)
|
||||
#add_subdirectory(include)
|
||||
#add_subdirectory(rt)
|
||||
add_subdirectory(system)
|
|
@ -6,3 +6,10 @@ EXPORT int test()
|
|||
return 69;
|
||||
}
|
||||
|
||||
EXPORT int rt_initialize_lib()
|
||||
{
|
||||
// Setup
|
||||
int result = main(0, NULL, NULL);
|
||||
// Exiting
|
||||
return result;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# based => include
|
||||
|
||||
target_sources(based PUBLIC
|
||||
"base.h")
|
||||
#target_sources(based PUBLIC
|
||||
# "base.h")
|
||||
|
||||
add_subdirectory(env)
|
||||
#add_subdirectory(env)
|
3
src/based/include/env/CMakeLists.txt
vendored
3
src/based/include/env/CMakeLists.txt
vendored
|
@ -1,3 +0,0 @@
|
|||
# based => include => env
|
||||
|
||||
target_sources(based PRIVATE "envb.h")
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
add_executable(bcli "main.c")
|
||||
|
||||
target_link_libraries(bcli PUBLIC based)
|
||||
target_link_libraries(bcli PUBLIC runtime)
|
|
@ -4,7 +4,7 @@ add_library(runtime STATIC
|
|||
"rtinternal.h"
|
||||
"runtime.c")
|
||||
|
||||
#target_link_libraries(runtime PUBLIC based)
|
||||
target_link_libraries(runtime PUBLIC based)
|
||||
|
||||
target_include_directories(runtime
|
||||
PUBLIC
|
||||
|
|
|
@ -13,7 +13,7 @@ _start:
|
|||
lea 0x8(%rsp), %rsi // Get the argv address
|
||||
lea 16(%rsp,%rdi,8), %rdx // Get the envp address
|
||||
|
||||
//call rt_unix_start // Start c function
|
||||
call rt_unix_start // Start c function
|
||||
// Use exit_group syscall
|
||||
movq $231, %rax
|
||||
movq $0, %rdi
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//#include "base.h"
|
||||
#include "base.h"
|
||||
|
||||
void rt_unix_start(int argc, char** argv, char** envp)
|
||||
{
|
||||
//TODO: Callback => main & syscall to exit group
|
||||
int init_result = rt_initialize_lib();
|
||||
// unix exit
|
||||
}
|
Loading…
Reference in New Issue
Block a user