mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:47:34 +00:00
Loader: Add dynamic loader program
The dynamic loader exists as /usr/lib/Loader.so and is loaded by the kernel when ET_DYN programs are executed. The dynamic loader is responsible for loading the dependencies of the main program, allocating TLS storage, preparing all loaded objects for execution and finally jumping to the entry of the main program.
This commit is contained in:
parent
781aa424a9
commit
07b4957361
18 changed files with 962 additions and 104 deletions
22
Userland/DynamicLoader/CMakeLists.txt
Normal file
22
Userland/DynamicLoader/CMakeLists.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
set(LOADER_SOURCES
|
||||
main.cpp
|
||||
math.cpp
|
||||
misc.cpp
|
||||
)
|
||||
|
||||
file(GLOB AK_SOURCES "../../AK/*.cpp")
|
||||
file(GLOB ELF_SOURCES "../../Libraries/LibELF/*.cpp")
|
||||
set(ELF_SOURCES ${ELF_SOURCES} ../../Libraries/LibELF/Arch/i386/plt_trampoline.S)
|
||||
file(GLOB LIBC_SOURCES1 "../../Libraries/LibC/*.cpp")
|
||||
file(GLOB LIBC_SOURCES2 "../../Libraries/LibC/*/*.cpp")
|
||||
file(GLOB LIBC_SOURCES3 "../../Libraries/LibC/*.S")
|
||||
|
||||
list(FILTER LIBC_SOURCES1 EXCLUDE REGEX ".+crt0.cpp")
|
||||
list(FILTER LIBC_SOURCES1 EXCLUDE REGEX ".+crt0.+.cpp")
|
||||
|
||||
set(SOURCES ${LOADER_SOURCES} ${AK_SOURCES} ${ELF_SOURCES} ${LIBC_SOURCES1} ${LIBC_SOURCES2} ${LIBC_SOURCES3})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib -pie -fpic -DNO_TLS")
|
||||
|
||||
add_executable(Loader.so ${SOURCES})
|
||||
install(TARGETS Loader.so RUNTIME DESTINATION usr/lib/)
|
Loading…
Add table
Add a link
Reference in a new issue