Subject: COMPAT_LINUX: matching LinuxPPC binaries
To: Jarommr Dolecek <dolecek@ics.muni.cz>
From: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
List: tech-kern
Date: 01/01/2001 23:56:26
Summary of the problem: to bring COMPAT_LINUX to powerpc, we lack a way
of matching statically linked LinuxPPC binaries. For dynamic
executables, no problem: linux_signature finds /lib/ld.so.1 and we are
done. We only have a problem for static executables.

LinuxPPC statically linked executables seems to have no comment, no GCC
signature that could help. Both linux_signature and linux_gcc_signature
fail. Fortunately, it seems that all statically linked executables on
Linux have a __libc_atexit section. I checked it on both powerpc and
i386, and I can't find a statically linked program that doesn't have
this __libc_atexit  section on a Linux system.=20

On the other hand, I was not able to find any statically linked
executable with such a section on NetBSD. Do you think this is
__libc_atexit section is specific enough to be used for recognising
Linux statically linked executables?=20

I wonder if we have a risk to conflict with potential future emulations,
such as AIX/powerpc, OpenBSD/powerpc or MacOS-X/powerpc? If someone have
access to thoses platforms, or any other UNIX running on PowerPC, I'd be
interested to know if this __libc_atexit section is really Linux
specific. The test would just be running something like that:

objdump -h $(file $(echo $PATH|sed 's|:|/* |g')|awk -F: '{if
($0~/statically/) {print $1}}')|grep __libc_atexit=20

And there is also another thing to check: is there really no statically
linked executable without the __libc_atexit on Linux? The test would be
something like this on Linux systems:

for i in $(file $(echo $PATH|sed 's|:|/* |g')|awk -F: '{if
($0~/statically/) {print $1}}') ; do grep __libc_atexit $i || echo $i
"does not contain __libc_atexit" ; done

And a last through: this __libc_atexit section seems to be related to
the GNU libc, and not to Linux, so we could be unable to distinguish a
Hurd executable than a Linux executable, isn't it?

--=20
Emmanuel Dreyfus.
Windows 95, Windows 98, Windows 2000
D=E9sormais, les OS portent la date de peremption dans leurs noms.
p99dreyf@criens.u-psud.fr