|
|
Subscribe / Log in / New account

GCC IA16 backend

GCC IA16 backend

Posted Oct 7, 2017 17:21 UTC (Sat) by felix.s (guest, #104710)
Parent article: Videos from the GNU Tools Cauldron

The 'GCC IA16 backend' video immediately drew my attention, but I was rather disappointed after seeing it. It's about an update to a patch from 2007, which implements x86-16 support as a separate architecture, as opposed to making it a subtarget of 'i386' (which I believe is going to lead to some duplicated effort in optimisation, and be somewhat more painful to use: it's not like passing -m32 on x86-64). And there's still no far pointer support. So this effort is going to be far (ahem) less useful for projects like SeaBIOS or CWSDPMI: they don't actually require supporting literal 8086 hardware, but still care about segmented memory addressing and 16-bit calling conventions (code compiled with gcc -m16 can run in real mode, but uses the 32-bit ABI, which wastes stack space).

By the way, the speaker mentioned someone else actually implementing preliminary support for far pointers and even generating EXE files, but I couldn't make out the name of that person. I couldn't find the patches by web searching either. Can anyone tell me where they are?


to post comments

GCC IA16 backend

Posted Oct 9, 2017 8:02 UTC (Mon) by mjthayer (guest, #39183) [Link] (2 responses)

> By the way, the speaker mentioned someone else actually implementing preliminary support for far pointers and even generating EXE files, but I couldn't make out the name of that person. I couldn't find the patches by web searching either. Can anyone tell me where they are?

This seems to be their github repository:

https://github.com/tkchia/build-ia16

GCC IA16 backend

Posted Oct 9, 2017 21:25 UTC (Mon) by felix.s (guest, #104710) [Link] (1 responses)

Thanks. This is actually just the build system, but from there I found a link to their GCC repo and the binutils repo. The far pointers part is there. Props to them: I've attempted writing that myself once, but only managed to generate a few ICEs. Still a pity it's not part of the regular i386 target.

The binutils repository doesn't seem to contain any EXE support (beyond the comically incomplete 'i386msdos' target that by some miracle made its way upstream long, long ago); it looks like it just contains Bernd Jendrissek's OMF patch from 2011, which only adds objdump support and is quite buggy even for that purpose. Which I happen to know because some time ago I did some work updating and extending that very patch. What a shame I've got it all on a disk I cannot access right now.

GCC IA16 backend

Posted Nov 4, 2017 4:07 UTC (Sat) by tkchia (guest, #119442) [Link]

Hello all,

I am the coder behind the far pointer support for IA-16 GCC. Thank you very much for your comments!

Regarding .exe support, my fork of gcc-ia16 does have it, but it can only create "small" memory model .exe files, i.e. with 64 KiB code + 64 KiB separate data in total. Passing -mcmodel=small to my GCC front-end should enable the .exe support (the default is -mcmodel=tiny).

As for the actual implementation of .exe output: it is not in the binutils component, but actually in the newlib part (!). I use a linker script to fabricate the .exe header and lay out the code and data correctly.

--- T. K. Chia


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds