cosmopolitan

build-once run-anywhere c library

ISC License

Stars
17.9K
Committers
83

Bot releases are hidden (Show)

cosmopolitan - Cosmopolitan v3.9.0

Published by jart about 1 month ago

Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. For further details, read Cosmopolitan Third Edition, the Cosmo README, and the Cosmopolitan Toolchain README. Prebuilt software is available on https://cosmo.zip/

Improvements

Cosmopolitan now has a bespoke speaker / microphone audio API.

  • dc579b79c Productionize polished cosmoaudio library
  • 0f3457c17 Add debug log to cosmoaudio and add examples
  • 5d3b91d8b Get printvideo audio working on Windows and MacOS
  • d1157d471 Upgrade pl_mpeg

There have been significant quality of life improvements for Windows.

  • e65fe614b Fix shocking memory leak on Windows
  • fbdf9d028 2ec413b5a cceddd21b Rewrite Windows poll()
  • acd6c3218 Rewrite Windows accept()
  • e14212473 Rewrite Windows connect()
  • 6b10f4d0b Fix ioctl() and FIONREAD for sockets on Windows
  • 58d252f3d Support more keystrokes in DECCKM mode
  • 03875bead Add missing ICANON features
  • c26014484 Introduce sigtimedwait() on Windows
  • baf70af78 Make read() and write() signal handling atomic
  • c3482af66 Fix file descriptor assignment issues on Windows
  • 79516bf08 Improve handling of weird reparse points
  • 39e7f2494 Fix handling of paths with dirfd on Windows
  • 462ba6909 Speed up unnamed POSIX semaphores
  • a5c0189bf Make vim startup faster
  • deb5e07b5 Remove exponential backoff from chdir()
  • 51c0f44d1 Fix rare corner case in ntspawn.c (#1284)
  • 5469202ea Get monorepo fully building on Windows again
  • b73673e98 Freshen bootstrap binaries

Bug fixes to cosmo libc system calls:

  • dd8544c3b Delve into clock rabbit hole

Multi-threading is now better:

  • 2f48a02b4 Make recursive mutexes faster
  • 3c61a541b Introduce pthread_condattr_setclock()
  • 90460ceb3 Make Cosmo mutexes competitive with Apple Libc
  • cca0edd62 Make pthread library internal mutex non-recursive

There have been improvements to your cosmocc toolchain:

  • d99f06611 Add clang-format to cosmocc toolchain
  • 1e9902af8 Support merging many .a files into one .a file
  • 41fc76c2b Fix apelink reproducible deterministic build bug

Bug fixes and improvements to the cosmo libc strings library:

  • 7c83f4abc wcsstr() is now linearly complex
  • 7c83f4abc strstr16() is now linearly complex
  • 7c83f4abc strstr() is now vectorized on aarch64 (10x)
  • 7c83f4abc strstr() now uses KMP on pathological cases
  • 7c83f4abc memmem() is now vectorized on aarch64 (10x)
  • 7c83f4abc memmem() now uses KMP on pathological cases
  • 7c83f4abc Make iswlower(), iswupper() consistent with glibc
  • 7c83f4abc Remove figure space from iswspace() implementation
  • 7c83f4abc Include line and paragraph separator in iswcntrl()
  • 7c83f4abc Use Musl wcwidth(), iswalpha(), iswpunct(), towlower(), towupper()

CTL now has a fast shared pointer implementation for C++ users.

  • e1528a71e Basic CTL shared_ptr implementation (#1267)
  • ae57fa2c4 Fix shared_ptr::owner_before (#1274)
  • 37e2660c7 make_shared should work with nontrivial objects (#1293)
  • ef62730ae Enable STL-style enable_shared_from_this (#1295)

There have been many improvements to the printf() family of functions.

  • e260d9009 Fix 0 before decimal-point in hex float printf fns (#1297)
  • 81bc8d096 Fix printing decimal-point character on printf %#a (#1296)
  • b55e4d61a Hopefully completely fix printf-family %a rounding (#1287)
  • 675abfa02 Add POSIX's apostrophe flag for printf-based funcs (#1285)
  • e3d28de8a Fix UB in gdtoa hexadecimal float scanf and strtod (#1288)
  • 7f2154712 Fix occasional crash in test/libc/intrin/mmap_test (#1289)
  • 19563d37c Make the pledge sandbox .so object work with UBSAN (#1290)
  • 7d2c36396 Fix statx not being allowed on rpath/wpath pledges (#1291)
  • 4d05060aa Partially fix printf hex float numbers/%a rounding (#1286)
  • 4754f200e Fix printf-family long double prec/rounding issues (#1283)
  • f88288717 Fix ecvt/fcvt issues w.r.t. value==0 and ndigit==0 (#1282)
  • c66abd726 Implement length modifiers for printf %n conv spec (#1278)
  • 8f8145105 Add POSIX's C conversion specifier to printf funcs (#1276)
  • a089c07dd Fix printf funcs on memory pressure with floats (#1275)
  • 75e161b27 Fix printf-family functions on long double inf (#1273)

Other improvements:

  • ecbf45346 Upgrade to superconfigure z0.0.55
  • 6397999fc Fix unicode look-alike in define (#1294)
  • b5fcb59a8 Implement more bf16/fp16 compiler runtimes
  • ed1f992cb Fix default open mode in redbean unix.open()
  • 389d565d4 Use unsigned-signed conversion for refs test (#1272)
  • 48b703b3f Minor cleanup/improvements in unique_ptr_test (#1266)
cosmopolitan - Cosmopolitan v3.8.0 Latest Release

Published by jart about 2 months ago

This release has important bug fixes. Your cosmocc toolchain now bundles
Clang which can reduce your C++ build latency by 3x if you pass -mclang.

  • ca2c30c97 Release redbean v3.0.0
  • 884d89235 Harden against aba problem
  • f3ce684ae Fix getpeername() bug on Windows
  • 185e95769 Detect implicit function declarations
  • 8e14b2774 Make fread() more consistent with glibc
  • c9152b6f1 Add experimental support for cosmocc -mclang
  • c9152b6f1 Switch C++ exception handling from SJLJ to DWARF
  • c9152b6f1 int_fast16_t and int_fast32_t are now always 32-bit
  • 6baf6cdb1 Fix printf badly handling +/` flag conflict (#1269)
  • 77be46029 Make Windows REPLs great again
  • 60e697f7b Move LoadZipArgs() to cosmo.h
  • 2d4414244 Get Meson builds working
  • 908b7a82c Add VSCode settings
  • 2eda50929 Add stdfloat header
  • 12ecaf865 Modernize ipv4.games server
  • ebe1cbb1e Add crash proofing to ipv4.games server
  • bb06230f1 Avoid linker conflicts on DescribeFoo symbols
  • 1a9f82bc9 Romanize Hindi, Yiddish, Arabic, Cyrillic, etc.
  • eb6e96f03 Change InfoZIP to not auto-append .zip to pathname
  • 4389f4709 Expose wmempcpy() to _GNU_SOURCE
  • 5b9862907 Delete superfluous function
cosmopolitan - Cosmopolitan v3.7.1

Published by jart 2 months ago

  • 914d52109 Fix relative Windows path normalization (#1261)
  • 11d9fb521 Make atomics faster on aarch64
cosmopolitan - Cosmopolitan v3.7.0

Published by jart 2 months ago

Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. For further details, read Cosmopolitan Third Edition, the Cosmo README, and the Cosmopolitan Toolchain README. Prebuilt software is available on https://cosmo.zip/

Improvements

Your malloc() function is now more scalable on Linux Aarch64 and other
platforms, where it previously was not working as well as advertised.

  • 0a79c6961 Make malloc scalable on all platforms

Cosmopolitan Bash now works better on Windows. For example, if you start
a process that redirects stderr to a file, then your entire process tree
will now be able to cooperatively write to that file. When you update it
is recommended that you upgrade all your cosmos binaries at once.

  • 3f26dfbb3 Share file offset across execve() on Windows
  • 761c6ad61 Share file offset across processes

Improvements have been made to cosmocc and libcxx which made it possible
for us to compile Clang as an APE binary.

  • 77d3a07ff Fix std::filesystem
  • 0d7c272d3 Don't use sendfile() in libcxx
  • 18964e5d7 Fix remove() directory on Windows
  • 6ac3d3b80 Add precompiled header support to cosmocc
  • f8cfc89eb Allow -c to be specified with -E in cosmocc
  • 01b09bc81 Support printf %n directive
  • 3dab20735 Remove mkfifo() prototype
  • d0360bf4b Introduce cosmoranlib

Some upstream dependencies have been updated. In particular, Musl locale
handling is more true to the way it works upstream. You may need to have
setlocale(LC_ALL, "C.UTF-8") in your main() function for certain POSIX
functions to work the same way they did previously by default.

  • bb815eafa Update Musl Libc code
  • ff1a0d1c4 Upgrade to superconfigure z0.0.51
  • 3fd275f59 Import optimized routines changes to exp10
  • d40acc60b Detect more x86 features

Additional Changes

  • a80ab3f8f Implement bf16 compiler runtime library
  • 8d8aecb6d Avoid legacy instruction penalties on x86
  • 24666e121 Add nightly cosmocc (artifact) builds (#1254)
  • 31194165d Remove .internal from more header filenames
  • 749936706 Ignore -Wimplicit-function-declaration in cosmocc
  • 9ebacb789 Convert GCC 14 errors back to warnings (#1247)
  • e18fe1e11 Freshen build/bootstrap/cocmd
  • cf1559c44 Remove __threaded variable
cosmopolitan - Cosmopolitan v3.6.2

Published by jart 3 months ago

Your cosmocc toolchain is now able to produce tinier binaries. For small
programs, passing -mtiny can cut binary size in half. In fact oftentimes
our fat binaries end up being half the size of statically linked
linux-only executables that use glibc. You can also pass -mdbg to link a
debug version of the cosmopolitan runtime.

  • 642e9cb91 Introduce cosmocc flags -mdbg -mtiny -moptlinux

Your cosmocc toolchain, which was recently built with GCC 14.1, is now
itself being compiled with GCC 14.1. We've also enabled the -fanalyzer
flag, which has been helping us find bugs.

  • fb54604b3 Upgrade to superconfigure z0.0.48
  • f147d3dde Fix some static analysis issues
  • 32292aee8 Fix build determinism issue
  • 81dd9639e Fix bug in tool/decode/zip

Your fork() function will now go much faster when it's used by many
threads at once.

  • cdfcee51c Properly serialize fork() operations

Some additional improvements:

  • 59692b088 Make spinlocks faster
  • 18a620cc1 Make some improvements of little consequence
  • 690d3df66 Expand the virtual address space on Windows
  • edd5e2c8e Expose gethostbyname()
  • a31d5ea39 Remove cosmoc++ compiler warning
cosmopolitan - Cosmopolitan v3.6.1

Published by jart 3 months ago

  • f25fbbaae Use libcxx abi v1
  • d3a13e8d7 Improve lock hierarchy
  • fbc4b03d4 Restore support for AMD K8
  • 2c4b88753 Add special errno handling to libcxx
  • 3915ca0f7 Have cosmocc define -Wno-implicit-int
  • 5dd7ddb9e Remove bad defines from early days of project
  • e398f3887 Make more improvements to threads and mappings
  • 7ba9a7384 Remove more _Atomic keywords from public headers
  • 1020dd41c bzero() should be defined without special defines
cosmopolitan - Cosmopolitan v3.6.0

Published by jart 3 months ago

  • This release performs an atomic upgrade to GCC 14.1.0. It features N-bit integer types.
  • This release upgrades libcxx to the latest code at HEAD from the LLVM project.
  • The mono repo now uses GNU C23 and C++23.
cosmopolitan - Cosmopolitan v3.5.9

Published by jart 3 months ago

  • 5d2d9e964 Add back missing TlsAlloc() call
  • 3de6632be Graduate some clock_gettime() constants to #define
  • 0a9a6f86b 6e809ee49 Support process shared condition variables
  • c83ec5fdd 41cc05341 16d244614 23611cd85 62a97c919 Improve APE specification
cosmopolitan - Cosmopolitan v3.5.8

Published by jart 3 months ago

  • 30afd6ddb Improve multithreading
  • 7ebaff34c Fix ctype.h and wctype.h
  • d3167126a Fix regression with last commit
  • e7be5a5e2 Upgrade to latest superconfigure
  • 29ce25c76 Start writing formal specification for APE
cosmopolitan - Cosmopolitan v3.5.7

Published by jart 3 months ago

  • 626a5d02e Add missing lock statement
  • 527aaa41e Prevent MODE=tiny ShowCrashReports() looping
cosmopolitan - Cosmopolitan v3.5.6

Published by jart 3 months ago

  • 2018cac11 Use better memory strategy on Windows
  • 6a5d4ed65 Fix issue with disabling sigaltstack()
cosmopolitan - Cosmopolitan v3.5.5

Published by jart 3 months ago

This release perfects the new memory manager. The impact of the mmap()
rewrite (introduced by Cosmo v3.5.0) is that LLaMAfiler's tokenization
endpoint was previously handling 2 million requests per second and now
it's handling 3.3 million per second.

  • 8c645fa1e Make mmap() scalable
  • 375687063 Implement new red-black tree
  • 1ff037df3 Add some mmap() documentation
  • f7780de24 Make realloc() go 100x faster on Linux/NetBSD
  • 76cea6c68 Squeeze more performance out of memory manager
  • fdab49b30 Demonstrate signal safety of recursive mutexes
  • 01587de76 Simplify memory manager

A few disruptive changes slipped in, but they're necessary. Aside from
the changes listed below, please note that you might need to update your
code to use sysconf(_SC_GRANSIZE) instead of sysconf(_SC_PAGESIZE)
when the alignment of the addr or offset parameters to mmap() is
the thing you care about.

  • 1029dcc59 Reduce default stack size from 256kb to 81kb
  • 86d884cce Get rid of .internal.h convention in LIBC_INTRIN
  • fc6542266 Remove __mmap() and __munmap()

Other changes:

  • 3f2a1b696 Fix greenbean example
  • 0ed916ad5 Fix a bug in example code
  • 5a9a08d1c Fix regression in elf2pe program
  • c697133a2 Fix typo in accept4-sysv.c (#1235)
  • 15ea0524b Reduce code size of mandatory runtime
  • 6dbc3fba1 Add AMD cache sizes to o//tool/viz/cpuid
  • bd6d9ff99 Get deathstar demo working again on metal
  • 135d538b1 Make ctl::set use 30% less memory than libcxx
cosmopolitan - Cosmopolitan v3.5.4

Published by jart 4 months ago

  • d0cd71937 Make more CTL fixes
  • 61370983e Complete the Windows TLS fix made in e437bed00
  • 72511ff0a [Redbean] Add UuidV7 method (#1213)
  • e627bfa35 c1f8d0678 Introduce ctl::to_string()
  • acbabedf2 Make CTL definitions less ambiguous
cosmopolitan - Cosmopolitan v3.5.3

Published by jart 4 months ago

Your cosmocc toolchain now includes five new useful programs: ar.ape,
sha256sum.ape, resymbol, and cocmd. See ca4cf67eb for further details.

This release fixes Android support. You can now run LLMs on your phone
using Cosmopolitan software like llamafile. See 78d3b86ec for further
details. Thank you @aj47 (techfren.net) for bug
reports and and testing efforts.

We've worked out additional kinks in our new mmap() runtime, which now
has a more bulletproof locking strategy. See 1bf2d8e30 for details.

This release fixes a Windows regression that was introduced in the last
release, where programs that need a lot of thread_local storage would
crash very early during initialization. See e437bed00 for details.

Newly discovered issues in Cosmo's POSIX threads runtime have been
addressed. It's now possible to cancel a thread that was created by a
canceled thread. Keys now destruct atomically within a thread, out of an
abundance of paranoia w.r.t. signal safety. Thread destructor function
names are also now logged to --strace. It's a boon for debuggability.
See 76957983c for further details.

We invented a new non-POSIX API named pthread_decimate_np() which forces
the runtime to garbage collect zombie threads. It can be used alongside
pthread_orphan_np() to block until detached threads have exited, so it's
safe to CheckForMemoryLeaks(). See 4cb5e21ba for further details.

We've also added more preliminary content to the Cosmopolitan Templates
Library, which is an STL replacement that has 10x faster build times.

  • 98e684622 Add iostream to CTL
  • 44191b3f5 Add more type traits to CTL
  • 387310c65 Fix issue with ctl::vector constructor
cosmopolitan - Cosmopolitan v3.5.2

Published by jart 4 months ago

  • 464858dbb4 Fix bugs with new memory manager
  • 6de12c1032 Upgrade to superconfigure z0.0.44
  • 021c53ba32 Add more CTL content
  • 38921dc46b Introduce more CTL content
  • 054da021d0 ctl::string benchmarking code (#1200)
  • 199662071a Make std::random_device use getentropy()
cosmopolitan - Cosmopolitan v3.5.1

Published by jart 4 months ago

  • d461c6f47d Do more quality assurance work
cosmopolitan - Cosmopolitan v3.5.0

Published by jart 4 months ago

Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. For further details, read Cosmopolitan Third Edition, the Cosmo README, and the Cosmopolitan Toolchain README.

Improvements

We now have a higher quality memory map implementation.

  • 6ffed14b9c Rewrite memory manager
  • 0dbf01bf1d Bring Lua to 5.4.6. (#1214)
  • 7f6d0b8709 Support -x LANG flag in cosmocc
  • f2c8ddbbe3 Fix --strace use-after-free in pthread_join()
  • d1d4388201 Delete ASAN

We've made a lot of progress reinventing the C++ STL.

  • 8b3e368e9a ctl::string small-string optimization (#1199)
  • c4c812c154 Introduce ctl::set and ctl::map
  • f9dd5683a4 Implement ctl::unique_ptr (#1216)
  • 118db71121 Provide a minimal new.h for CTL (#1205)
  • a795017416 Fix c.inc _Atomic define for C++ (#1231)
  • d7b1919b29 ctl::unique_ptr improvements and cleanup (#1221)
  • 7e780e57d4 More ctl::string optimization (#1232)
  • 9a5a13854d CTL: utility.h, use ctl::swap in string (#1227)
  • e38a6e7996 ctl string const/value tweaks (#1218)
  • d44a7dc603 Fix bugs in in ctl::optional (#1203)
  • 2ba6b0158f Fix some memory issues with ctl::string (#1201)
  • f86e6f8eb0 Make new.cc definitions weak (#1233)
  • 03b476f943 Minor small-string errata from #1199
  • f3effcb703 One more SSO erratum from #1199
  • 32643e9fa7 Decouple swap from std (#1211)
  • a0410f0170 Make big_string pod (#1204)

We've been making improvements to our GitHub development process.

  • df6b384e31 github: add labeler action (#1196)
  • 280bdec817 github: add issue template (#1195)
  • 8e3b361aeb Remove testing label from labeler.yml (#1220)
cosmopolitan - Cosmopolitan v3.4.0

Published by jart 5 months ago

Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. For further details, read Cosmopolitan Third Edition, the Cosmo README, and the Cosmopolitan Toolchain README.

Improvements

This release makes dlmalloc scalable and zlib crc32 faster. Enterprise
server applications that employ many threads on many cores can now
look upon Cosmopolitan as a serious and viable option for their needs.

  • 3609f65de3 Make malloc() go 200x faster
  • a05ce3ad9d Support avx512f + vpclmulqdq crc32() acceleration

This release fixes some showstopper issues on Windows.

  • e4d25d68e4 Drop support for Windows 8
  • cd672e251f Improve crash signal reporting on Windows
  • f31a98d50a Fix bug with realpath() on Windows
  • 2816df59b2 Increase tinymalloc granularity

This release brings a more modern standard library for C++. It compiles
slower, but in certain cases that can be worked around since it defines
"breakout" headers for individual functions, e.g. std::move(). Since it
goes so slow, we're experimenting with creating our own STL replacement

  • 8e68384e15 Upgrade to 2022-era LLVM libcxx
  • 4937843f70 9906f299bb Introduce Cosmopolitan Templates Library (CTL)

Our --ftrace function call logger now demangles C++ symbols. This is
thanks to revisions we've made to our FreeBSD demangler that makes it
lockless and reentrant so it's safe to call from signal handlers. It's not as
good as the libcxxabi demangler, but that doesn't make it unimpressive.
For example, calling kprintf("%t", sym) successfully demangles 90% of
the symbols in the llamafile codebase. Usually when it doesn't work, it's
because a symbol is very very long. Since it's run when nops are hooked
in function prologues, it has to be part of the privileged cosmo runtime,
which is highly constrained and can only use fixed size stack buffers.

  • 165c6b37e2 9aa353d88b 2ca491dc56 b003888696 Add C++ demangling to privileged runtime
  • 9b6718ac99 Improve backtraces

Additional improvements:

  • 7c8df05042 Improve -march=native micro-architecture detection
  • b74b974cfd Introduce #include <tinygetopt.h>
  • 4c77acdfcf Add LoadZipArgs() to <cosmo.h>
  • fae1c32267 Encode ±INFINITY as ±1e5000

Finally, this release sunsets the cosmopolitan amalgamation.

cosmopolitan - Cosmopolitan v3.3.10

Published by jart 5 months ago

  • 07004ebf04 Upgrade to superconfigure z0.0.42
  • 086d7006da Improve crash handler on XNU
  • 0a51241f7a ntspawn: fix initializing NtStartupInfoEx (#1190)
  • c68f6599e5 Fix definition of getpeername on FreeBSD
  • af3f62a71a Ensure io requests are always capped at 0x7ffff000
cosmopolitan - Cosmopolitan v3.3.9

Published by jart 5 months ago

  • c2db3b703a Introduce --timelog=FILE flag to GNU Make
  • edb03b89d8 Make stdin unbuffered when appropriate