This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] ld.so: command argument "--preload"
* David Newall:
> 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)
Please post unified diffs. 8-)
> 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?
Please use the syntax in elf/tst-pathopt.sh, that is, include both
test_wrapper_env and run_program_env in the invocation (unquoted).
Don't forget to verify that the test works even if you configure glibc
with --enable-hardcoded-path-in-tests. If not, we can disable the test
in this case.
Thanks,
Florian