runtime_loader: fix failures in the test suite.

* use --no-as-needed on Linux as the default changed some time ago.
* adjust LD_LIBRARY_PATH/LIBRARY_PATH to load in the current directory.
* fix some builds of program with compile_lib.

Only dlopen_lookup_next1 fails on Ubuntu 18.04.02 x86_64.

Change-Id: I6ecf70f742f67ab24d7d00fa615baa209634d02c
Reviewed-on: https://review.haiku-os.org/c/1140
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jérôme Duval
2019-03-03 17:39:45 +00:00
committed by waddlesplash
parent 17dc34acd6
commit 2e1e3f0d75
4 changed files with 11 additions and 5 deletions
@@ -70,7 +70,7 @@ main()
EOI
# build
compile_lib_dl -o program program.c
compile_program_dl -o program program.c
# run
test_run_ok ./program 1
@@ -80,7 +80,7 @@ main()
EOI
# build
compile_lib_dl -o program program.c
compile_program_dl -o program program.c
# run
test_run_ok ./program 2
@@ -87,7 +87,7 @@ main()
EOI
# build
compile_lib_dl -o program program.c
compile_program_dl -o program program.c
# run
test_run_ok ./program 2
@@ -22,6 +22,12 @@ test_run_ok()
exit 1
fi
case $os in
FreeBSD|Linux) export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH;;
Haiku) export LIBRARY_PATH=.:$LIBRARY_PATH;;
*) echo "Unsupported OS: $os"; exit 1;;
esac
# run
$1
retval=$?
@@ -33,7 +39,7 @@ test_run_ok()
compile_lib()
{
gcc -shared $@ -D_GNU_SOURCE -fPIC
gcc -shared -Wl,--no-as-needed -D_GNU_SOURCE -fPIC $@
}
compile_lib_dl()
@@ -43,7 +49,7 @@ compile_lib_dl()
compile_program()
{
gcc $@ -D_GNU_SOURCE -Wl,-rpath,.,--export-dynamic
gcc -Wl,--no-as-needed $@ -D_GNU_SOURCE -Wl,-rpath,.,--export-dynamic
}
compile_program_dl()