pts / minilibc686

libc and tools for creating size-optimized, statically linked Linux i386 and i686 programs
GNU General Public License v2.0
11 stars 0 forks source link

Pre-ELF (a.out) support? #1

Closed devinsmith closed 5 months ago

devinsmith commented 1 year ago

Is it possible to target pre-ELF (a.out) with this tooling? Or if not, do you know of a similar project targeting such an ancient a.out systems?

ghaerr commented 5 months ago

Hello @devinsmith,

Not sure whether you're looking for 16- or 32-bit a.out support, but the ELKS Project allows for the compilation and execution of 16-bit a.out (MINIX) based programs.

With this commit I added 16-bit support to omf2elf.c, which now works to allow using OpenWatcom C to compile to .OBJ OMF format, then use omf2elf to convert from .obj to ELF .o format, then run the ia16-elf-gcc linker (which produces a 32-bit ELF output file) followed by ELKS' elf2elks which converts that to MINIX a.out format.

I intend to open a PR here with the enhanced changes to omf2elf.c after more development and testing with OpenWatcom.

Thank you!

pts commented 5 months ago

I've just added Linux i386 (32-bit) a.out QMAGIC executable output support, in 63c009a1fb12a5f1c988833e9e41edcb794950e4. To use it, specify minicc -maout.

It was relatively easy, because GNU ld(1) (tools/ld) supports it with the right flags. I haven't tested executions though, because all my Linux systems are too new to try it.