[PATCH] ld.so: command argument "--preload"
David Newall
glibc@davidnewall.com
Tue Nov 6 05:59:00 GMT 2018
On 6/11/18 12:40 pm, Carlos O'Donell wrote:
> On 11/5/18 4:16 AM, David Newall wrote:
>> ... I can't work out how to write a test case ...
> Is elf/tst-rtld-load-self.sh a useful template?
Thank you, yes, that helped. I'll use the existing preloadtest program,
so, for Makefile, something like this seems to work:
289c289,290
< tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out
---
> tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out \
> Â Â Â Â Â Â Â $(objpfx)tst-rtld-preload.out
769a771,777
>
> tst-rtld-preload-OBJS =Â $(subst $(empty) ,:,$(strip $(preloadtest-preloads:=.so)))
> $(objpfx)tst-rtld-preload.out: tst-rtld-preload.sh $(objpfx)ld.so \
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $(objpfx)preloadtest
> Â Â Â $(SHELL) $^ '$(test-wrapper)' '$(test-wrapper-env)' \
> Â Â Â Â Â Â Â Â Â '$(rpath-link)' '$(tst-rtld-preload-OBJS)' > $@; \
> Â Â Â $(evaluate-test)
For the script:
set -e
rtld=$1
test_program=$2
test_wrapper=$3
test_wrapper_env=$4
library_path=$5
preload=$6
echo "# [${test_wrapper}] [$rtld] [--library-path] [$library_path] [--preload] [$preload] [$test_program]"
${test_wrapper} $rtld --library-path $library_path --preload $preload $test_program 2>&1 && rc=0 || rc=$?
echo "# exit status $rc"
exit $rc
Is this reasonable?
David
More information about the Libc-alpha
mailing list