An alternative runtime for C11/C23 (mirror)
Go to file
flysand7 27ee227f8e Thread cancellation 2023-09-17 17:15:58 +11:00
.github/workflows ???????? 2023-09-07 08:22:12 +11:00
arch Thread cancellation 2023-09-17 17:15:58 +11:00
include Thread cancellation 2023-09-17 17:15:58 +11:00
loader Move tcb to include/cia-ld. Fix deadlock due to no spurious wakeup 2023-09-10 14:38:27 +11:00
os Thread cancellation 2023-09-17 17:15:58 +11:00
src Thread cancellation 2023-09-17 17:15:58 +11:00
tests Thread cancellation 2023-09-17 17:15:58 +11:00
.gitignore pull out arch-specific stuff into its own folder (windows broken) 2023-08-25 20:18:28 +11:00
build.py Fix %I64d not loading correct int sizes 2023-09-12 21:07:02 +11:00
cia.c Add write lock to printf 2023-09-12 04:40:29 +11:00
license ANEW 2023-07-23 01:30:04 +11:00
readme.md update readme 2023-09-12 03:03:57 +11:00
todo.md Update TODO 2023-08-01 13:11:56 +11:00

readme.md

Ciabatta

Linux Windows

Ciabatta - An implementation of cross-platform C standard library with the following goals:

  • Providing C standard library that fully implements all C features. Some standard libraries lack many features of C11 and C23, like threads.h or aligned_alloc in case of MSVCRT.
  • Making standard library that is easy to port to other platforms, for example an embedded platform or a custom operating system.
  • Allowing applications to debug and step into standard library functions (Hello MSVCRT!)
  • Reasonably fast CRT compared to MSVCRT and glibc, e.g. making malloc use a faster allocator, avoid runtime checks where possible, heavely rely on inlining.
  • Extend the possibilities of C standard library with commonly used functionality: implementing POSIX standard, capability for unicode processing, API to traverse directories, hash functions, better strings API, crash handlers.

Ciabatta is not binary-compatible with other CRT libraries. That means that any libraries that your project uses have to also be compiled with Ciabatta, otherwise you will run into issues.

Please note that as of today ciabatta is still during development and does not implement many of the features that need to be implemented. Using it at current time is discouraged.

Current Status

C23 standard library

Header Description Status
<assert.h> Diagnostics. none
<complex.h> Complex arithmetic. none
<ctype.h> Character handling. none
<errno.h> Errors. Implemented
<fenv.h> Floating-point environment. none
<float.h> Characteristics of floating types. none
<inttypes.h> Format conversion of integer types. none
<iso646.h> Alternative spellings. none
<limits.h> Sizes of integer types. Implemented
<locale.h> Localization. none
<math.h> Mathematics. none
<setjmp.h> Nonlocal jumps. [1]
<signal.h> Signal handling. none
<stdalign.h> Alignment. none
<stdarg.h> Variable arguments. none
<stdatomic.h> Atomics. [1]
<stdbit.h> Bit and byte utilities none
<stdbool.h> Boolean type and values. none
<stddef.h> Common definitions. none
<stdint.h> Integer types. Implemented
<stdio.h> Input/output. Partial
<stdlib.h> General utilities. none
<stdnoreturn.h> _Noreturn. none
<string.h> String handling. Partial
<tgmath.h> Type-generic math. none
<threads.h> Threads. Partial
<time.h> Date and time. none
<uchar.h> Unicode utilities. none
<wchar.h> Wide character utilities. none
<wctype.h> Wide character utilities. none

[1] Implemented by compilers

Support

Operating System:

  • Windows
  • Linux

Processor Architecture:

  • x86-64

This library is supposed to be extensible to other platforms, meaning that you can write an OS layer for another OS and use the rest of the CRT functionality.

Building ciabatta

Before proceeding please note that ciabatta can only be compiled and used with clang and cuik. It may be able to work with gcc with some minor adjustments but I never tested it.

You can get cuik in the GitHub repository

On linux you can simply run ./build.py script. On windows can run it with py build.py command.

The script accepts some command-line arguments, which you can check by running

$ ./build.py -h

Usage

Grab the following files into your project's (or any other) directory:

  • The ./include folder
  • The ./lib folder
  • (Windows only) The ./utf8 folder

In order to compile your project with ciabatta see the following sections, assuming you put all files mentioned above in the ./ciabatta folder

Compiling with ciabatta on windows

  1. Add the following flags to your compilation command: -nostdlib -I ./ciabatta/include utf8.obj -mfma
  2. Add the following sources to the compile command: ./ciabatta/lib/cia.lib

Note: The include folder refers to the folder you copied from ciabatta. Set the path to it accordingly.

Compiling with ciabatta on linux

  1. Add the following flags to your compilation command:
    • -nostdlib -I ./ciabatta/include -mfma
  2. Link to the following libraries
    • ./ciabatta/lib/cia.a
  3. Specify the ciabatta dynamic loader in linker options
    • -Wl,-dynamic-linker,lib/ld-cia.so

Contributing

Pull requests welcome and accepted in any form.

License

See the license file