-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] First pass at compiling most all of C library with OpenWatcom #1911
Conversation
Hello @ghaerr , Fantastic. Does this also need gcc-ia16? Thank you. |
Hello @tyama501,
No. Except that it does build the ELKS C library within the $TOPDIR/libc directory of the ELKS repo, so the repo must be cloned at present. In addition, the tool
and then copying
The idea will be that one can compile ELKS programs without requiring Thank you! |
Would having this compiler help a bit with porting Doom8088 :) ? Maybe the memory requirements will now be easier: medium, large model, far pointers, etc? |
Yes @toncho11. The OpenWatcom C compiler is an incredible piece of software technology. It has everything we could need as far as supporting small, medium, compact, large and huge models, near/far pointers, fast/specialized register-calling sequences, and the likely ability to run on ELKS itself at some point. It comes with complete source to all tools and its very complete runtime libraries for DOS, OS/2, and 32-bit Linux. I'm quite impressed with it. That said, there's still quite a bit of work getting the large data model working, and the ASM format is Intel rather than AT&T (ia16-elf-as) compatible. I'm currently in a deep dive trying to get our C library compiled and working in large and compact models. Things are almost working, but the ELKS a.out format isn't suitable for > 64K data or 128K code and will have to be enhanced in order to fully support large data/code. There's also some big issues with floating point, which is that soft floating point emulation will be hard to support. The math library is currently being compiled assuming an 8087 coprocessor. For now, this only affects the |
Hello @ghaerr , I needed to source the following script that is included in the linux build watcom, Thank you. |
Oh, should not the header in /usr/bin/watcom/lh be used? |
Yes at the end of the https://github.com/FrenkelS/Doom8088 readme it says:
|
Excellent work @ghaerr !!! |
Hello @tyama501,
Sorry, I'm fixing that right now - long story short it is getting complicated mixing header files between IA16 and Watcom compilers. I should have a PR posted shortly. The WATDIR= environment variable does need to be set though to the base of the OpenWatcom repo (not the bin installation locations).
No, the "lh" headers are for Linux, but they can't be properly used for ELKS because all the Watcom headers for Linux assume 32-bit integer (and other) sizes and so are incorrect. We have to use the DOS headers but the application programs will always use the ELKS headers, with a few exceptions noted below. The INCLUDE variable is set in libc/watcom.inc should not be /usr/bin/watcom/lh, but rather $WATDIR/bld/hdr/dos/h. That said, some applications will need "standard" headers that are not provided by ELKS C library. These include stddefs.h, stdarg.h, and a few others. The stdint.h header is usable but is redirected by the ELKS stdint.h. I will clarify more on this after I have it all sorted out. We also cannot use any of the system call wrappers OpenWatcom has already built for DOS, OS/2 or Linux, as none of these will work correctly for ELKS. I'm also working on that now. Thank you! |
Compiles almost all the ELKS C library using the OpenWatcom C compiler for compact model. Large, medium and small mode are easily built by editing libc/watcom.inc.
This first version is mostly for OpenWatcom compatibility testing, getting the Makefiles adjusted, and further application linking testing. Discussed a bit in #1443 and #1786.
To use, the OpenWatcom C Toolchain needs to be cloned and built, and then the
WATCOM
andWATDIR
environment variables need to be setup by sourcing a script like the following with the full path to the OpenWatcom binary directory (WATCOM) and top-level directory (WATDIR):After that, to build the C library
libc.lib
: