Re: [PATCH] x86: Remove a.out support
From: Kees Cook
Date: Sat Apr 02 2022 - 22:38:24 EST
On April 2, 2022 3:14:43 PM PDT, "Maciej W. Rozycki" <macro@xxxxxxxxxxx> wrote:
>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
Based on my research (and the wrapper I ended up writing), I don't think this is sufficient because entry point handling is different between ELF and a.out (specifically the stack layout and initial sp register value).
-Kees
--
Kees Cook