user: implement mlibc as the libc, finally.

It's finally done..

Signed-off-by: kaguya <vpshinomiya@protonmail.com>
This commit is contained in:
kaguya
2026-05-02 03:31:49 -04:00
parent 2fa39ad85a
commit 9a9b91c940
2387 changed files with 152741 additions and 315 deletions
@@ -0,0 +1 @@
void foo() {}
@@ -0,0 +1,22 @@
# Remove the RPATH and set the LD_LIBRARY_PATH environment variable
# instead when running tests to make sure the library can be found
# in a directory specified by the user at runtime
test_rpath = '$ORIGIN/'
test_ld_path = meson.global_build_root() / 'tests' / 'rtld' / test_name
test_env += ['LD_LIBRARY_PATH=' + test_ld_path]
test_native_env += ['LD_LIBRARY_PATH=' + test_ld_path]
libfoo = shared_library('foo', 'libfoo.c',
dependencies: libc_dep,
link_args: test_additional_link_args,
)
test_depends = [libfoo]
libfoo_native = shared_library('native-foo', 'libfoo.c',
link_args: ['-ldl'] + test_additional_link_args,
native: true
)
test_native_depends = [libfoo_native]
@@ -0,0 +1,18 @@
#include <dlfcn.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#ifdef USE_HOST_LIBC
#define LIBFOO "libnative-foo.so"
#else
#define LIBFOO "libfoo.so"
#endif
int main() {
void *foo = dlopen(LIBFOO, RTLD_NOW);
assert(foo);
dlclose(foo);
return 0;
}