diff options
Diffstat (limited to 'lib/mlibc/tests/rtdl/scope2')
-rw-r--r-- | lib/mlibc/tests/rtdl/scope2/libbar.c | 5 | ||||
-rw-r--r-- | lib/mlibc/tests/rtdl/scope2/libbaz.c | 3 | ||||
-rw-r--r-- | lib/mlibc/tests/rtdl/scope2/libfoo.c | 3 | ||||
-rw-r--r-- | lib/mlibc/tests/rtdl/scope2/meson.build | 9 | ||||
-rw-r--r-- | lib/mlibc/tests/rtdl/scope2/test.c | 36 |
5 files changed, 0 insertions, 56 deletions
diff --git a/lib/mlibc/tests/rtdl/scope2/libbar.c b/lib/mlibc/tests/rtdl/scope2/libbar.c deleted file mode 100644 index 4783c58..0000000 --- a/lib/mlibc/tests/rtdl/scope2/libbar.c +++ /dev/null @@ -1,5 +0,0 @@ -char *foo_baz_conflict(void); - -char *bar_calls_foo_baz_conflict() { - return foo_baz_conflict(); -} diff --git a/lib/mlibc/tests/rtdl/scope2/libbaz.c b/lib/mlibc/tests/rtdl/scope2/libbaz.c deleted file mode 100644 index fc73adc..0000000 --- a/lib/mlibc/tests/rtdl/scope2/libbaz.c +++ /dev/null @@ -1,3 +0,0 @@ -char *foo_baz_conflict() { - return "resolved to baz"; -} diff --git a/lib/mlibc/tests/rtdl/scope2/libfoo.c b/lib/mlibc/tests/rtdl/scope2/libfoo.c deleted file mode 100644 index 9f7b881..0000000 --- a/lib/mlibc/tests/rtdl/scope2/libfoo.c +++ /dev/null @@ -1,3 +0,0 @@ -char *foo_baz_conflict() { - return "resolved to foo"; -} diff --git a/lib/mlibc/tests/rtdl/scope2/meson.build b/lib/mlibc/tests/rtdl/scope2/meson.build deleted file mode 100644 index 938272c..0000000 --- a/lib/mlibc/tests/rtdl/scope2/meson.build +++ /dev/null @@ -1,9 +0,0 @@ -libfoo = shared_library('foo', 'libfoo.c') -libbar = shared_library('bar', 'libbar.c', build_rpath: test_rpath, link_with: libfoo) -libbaz = shared_library('baz', 'libbaz.c') -test_depends = [libfoo, libbar, libbaz] - -libfoo_native = shared_library('native-foo', 'libfoo.c', native: true) -libbar_native = shared_library('native-bar', 'libbar.c', build_rpath: test_rpath, link_with: libfoo_native, native: true) -libbaz_native = shared_library('native-baz', 'libbaz.c', native: true) -test_native_depends = [libfoo_native, libbar_native, libbaz_native] diff --git a/lib/mlibc/tests/rtdl/scope2/test.c b/lib/mlibc/tests/rtdl/scope2/test.c deleted file mode 100644 index f4f42dc..0000000 --- a/lib/mlibc/tests/rtdl/scope2/test.c +++ /dev/null @@ -1,36 +0,0 @@ -#include <stddef.h> -#include <dlfcn.h> -#include <assert.h> -#include <string.h> -#include <stdio.h> - -#ifdef USE_HOST_LIBC -#define LIBBAR "libnative-bar.so" -#define LIBBAZ "libnative-baz.so" -#else -#define LIBBAR "libbar.so" -#define LIBBAZ "libbaz.so" -#endif - -typedef char *strfn(void); - -int main() { - void *baz = dlopen(LIBBAZ, RTLD_LAZY | RTLD_GLOBAL); - assert(baz); - - // At this point, baz is loaded in the global scope. When we load bar locally, - // there is a relocation to `foo_baz_conflict` which is defined in both - // foo (which is a dependency of bar), and baz. In this case baz should win - // since we search the global scope first. - - void *bar = dlopen(LIBBAR, RTLD_LAZY | RTLD_LOCAL); - assert(bar); - - strfn *bfn = dlsym(bar, "bar_calls_foo_baz_conflict"); - assert(!strcmp(bfn(), "resolved to baz")); - - // TODO: Test RTLD_DEEPBIND and DT_SYMBOLIC once we implement it. - - dlclose(bar); - dlclose(baz); -} |