1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

Demos: Add "DynamicObjectDemo" to demo the dynamic loader

This commit is contained in:
Itamar 2020-10-10 18:26:16 +03:00 committed by Andreas Kling
parent 79769ee74e
commit 09ccdc697b
7 changed files with 101 additions and 1 deletions

View file

@ -1,7 +1,7 @@
set(LIBC_SOURCES
arpa/inet.cpp
assert.cpp
crt0.cpp
#crt0.cpp
ctype.cpp
cxxabi.cpp
dirent.cpp
@ -69,3 +69,6 @@ set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES})
serenity_libc(LibC c)
target_link_libraries(LibC crt0)
add_dependencies(LibC LibM)
add_library(LibCShared SHARED ${SOURCES})
install(TARGETS LibCShared DESTINATION usr/lib)

View file

@ -0,0 +1,30 @@
#include <AK/Types.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/internals.h>
#include <unistd.h>
extern "C" {
int main(int, char**, char**);
extern void __libc_init();
extern void _init();
extern char** environ;
extern bool __environ_is_malloced;
int _start(int argc, char** argv, char** env);
int _start(int argc, char** argv, char** env)
{
// asm("int3");
environ = env;
__environ_is_malloced = false;
__libc_init();
_init();
int status = main(argc, argv, environ);
return status;
}
}