Skip to content

[libc,c86] Compile all of ELKS C library with C86#2148

Merged
ghaerr merged 2 commits intomasterfrom
c86
Dec 27, 2024
Merged

[libc,c86] Compile all of ELKS C library with C86#2148
ghaerr merged 2 commits intomasterfrom
c86

Conversation

@ghaerr
Copy link
Copy Markdown
Owner

@ghaerr ghaerr commented Dec 27, 2024

Somewhat amazingly, we now have a full C library for the ELKS native C86 C compiler, working on ELKS!

When used with the 8086 toolchain update ghaerr/8086-toolchain#13, almost all of the entire ELKS C library is now built and available for user program development, both from a host as well as natively on ELKS using the 8086 toolchain.

The C86 library is built very similarly to the OpenWatcom C library, using a shell script (that must be edited) to specify the 8086 toolchain root, and then a set of makefiles that build the entire library as libc/libc86.a:

$ cd elks-root/libc
$ . ./c86env.sh (edit this file first and set C86= to the 8086 toolchain repo root)
$ make -f c86.mk clean
$ make -f c86.mk
(library now at ./libc86.a)

The following source files were added:

  • libc/c86/syscall.s, syscall2.s, from 8086 toolchain and updated. They will be maintained here since the C86 library is built within the ELKS C library master sources.
  • libc/c86/syscall.asm, syscall2.asm (NASM versions of the above, not used and likely not to be maintained). All assembling is now performed by AS86.
  • libc/c86/divmod.s - ported asm/divmod.s over
  • libc/include/c86/limits.h written
  • libc/include/c86/stdarg.h and stddef.h, from 8086 toolchain. All include files will be maintained here within the C library.

Not supported:

  • Routines requiring 64-bit ints, which are not supported by C86. These include lltostr and ulltostr.

Not yet supported:

  • signal() - requires far pointer work to pass to kernel.
  • stdout is currently unbuffered, requires constructors/destructors which aren't yet implemented.
  • qsort produces a strange compiler bug.
  • floating point.

@ghaerr ghaerr merged commit 7b5caad into master Dec 27, 2024
@ghaerr ghaerr deleted the c86 branch December 27, 2024 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant