-
Notifications
You must be signed in to change notification settings - Fork 118
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
[ia16-gcc] General ia16-gcc toolchain questions #2239
Comments
Each of your compilation issues are slightly different:
Given that signal.h is a kernel include, the options given to ia16-elf-gcc are including something that is causing failure, when the "normal" options found in elkscmd/Makefile-rules don't give this error. I will have to look into exactly what is the problem, given your use of lots of options.
It appears that the C99 option doesn't allow
"Reading the error message" (!) shows this is related to Lua source and ELKS source using the |
Uff, sorry about not properly reading the error messages, I was in "automatic" mode trying to port stuff with the least effort. So for software fpu, I better stick with ia16-gcc, right? Lua needs some fpu operations. |
Yes, definitely read the error messages!!
Probably yes, but not necessarily: while we have been successful getting programs like ELKS Basic to run using floating point compiled with OWC, the ELKS math library (include/math.h) has not been ported to OWC; so while you can use OWC to successfully produce floating point code using hardware FPU instructions, only the basic C operations (+,-,*,/) are supported. Much else requires the math library which isn't available. (Our OWC Basic runs well displaying floating point numbers except none of the Basic math functions are compiled in, for instance). |
We know why the other two errors are occurring. For this one, you'll need to compare the options given to ia16-elf-gcc in elkscmd/Makefile-rules with your own. I haven't had time to do this, but would like to hear what you find out. I find this interesting because I have more strictly followed the options specified in Makefile-rules, but that doesn't necessarily mean we should not deviate from them. In particular, having a warning on an undefined symbol like For the Lua |
The reason for this warning is |
Looking further, the error occurs because of the forward declaration of the system call This would probably be worth making a change for, so that our header files can be used strictly as C99. Shall I make this change? Are you finding it useful to compile code as C99-compliant? |
Hi @ghaerr. I like to use C99 when possible, so if the change is not intrusive, that would be welcome. |
Got it. This is why I got tons of undefined math library symbols when trying to compile Lua with OWC. Then I changed to ia16-gcc for this reason. |
Thanks for the support. Just fixing the noreturn, and copied the content of Makefile-rules, I compiled all Lua!
I tried medium model, but then compilation fails fast, and I'll have some work to do.
|
I think my comment about being able to quickly "fix" signal.h for use with C99 was nearsighted - the fix would eliminate the use of The problem with removing these functions is that we're using them for various applications - so we're basically not C99 compliant - which I suppose is not surprising since we've got 16-bit ELKS extensions in order to get everything working. I've left C99 header "support" on my list to think about, but don't think we should make header changes quickly at this point. BTW, we've get both OWC and C86 compilers set to C99 but they're not emitting warnings for |
Yes it appears that Lua wants to have sizeof(int) == sizeof(char *). Instead of using medium model, perhaps look further at configuring Lua for a very small version that will compile in small model. Otherwise, you may end up having to use OWC large model. Lua is very well designed from what I've heard, reading more of its documentation will hopefully how it should be configured for small platforms. |
I friend advised me that both can be done - use owc and remove mathlib from the build, use large model, or with ia16-gcc, really strip lots of modules and make it fit in the desired size (small model). I'll give another shot with owc and disabling mathlib. |
Got it. Indeed, no need for c99 in ia16-gcc. Btw, what would need to be done for a math library for watcom? It is possible to also have soft-fpu? This is not really for Lua, as at least 5.1 and 5.2 can be built integer-only, but in case of scattered floating point usage, it would be nice to have software fpu (requiring a FPU seems not a good option). |
After more research, I have found that ia16-elf-gcc sets __STRICT_ANSI__ when -std=c99 is set, and some ELKS header files already have support for removing non-standard extensions when __STRICT_ANSI__ is set. Seeing this, I now think we should go ahead and support C99 (or other) C standards in our header files, through the use of __STRICT_ANSI__ being defined. This change will also allow some I'll go ahead and make the changes to the libc and kernel header files, so that -std=c99 can be used with ia16-elf-gcc. Note that OWC is already being passed -std=c99 (using ewcc) and that in this case, the OpenWatcom C compiler does not define __STRICT_ANSI__, which allows it to use the __far keyword based functions, which is just want we want! |
You might want to experiment around with it a bit, but I have not yet figured out how to get OWC to emit direct calls to software floating point emulation, which is supposed to work using We're currently using the If you'd like to experiment with -msoft-float and then run |
Cool! Thanks the explanation. When I go back to porting Lua I'll try all options and inspect the generated code, as I to have a real fully-featured Lua, I guess we'll need large memory model (it works fine on DOS, so it should also work fine on ELKS). Without mathlib in Lua, Lua retains float support, but just not exposing the math libraries (of course, if the compiler supports float). Btw, at some day in the future we could also enable FPU in C86 and see what happens... |
I looked into that - C86 generates 8087 hardware FPU instructions only, no soft FP emulation. When I tried porting the ELKS math library to OWC I got a number of problems, but don't recall exactly what they were offhand. C86 will likely be the same. Should we want to "require" hardware FPU support, that excludes systems with CPUs earlier than about 486DX and no extra FPU chip installed, right? Does anyone have any thoughts about how many 386 systems had 8087/80387 chips installed? I think that was a premium option for a few years there up until 1989 or so. We would probably have to flag our FP programs so that they at least didn't crash on those earlier systems. |
SoftFPU seems a sensible approach indeed, when needed. I'll take a look what owc does when "fpc" is using, which should "generate calls to floating-point library". |
I just played with running |
Yay, I'm with the fingers crossed! With soft-float, OWC will be complete for C language IMHO, able to compile big boss software like Doom, Lua and zlib, and also small model software, like elks image viewer, sound/midi players, any small tool. Most importantly, owc supports large model, which ia16-gcc does not. |
Doom uses only OWC. Would this soft FPU support help Doom with speed? Probably no. Maybe Doom already handles floating point operations using integer arithmetic. |
With all variables set, ia16-gcc gives me error, in a file where the first line is "#include <signal.h>"
without -std (just a warning):
with -stc=c99:
Other time I get (when trying to compile Lua):
I always struggle with the correct order to add the includes, specially when porting others software. Is there any cookbook recipe or may be I just hit a bug or cornercase?
The text was updated successfully, but these errors were encountered: