Page 1 of 1

Building GCC for a.out executables

Posted: Wed Jan 05, 2022 10:18 pm
by spotracite
Before I say anything, I'd like to say that I know exactly why I shouldn't build an operating system around a.out executables, but ELF doesn't fit with my needs so I'm avoiding it. I'm going to be ignoring anyone who says "Why don't you just use X format instead?" because that doesn't answer my question. Also, I'll just say it here: I haven't tried all the options I could. I know. I have an extremely old and slow computer and it takes me forever to compile anything, so I'd rather try to find the solution BEFORE trial and error.

Currently, I'm trying to build a GCC Cross-Compiler. I've done this before with other toolchains so I'm fairly confident the problem isn't in my host compiler. I'm trying to compile it all with my target as i386-aout, which it automatically turns into i386-pc-aout. It gets through binutils fine up to ld, at which point it fails, informing me that:

Code: Select all

*** ld does not support target i386-pc-aout
*** see ld/configure.tgt for supported targets
Well, I checked configure.tgt and found the only reference to i386 and aout is here:

Code: Select all

i[3-7]86-*-msdos*) targ_emul=i386msdos targ_extra_emuls=i386aout targ_extra_ofiles= ;;
Which (I think, from my guessing how tgt works) indicates that I should be using i386-msdos-aout instead of i386-pc-aout. I'm at a point here where I could figure out more on my own but I'm having a hard time finding documentation on GCC for aout so I figured I'd just ask to see if anyone else can help me. Should I use i386-msdos-aout instead, or would that give me some other trouble?

Re: Building GCC for a.out executables

Posted: Wed Jan 05, 2022 10:37 pm
by klange
Binutils'/BFD's support for a.out [for x86] was always spotty and existed only for supporting legacy targets as everything switched to ELF or was already using something else more powerful (eg. PE) twenty years ago. It has been fully deprecated now and you will need to dig through ancient archives to find compatible versions of all the tools and dependent libraries if you want to build a toolchain supporting it.

You might have better luck building an ELF toolchain and then converting your outputs, rather than trying to natively build an a.out toolchain.

Re: Building GCC for a.out executables

Posted: Thu Jan 06, 2022 10:52 am
by Octocontrabass
spotracite wrote:ELF doesn't fit with my needs
Out of curiosity, what makes ELF not work for you?