Re: Bug#265620: diverts dh_strip with version that is not up-to-date, and is in violation of my copyright
-----BEGIN PGP SIGNED MESSAGE-----
> It is a nice solution, a bit complicated though. Wouldn't it be better
> to use the cross-prefix in your script/diversion. This way you don't
> have to look for the correct one. The diversion has to detect if it is
> cross-building or not and acts accordingly. So if it is not
> cross-compiled it just uses strip, if dpkg-cross is used it uses
> 'cross-prefix'-strip. It is just a simpler idea which might save you a
> lot of "correct" strip detection stuff.
strip may be called (at least in theory) both for native and target
binaries. E.g. if someone builds a tool for use in the build process, and
links is with 'gcc -s'.
I'm having bad times with autodetection. Looks that without
binutils-multiarch it is even not easy to get enough information about ELF
file. Both 'file' and 'readelf' may give some information, but I still
can't find an easy way to restore debian arch binary was compiled for.
It is easy to get CPU arch and endian, but I can't find a way to
distinguish between different OSes (e.g. x86-linux and x86-hurd shared
libraries). So a clean procedure that will look at binary and restore
appropriate crossprefix can't be implemented :(.
Anyway, I still don't want to give up with autodetection.
As far as I understand, OS doesn't really matter for ELF format, and strip
and objdump that have support for a cpu arch, will work regtardless of OS
binary was built for.
So the tool will be chosen using only arch name (x86, mips, mipsel, ...).
For any arch and for each arch tool pathname will be read
from /etc/dpkg/crosstools or ~/.dpkg/crosstools. If no information is
there, I'll have a list of crossprefix'es for each arch to try (and
$crossprefix will be used as default selection in this list if it exists
there); /usr/bin/strip and /usr/bin/objdump will be used if nothing better
Suggested crosstools file syntax allows tool selection based on dpkg-cross
# <arch> <tool> <mode> <pathname>
arm strip default /usr/bin/arm-linux-strip
arm objdump default /usr/bin/arm-linux-objdump
arm strip HardHat /usr/loca/hardhat/bin/arm-linux-strip
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
-----END PGP SIGNATURE-----