mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
LibC: Add libc.so
We now compile everything with -static flag so libc.a would be use
This commit is contained in:
parent
09ccdc697b
commit
58c583f584
Notes:
sideshowbarker
2024-07-19 00:51:33 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/58c583f584e Pull-request: https://github.com/SerenityOS/serenity/pull/3738 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/awesomekling
@ -135,6 +135,16 @@ function(serenity_libc target_name fs_name)
|
||||
serenity_generated_sources(${target_name})
|
||||
endfunction()
|
||||
|
||||
function(serenity_libc_shared target_name fs_name)
|
||||
serenity_install_headers("")
|
||||
serenity_install_sources("Libraries/LibC")
|
||||
add_library(${target_name} SHARED ${SOURCES})
|
||||
install(TARGETS ${target_name} DESTINATION usr/lib)
|
||||
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
|
||||
target_link_directories(LibC PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||
serenity_generated_sources(${target_name})
|
||||
endfunction()
|
||||
|
||||
function(serenity_bin target_name)
|
||||
add_executable(${target_name} ${SOURCES})
|
||||
install(TARGETS ${target_name} RUNTIME DESTINATION bin)
|
||||
@ -210,6 +220,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -g1 -fno-exceptions -fno-rtti -Wno-a
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffile-prefix-map=${CMAKE_SOURCE_DIR}=.")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG -DSANITIZE_PTRS")
|
||||
set(CMAKE_CXX_FLAGS_WITHOUT_STATIC ${CMAKE_CXX_FLAGS})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
||||
add_link_options(--sysroot ${CMAKE_BINARY_DIR}/Root)
|
||||
|
||||
include_directories(Libraries/LibC)
|
||||
|
@ -3,7 +3,7 @@ set(SOURCES
|
||||
../../Libraries/LibC/crt0_shared.cpp
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostartfiles -pie -fpic")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_WITHOUT_STATIC} -nostartfiles -pie -fpic")
|
||||
|
||||
serenity_bin(DynamicObjectDemo)
|
||||
target_link_libraries(DynamicObjectDemo SampleLib LibCShared)
|
||||
|
@ -3,7 +3,7 @@ set(SOURCES
|
||||
lib.cpp
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib -fpic")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_WIHTOUT_STATIC} -nostdlib -fpic")
|
||||
|
||||
add_library(SampleLib SHARED ${SOURCES})
|
||||
target_link_libraries(SampleLib LibCShared)
|
||||
|
@ -70,5 +70,8 @@ serenity_libc(LibC c)
|
||||
target_link_libraries(LibC crt0)
|
||||
add_dependencies(LibC LibM)
|
||||
|
||||
add_library(LibCShared SHARED ${SOURCES})
|
||||
install(TARGETS LibCShared DESTINATION usr/lib)
|
||||
set(SOURCES ${SOURCES} "crt0_shared.cpp")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib")
|
||||
serenity_libc_shared(LibCShared c)
|
||||
#add_library(LibCShared SHARED ${SOURCES})
|
||||
#install(TARGETS LibCShared DESTINATION usr/lib)
|
||||
|
@ -22,9 +22,11 @@ int _start(int argc, char** argv, char** env)
|
||||
__environ_is_malloced = false;
|
||||
|
||||
__libc_init();
|
||||
_init();
|
||||
// _init();
|
||||
|
||||
int status = main(argc, argv, environ);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
void* __dso_handle = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user