This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [Patch] ldd failures on multilb architectures
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Hannes Reinecke <hare at suse dot de>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Fri, 14 Nov 2003 09:08:22 +0100
- Subject: Re: [Patch] ldd failures on multilb architectures
- References: <3FB4A4F0.2060307@suse.de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Nov 14, 2003 at 10:48:32AM +0100, Hannes Reinecke wrote:
> Hi all,
>
> /usr/bin/ldd has some slight problems with multilib architectures.
> First, it tries to execute all eligible 'ld.so', but does not redirect
> the output to /dev/null, so we always get the nasty 'Cannot execute
> binary file' error message.
Who issues this error message? Works just fine for me in current CVS
(and several months old glibc too).
Say on s390x (looking at your signature):
echo 'int main () { return 0; }' > test.c
for i in -m31 -m64; do for j in "" -static; do gcc $i $j -o test test.c; ldd ./test; echo $?; done; done
libc.so.6 => /lib/libc.so.6 (0x4002d000)
/lib/ld.so.1 => /lib/ld.so.1 (0x40000000)
0
not a dynamic executable
1
libc.so.6 => /lib64/tls/libc.so.6 (0x0000010000031000)
/lib64/ld64.so.1 => /lib64/ld64.so.1 (0x0000010000000000)
0
not a dynamic executable
1
which is the expected output.
> Second, 'ld.so' might return 1 in case it found a statically linked
> binary. Since ldd only checks for return codes 0 or 2, it fails horribly.
And this second change is clearly broken.
ld.so will exit with 1 if any error happens, e.g. incompatible object
or statically linked object. If you break for 1, you just killed multi-lib
ldd.
> --- elf/ldd.bash.in
> +++ elf/ldd.bash.in
> @@ -127,10 +127,10 @@
> RTLD=
> for rtld in ${RTLDLIST}; do
> if test -x $rtld; then
> - verify_out=`${rtld} --verify "$file"`
> + verify_out=`${rtld} --verify "$file" > /dev/null 2>&1`
> ret=$?
> case $ret in
> - [02]) RTLD=${rtld}; break;;
> + [012]) RTLD=${rtld}; break;;
> esac
> fi
> done
Jakub