jart/cosmopolitan
View on GitHub ↗ ★ 21,431 C
build-once run-anywhere c library
293 mentions on Hacker News by 135 people: 24 stories, 269 comments · first 2020-06-20 · latest 2026-10-11
20082026
-
…constants so you can absolutely use inlining if you like to live dangerously. For example: https://github.com/jart/cosmopolitan/blob/91f4167a45f811fde6... There really isn't any performance advantage to doing this, because the SYSCALL…
comment by jart · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
The amount of work that went to this is insane. She made a (full ?) implementation of libc: https://github.com/jart/cosmopolitan/tree/master/libc
comment by raphaelj · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
The are a few options but all require some effort https://github.com/jart/cosmopolitan/issues/27
comment by ZiiS · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
…it to use cosmopolitan.a when linking system call functions like read(), write(), etc. See https://github.com/jart/cosmopolitan Another option is if Free Pascal wants to write all the system call support from scratch, then doing that now…
comment by jart · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
…As far as I'm concerned, this is literal magic. Look at the magic numbers: https://github.com/jart/cosmopolitan/blob/37a4c70c3634862d8d... I could go on, but there's no binary portability comparison with any other language. And she h
comment by hprx · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
…using it, since it lets your binaries run on Windows, Mac, FreeBSD, OpenBSD, and NetBSD too. https://github.com/jart/cosmopolitan See https://justine.lol/ape.html which talks about how the executable format is also a valid zip file, which…
comment by jart · 2021-02-25 · in Static Executables with SBCL v2 -
…that were too slow even during the days where multitenancy on a single machine mattered. See https://github.com/jart/cosmopolitan and https://github.com/jart/cosmopolitan/issues/20#issuecomment-... to learn more.
comment by jart · 2021-02-12 · in Running unmodified Linux programs on Fuchsia -
…See also this issue where people have requested hardware accelerated graphics: https://github.com/jart/cosmopolitan/issues/35 Cosmopolitan can be doing more if game studios are willing to back the project. Remember how John Carmack dippe
comment by jart · 2021-02-12 · in How Fat Does a Fat Binary Need to Be? -
…is the most popular language and Cosmopolitan has an embedded JavaScript interpreter. See https://github.com/jart/cosmopolitan/blob/master/examples/he... where we built a 300kb Actually Portable Executable + ZIP file polyglot that…
comment by jart · 2021-02-12 · in How Fat Does a Fat Binary Need to Be? -
Here's something you can paste into your Linux terminal to get started: git clone https://github.com/jart/cosmopolitan cd cosmopolitan make -j8 o/third_party/chibicc/chibicc.com -include libc/integral/normalize.inc -o hello.com.dbg…
comment by jart · 2021-02-11 · in How Fat Does a Fat Binary Need to Be? -
…yet. Lots of GNU extensions and an integrated assembler were added. You can read about them here: https://github.com/jart/cosmopolitan/blob/master/third_party... I have automated tests which do a two-stage build and test on every platform…
comment by jart · 2021-02-11 · in How Fat Does a Fat Binary Need to Be? -
…all operating systems rather than just Linux. See https://justine.lol/cosmopolitan/index.html and https://github.com/jart/cosmopolitan Trapping (SYSCALL/INT) is a loose binding. The kernel can evolve all it wants internally. It can…
comment by jart · 2021-02-04 · in Go 1.16 will make system calls through Libc on OpenBSD -
…How readable is the source code to Blinkenlights? See for yourself. Here's the ALU code: https://github.com/jart/cosmopolitan/blob/master/tool/build/...
comment by jart · 2021-01-29 · in The Evolution of the QEMU Translator -
▲ 6
Cosmopolitan Libc v0.1 Releasedstory by jart · 2021-01-29 · 1 comment
-
…which helps Mac/Linux/Windows/FreeBSD developers write software that's compatible with OpenBSD: https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s... As you can see, I've studied these systems a lot and I've got to say that…
comment by jart · 2021-01-27 · in Heap-based buffer overflow in Sudo -
…privileges since spectre has made the performance costs of having an operating system too high: https://github.com/jart/cosmopolitan/issues/20#issuecomment-...
comment by jart · 2021-01-27 · in Heap-based buffer overflow in Sudo -
…shell) to support the Actually Portable Executable format used by the Cosmopolitan C Library. See https://github.com/jart/cosmopolitan/issues/23#issuecomment-... and the recent HN thread here: https://news.ycombinator.com/item?id=25556286
comment by jart · 2021-01-17 · in FreeBSD 2020 Q4 Status Report -
…you can always use SUPPORT_VECTOR to squeeze it down to the order of a 4kb ELF executable. See: https://github.com/jart/cosmopolitan/blob/1df136323be2ae806f...
comment by jart · 2020-12-29 · in Cosmopolitan Libc: build-once run-anywhere C library -
Author here. tcc is tired and chibicc is wired. Check out https://github.com/jart/cosmopolitan/blob/master/third_party... where I've been working on building a 300kb actually portable executable c11 compiler + assembler + linker that…
comment by jart · 2020-12-28 · in Cosmopolitan Libc: build-once run-anywhere C library -
…on the subset of numbers that systems share in common. In other words, the really old ones. https://github.com/jart/cosmopolitan/blob/master/libc/sysv/c...
comment by jart · 2020-12-28 · in Cosmopolitan Libc: build-once run-anywhere C library -
…curious, here's the link to memcpy() as it's actually implemented in the Cosmopolitan headers: https://github.com/jart/cosmopolitan/blob/de09bec215675e9b0b... One thing that the web page doesn't mention (for the sake of simplicity) is that…
comment by jart · 2020-12-28 · in Cosmopolitan Libc: build-once run-anywhere C library -
…provides a 3kb x86 instruction length decoder that supports all past, present, and future ISAs: https://github.com/jart/cosmopolitan/blob/master/third_party... The Cosmopolitan codebase also provides a debugger / emulator for i8086 +…
comment by jart · 2020-12-28 · in Cosmopolitan Libc: build-once run-anywhere C library -
…which uses an LP64 data model. That hasn't impacted its ability to use the WIN32 API. See https://github.com/jart/cosmopolitan/tree/master/libc/nt where WIN32 API functions are declared using uint32_t, int64_t, etc. It works great. I…
comment by jart · 2020-12-28 · in Cosmopolitan Libc: build-once run-anywhere C library -
…happen. Cosmopolitan implements a simplified version of the Address Sanitizer (ASAN) runtime. See https://github.com/jart/cosmopolitan/blob/master/libc/log/as... I've been systematically working towards using it to vet the entire codebase.…
comment by jart · 2020-12-28 · in Cosmopolitan Libc: build-once run-anywhere C library -
…trying to support like WYSE terminals or actual teletypewriters. Here's the dox on the subject: https://github.com/jart/cosmopolitan/blob/1fc91f3/tool/build... > If a user hits Ctrl-C during clean-up operations that might take a long time,…
comment by jart · 2020-12-21 · in Command Line Interface Guidelines -
Sorry here's what a build file looks like, which should hopefully clarify: https://github.com/jart/cosmopolitan/blob/master/libc/mem/me... As you can see, it's just vanilla make. The package program is just a helper that checks to make…
comment by jart · 2020-11-29 · in Please – A cross-language build system -
…that checks some build configuration, augments C and postprocesses executable files? (Looking at https://github.com/jart/cosmopolitan it's an interesting hack. Might be useful in some cases, for example command-line tools like git.) Have…
comment by s_gourichon · 2020-11-28 · in Please – A cross-language build system -
…stays sanely formed. It totally got make working like a dream in a way I simply hadn't seen before. https://github.com/jart/cosmopolitan/blob/master/tool/build/...
comment by jart · 2020-11-28 · in Please – A cross-language build system -
…supported. CGA is kind of just a uint16_t[20][80] array for personal computers. See also: https://github.com/jart/cosmopolitan/blob/ea0b5d9/tool/build... You're absolutely right that the inconsistencies with textmode used to be about as…
comment by jart · 2020-11-28 · in Bring back the ease of 80s and 90s personal computing -
…ps://justine.storage.googleapis.com/ape.html It even supports fork() on windows as of a few days ago: https://github.com/jart/cosmopolitan/commit/db33973e0aae7ffc...
comment by jesuscyborg · 2020-11-17 · in Best aspects of C -
…this day and age like being able to build once run anywhere TUI apps for Windows/Mac/Linux/BSD. See https://github.com/jart/cosmopolitan/commit/9e3e985ae5fdccc9... and https://justine.storage.googleapis.com/ape.html
comment by jart · 2020-10-23 · in Rejuvenating Autoconf -
…days to retool the standard x86_64 compiler to generate 16-bit boot code for The LISP Challenge. https://github.com/jart/cosmopolitan/blob/b6793d42d5ed6b4f78...
comment by jart · 2020-10-01 · in Defer Reference Implementation for C -
Thanks for the feedback! The README has now been updated: https://github.com/jart/cosmopolitan/commit/fd22e55b42503093... It could use more work though. See also https://justine.storage.googleapis.com/ape.html and the HN thread about it…
comment by jart · 2020-09-30 · in Defer Reference Implementation for C -
…That should just work with GCC and Clang. That code is originally from the Cosmopolitan C Library ( https://github.com/jart/cosmopolitan ) so check it out if you like the Gist and want more! Please note the macro operates at function call…
comment by jart · 2020-09-30 · in Defer Reference Implementation for C -
…I put together recently that builds over 9000 objects, 72 libraries, and a few hundred executables. https://github.com/jart/cosmopolitan/blob/master/Makefile The interesting part I've noticed is tuning the makefile so it correctly orders…
comment by jart · 2020-09-04 · in The Quest to the Perfect Makefile -
You can read more in the libc source. The readme gives an overview. https://github.com/jart/cosmopolitan/tree/master/libc
comment by ChrisSD · 2020-08-24 · in αcτµαlly pδrταblε εxεcµταblε -
He talks about it a bit as the "magic numbers". You can see the big table: https://github.com/jart/cosmopolitan/blob/c91b3c50068224929c... I guess there's also syscall emulation stubs for Windows but since he only supports "stdio and…
comment by Mathnerd314 · 2020-08-24 · in αcτµαlly pδrταblε εxεcµταblε -
…and distribute tiny native portable programs (like Kilo!) using hermetically sealed tools. See https://github.com/jart/cosmopolitan
comment by jart · 2020-07-01 · in The End of the Redis Adventure -
▲ 2
Cosmopolitan: Fast portable static native textmode executable containersstory by ingve · 2020-06-27 · 0 comments
-
Static linking ( https://github.com/jart/cosmopolitan ) jart@debian:~/cosmo$ make -j12 CPPFLAGS+=-DIM_FEELING_NAUGHTY MODE=tiny o/tiny/examples/hello.com jart@debian:~/cosmo$ ls -sh o/tiny/examples/hello.com 20K o/tiny/examples/hello.com…
comment by jart · 2020-06-26 · in Dynamic linking -
…like native machine learning code. For example one build system that enables that use case is: https://github.com/jart/cosmopolitan At best these new POWER or ARM architecture Apple PCs are going to be like a C-class Mercedes. So I'm…
comment by jart · 2020-06-22 · in Apple announces it will switch to its own processors for future Macs -
…also taught us last year that 4kb of code is all it takes to decode every x86 isa (i.e. 1977-2020) https://github.com/jart/cosmopolitan/blob/d51409c/third_part... Thanks Mark Charney. https://github.com/intelxed/xed
comment by jart · 2020-06-22 · in Domain-Specific Hardware Accelerators -
…I want is stdio and math; how can I do that without all the breaking builds and broken hearts?" https://github.com/jart/cosmopolitan Please consider supporting us. These old technologies are widely supported and have stood the test of…
comment by jart · 2020-06-20 · in Rediscovering the beauty of text on the internet