Skip to content

Releases: jart/cosmopolitan

Cosmopolitan v3.2.3

07 Jan 20:49
4cd02c2
Compare
Choose a tag to compare

This release introduces two new features:

  • b3fb6cf Add /dev/fd support to Windows
  • ce17ed6 Support -MF and -MT in cosmocc

Your cosmo_dlsym() function now returns the raw symbols. You need to
update your code to call cosmo_dltramp() on the result, otherwise it
will crash on Windows. Better yet, just use __ms_abi__ if you can.

  • 5e71370 Make breaking change to cosmo_dlsym()

The following fixes have been implemented:

  • 5ae2554 Have cosmo_dlopen() request -z execstack on Linux
  • aa37a32 Make $prog.ape more reliable on Apple Silicon (#1071)
  • 390335e apeinstall/uninstall.sh can use doas (#1062)
  • d27a47b Bugfix: ape --help should exit 0 (#1060)

Known Issues

APE Loader has a backwards compatibility regression right now. If you
run ape/apeinstall.sh on Linux then, due to a new binfmt_misc feature,
many old APE binaries that need to load zip assets will refuse to run. You
can fix that on Linux x64 for example by running:

ape/apeuninstall.sh
make -j8 o//ape
sudo mv o//ape/ape.elf /usr/bin/ape
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"

This will be solved by the next release, to ensure that only modern
APE binaries can use Linux's new P feature. APE is after all designed
to stand the test of time. The intent is to support every APE executable
created since the beginning of the project.

Cosmopolitan v3.2.2

06 Jan 05:26
91de6f1
Compare
Choose a tag to compare

Function pointers are now safer when using dynamically linked libraries.

  • fad1279 Make cosmo_dlopen() safer and faster

Cosmopolitan v3.2.1

05 Jan 23:50
c60b150
Compare
Choose a tag to compare
  • 0e49bed Support 40 cosmo_dlopen() function parameters
  • 2d93788 Fix --ftrace with cosmo_dlopen()
  • 44a463e Invent *cosmo_dltramp() function
  • 15548b5 Cleanup apeinstall.sh (#1057)
  • 412a200 Support binfmt_misc P flag in APE loader (#1058)
  • a334f9c Update redbean ProgramDirectory to return a list of previously set directories (#1021)
  • 3315b6e Store StrlenDevFd in n (#1056)

Cosmopolitan v3.2

04 Jan 18:15
a3deef7
Compare
Choose a tag to compare

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.

Our latest 3.2 release features exciting fixes and improvements.

  • 83107f7 Introduce FreeBSD ARM64 support
  • 43fe595 Use DNS implementation from Musl Libc
  • 7961487 Remove hard coded paths from APE bootloader (NixOS)
  • f8ea02d Import /etc/shadow support from Musl for Linux
  • ce0143e Fix madvise() on Windows
  • 873069f Fix -Xaarch64 in cosmocc
  • 1a28e35 Use good locks in dlmalloc
  • cd52c59 Allow MAP_POPULATE under pledge()
  • e36283f Support double parameters in dlsym() imports
  • 6be9477 Fix redbean to only check additional content types when Lua is present (#1033)

We've fixed important threading bugs on /zip/... file descriptors.

We now have a hack that lets you use cosmo binaries as a login shell.
Setuid security is improved. Executable path self-detection is better.
There's a new APE loader version as a result. If you have a systemwide
APE loader install, it's recommended that you upgrade, but not required.

Our public header files now have better open source compatibility.

  • 8874a37 Add <link.h> for absl
  • 221a278 Define max_align_t in <stddef.h>
  • 06ace4e Always use compiler builtin for offsetof()
  • a11016e Use gid_t and uid_t in passwd.h (#995)
  • b0cced8 Move tcgetpgrp and tcsetpgrp decls to unistd.h (#996) (#997)

Cosmopolitan v3.1.3

01 Dec 18:46
450d9b1
Compare
Choose a tag to compare
  • 69ba516 Revert "Re-enable apelink size optimization"

Cosmopolitan v3.1.2

01 Dec 14:58
9e9d2c0
Compare
Choose a tag to compare
  • d1a745c Implement __zipos_dup (#972)
  • 4b7ba9a Fix some bugs with dup2() and ZipOS
  • 7845495 Get tool/cosmocc/package.sh working on M1 (#970)
  • 14bf571 Make cosmocc make work right on aarch64
  • 7b3d7ee Re-enable apelink size optimization
  • ff955aa Make memcmp() and memchr() go fast again
  • 70155df Avoid linking win32 signals impl
  • 2b960bb Exclude strace from MODE=tiny builds

Cosmopolitan v3.1.1

29 Nov 10:30
b7e1dc8
Compare
Choose a tag to compare
  • 41c06c6 Make cosmocc 100x faster on MacOS
  • 43de12d Introduce forkpty()
  • cc5c531 Linux: Add cachestat, fchmodat2 syscalls (#958)
  • 0bffd09 Allow redbean to accept --assimilate option without complaining (#916)
  • 96185e1 Fix MODE=aarch64 cross-compiling
  • ca5e361 Don't show (win32 error 0)
  • 9cad66a Freshen bootstrap binaries for MacOS + SIP
  • 96f979d Rename makefiles BUILD.mk

Cosmopolitan v3.1

19 Nov 05:00
69faf1b
Compare
Choose a tag to compare

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.

Overview

This release fixes issues with the 3.0.x series. A new cosmo_dlopen() function is now provided that's good enough to load nontrivial dynamic libraries on all platforms except OpenBSD. Cosmos binaries are now being distributed on our new online service https://cosmo.zip/ that's operated by the Cosmopolitan authors. This release was made possible thanks to the testing and contribution efforts of our GitHub and Discord communities https://discord.gg/FwAVVu7eJ4. Thank you!

Changes

  • 5330442 Avoid APE fork bomb
  • 291103a Redesign cosmocc toolchain
  • 751d20d Fix nsync_mu_unlock_slow_() on Apple Silicon
  • 3ac473d Floating point parsing support for scanf family (#924)
  • 8caf1b4 Improve time/sleep accuracy on Windows
  • e4dea37 Make clock_nanosleep() cancel faster
  • 32b97f2 Improve execve() path argument munging
  • bcf268a Don't modify argument block on MacOS Arm64
  • 0863427 Make development more pleasant on MacOS Arm64
  • 48bd3d8 Fix sigaction() return handler address on XNU/BSD
  • 3e6d536 Correct misunderstanding with zip64 extra records
  • 0c89516 Fix unzip warning with apelink generated symtabs
  • f25beb3 Add architecture flag to zipobj
  • 736fdb7 Implement raise() with getcontext() / setcontext
  • bd56a9c Rename dlopen() to cosmo_dlopen()
  • f7cfe03 Fix dlopen() for FreeBSD and NetBSD
  • 529cb48 Improve dlopen() on Apple Silicon
  • dffee60 Run host compiler to create dlopen helper
  • e4584ac Get cosmo_dlopen() working better on System Five
  • ac125d3 Fix console copy/paste issue on Windows
  • e961385 Put more thought into Windows i/o polyfills
  • 7138399 Close Lua state before exiting redbean worker to allow GC to collect (#941)
  • 5c1fdc9 Fix session changeset procesing (reverting some of 0d748ad changes) (#949)
  • ddc08dc [metal] Make deathstar.com draw onto both VGA and serial consoles (#955)
  • eea601f [metal] Some minor fixes and tweaks (#933)
  • 545a8f4 Add more sched.h content
  • 7a9e176 Improve debug binary location detection
  • 68c7c9c Make strerror() conform more to other libc impls and introduce __clear_cache()
  • 8f5e516 Remove sync_file_range
  • 1351d3c Remove bool from public headers
  • 1c2e7c1 Introduce SIP_DISABLED compile option for ape-m1.c
  • 3b15d31 Fix #include <shared_mutex>
  • c6d3802 Add more fixes for new cosmocc toolchain
  • cdbd10c Introduce X86_CHECK() macro
  • d2f49ca Improve mkdeps
  • 15af5c2 Fix ucontext_t alignment in strict ansi mode
  • b8d1377 Give new wait4() another review pass
  • ea28f93 Support includes in monorepo
  • cc3e3de Make args replace ... only at the end of file (#909)

Known Issues

Shells

If you use zsh and have trouble running APE programs try sh -c ./prog or simply upgrade to zsh 5.9+ (since we patched it two years ago). The same is the case for Python subprocess, old versions of fish, etc.

Linux

Some Linux systems are configured to launch MZ executables under WINE or run-detectors. You can fix that by registering APE with binfmt_misc:

sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"

If things still aren't working, it's also possible to disable binfmt_misc as follows:

sudo sh -c 'echo -1 > /proc/sys/fs/binfmt_misc/cli'     # remove Ubuntu's MZ interpreter
sudo sh -c 'echo -1 > /proc/sys/fs/binfmt_misc/status'  # remove ALL binfmt_misc entries

WSL

WSL tries to run MZ executables as WIN32 binaries within the WSL environment. In order to make it safe to use Cosmopolitan software on WSL, run this:

sudo sh -c "echo -1 > /proc/sys/fs/binfmt_misc/WSLInterop"

Cosmopolitan v3.0.2

06 Nov 02:54
23d812f
Compare
Choose a tag to compare

Features

  • Introduce getifaddrs() 024be3b
  • Introduce very primitive dlopen() support 5e8c928
  • Make it possible to use APE Loader on Apple Silicon systems with SIP enabled a12ad17

Bug Fixes

  • Fix APE Loader CRT bugs which caused crashes for MacOS x86-64 users (#931)
  • Fix getcwd() on Windows which was causing weirdness with bash 1eb6484
  • Embed GNU TLS in Cosmos Emacs so M-x package-list-packages will work on Windows
  • Use /usr/local/bin/ape (instead of /usr/bin/ape) on Apple Silicon for systemwide APE.
  • Add database and statement readonly checks to sqlite in redbean (#914)
  • Make WIN32 i/o signals more atomic and longjmp() safe d7917ea
  • Support \n in /zip/.args files 585c86e
  • Make cosmocc -dumpmachine work

Upgrade Notes

If you've used ape-install or ape/ape-install.sh in the past (to install the system-wide APE Loader) then you need to run it again so that your system can use APE Loader v1.9. This new release of APE Loader fixes bugs. Apple M1 systems need it to run the APE binaries in this release..It's also backwards compatible with all APE and static ELF binaries ever made with Cosmo. Any of your own programs which you've compiled before on Apple Silicon which use execve() may need to be recompiled in order to run the latest APE executables unless you've installed a system-wide APE Loader.

It's recommended that cosmocc users run:

cd /opt/cosmo
rm -rf o/third_party/gcc
unzip -vl cosmocc-0.0.18.zip

To get the latest build of Cosmopolitan's toolchain.

Cosmopolitan v3.0.1

01 Nov 17:22
55d5d6b
Compare
Choose a tag to compare