Closed tkchia closed 5 years ago
(Argh! I think I am getting a roadblock at an unexpected place --- the libstdc++
library code included with the rest of GCC. My initial idea for implementing the medium model was to hack the machine-independent middle end to make all functions have a "non-default" far address space by default, but GCC's C++ parser started throwing out error messages whenever it saw any kind of type qualifier --- including __far
--- tacked onto a function.)
Realistically all functions shouldn't be far by default, only those that need to be put in different text segments (and those that are global symbols or can be accessed externally).
Vote for this feature. Huge model need for my masm2c project.
Hello all,
I am now giving another try at implementing the medium memory model, using a slightly less intrusive method (which avoids hacking the machine-independent middle end). This is still work in progress, and is currently in a separate Git branch.
Thank you!
Hello all,
I have got medium memory model support for C pretty much working, so I am merging the code into my main Git branch.
I hope to do further tests to get everything stabilized.
The medium model is still not supported for C++ though. The machine-independent C++ middle-end code has no concept of named address spaces or even different kinds of pointers; it seems to me that getting everything to work correctly would require rather extensive changes to this middle-end, which I prefer not to do yet. So I think I will hold off on implementing C++ support for now.
Thank you!
Now that I have got the IA-16 toolchain to support far functions --- and the
MZ
relocations needed to support them --- it now looks feasible to me to add support for the "medium" memory model, with one data segment and multiple text segments. This should help expand the range of programs we can express and build usinggcc-ia16
.The main modifications to the toolchain will be to make sure that all functions are far by default --- even internal
libgcc
functions such as__udivsi3
--- and to make sure that pointer sizes, stack frame offsets, library routine implementations, etc. all reflect that.(Unfortunately, it still seems tricky to implement the memory models with multiple data segments, i.e. "compact", "large", and "huge", or even separate data and stack segments for things like callbacks and interrupt handlers. These probably require some more thought.)