Re: [PATCH] x86: Remove a.out support

Maciej W. Rozycki
2022-04-02T22:14:53Z

On Wed, 16 Mar 2022, James Jones wrote:

> Probably getting a bit off topic, but I did spend a few hours searching
> around for any existing tools to convert a binary from a.out->ELF, and
> trying to come up with something myself by extracting the sections with
> objdump and re-combining them into an ELF using a linker script placing
> the sections at the same locations. I couldn't get it working in an
> evening or two messing with it so I moved on, but I agree something like
> this seems possible in theory.

Chiming in late as I'm scanning outstanding mailing list traffic: if this
is as you say all statically linked stuff, then converting from a.out to
ELF might be as easy as:

$ objcopy -I a.out-i386-linux -O elf32-i386 a.out-binary elf-binary

though you may have to build yourself suitably old i386-linux-gnu binutils
(from ftp.gnu.org), e.g. this version does support a.out:

$ objcopy --info
BFD header file version 2.15.91 20040527
elf32-i386
(header little endian, data little endian)
i386
a.out-i386-linux
(header little endian, data little endian)
i386
efi-app-ia32
(header little endian, data little endian)
i386
elf32-little
(header little endian, data little endian)
i386
elf32-big
(header big endian, data big endian)
i386
srec
(header endianness unknown, data endianness unknown)
i386
symbolsrec
(header endianness unknown, data endianness unknown)
i386
tekhex
(header endianness unknown, data endianness unknown)
i386
binary
(header endianness unknown, data endianness unknown)
i386
ihex
(header endianness unknown, data endianness unknown)
i386
trad-core
(header endianness unknown, data endianness unknown)

elf32-i386 a.out-i386-linux efi-app-ia32 elf32-little elf32-big
i386 elf32-i386 a.out-i386-linux efi-app-ia32 elf32-little elf32-big

srec symbolsrec tekhex binary ihex trad-core
i386 srec symbolsrec tekhex binary ihex ---------

The last binutils version to support a.out-i386-linux was 2.30 I believe.
Just configuring for i386-linux-gnu should do as a.out used to be included
as a secondary BFD target (you can also do `--enable-targets=all' to get
support for all kinds of the exotic and less exotic BFD targets).

HTH,

Maciej