-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rtdl: Add support for LD_LIBRARY_PATH
- Loading branch information
Showing
6 changed files
with
81 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
void foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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.build_root() / 'tests' / 'rtdl' / 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', | ||
link_with: libc, include_directories: libc_include_dirs, | ||
link_args: test_additional_link_args, | ||
) | ||
|
||
libfoo_native = shared_library('native-foo', 'libfoo.c', | ||
link_args: ['-ldl'] + test_additional_link_args, | ||
native: true | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters