This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] ld.so: command argument "--preload"
- From: David Newall <glibc at davidnewall dot com>
- To: Carlos O'Donell <carlos at redhat dot com>, Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 6 Nov 2018 16:28:50 +1030
- Subject: Re: [PATCH] ld.so: command argument "--preload"
- References: <322fb70a-9c0e-100b-4366-dfa7e5134aa5@davidnewall.com> <265bec63-9875-7268-2199-c7e133b2298e@davidnewall.com> <874ldb7gxp.fsf@oldenburg.str.redhat.com> <5f79f366-d687-583f-940c-36c169bd34a9@davidnewall.com> <cfd15aee-c960-0599-b053-d36ce40c9707@redhat.com>
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