Cosmopolitan libc

The next steps for adding support would be:

  • figure out limitations:

    • exceptions (seem supported now)
  • add a couple targets for Cosmopolitan in Crystal:

    • x86_64-unknown-cosmo
    • aarch64-unknown-cosmo
  • write C bindings in src/lib_c/<target>;

    • check if errnos and the C defines being runtime symbols instead of compilation time constants has any adverse effects;
    • understand the impact the system abstractions (src/crystal/system); most of unix should work… but they might need to be specific to cosmocc?
    • understand supported OS features (e.g. epoll, kqueue); maybe we’ll have to differentiate the OS at runtime when needed;
    • figure out fiber context switches :sweat_smile:
  • link executable (for the current target)

  • codegen both object files (for both targets) in parallel + linker calls, at least for release builds;

Then are the external C libraries. I assume most should work as long as they’re compiled with cosmocc (x86_64 and aarch64). They should compile and behave as if they’d been compiled for POSIX :thinking:

I’m more reserved on Boehm GC, however… or not.

4 Likes