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
-
…verify the DEPS list for each static archive specifies all of its directly-reachable dependencies. https://github.com/jart/cosmopolitan/blob/b8f38cf55d84bac7d7... See example build config here: https://github.com/jart/cosmopolitan/blob/b8f3…
comment by jart · 2021-05-17 · in Cosmopolitan Libc 1.0 -
…then remaps itself so it can restore the original APE header and modify the ZIP central directory. https://github.com/jart/cosmopolitan/blob/b8f38cf55d84bac7d7... That said, I still upvote on VirusTotal each executable I publish, so you…
comment by jart · 2021-05-17 · in Cosmopolitan Libc 1.0 -
Yes, I think that's correct. However, see: https://github.com/jart/cosmopolitan/issues/90
comment by slimsag · 2021-05-17 · in Cosmopolitan Libc 1.0 -
…The difference is probably more pronounced in functions that do block copying like https://github.com/jart/cosmopolitan/blob/master/libc/str/st... (which actually uses the ANSITRINSICS library). For more complicated functions like this:…
comment by jart · 2021-05-16 · in Verifying Vectorized Rust Revisited -
…excellent documentation to anyone who wants to understand the great mystery of vector instructions: https://github.com/jart/cosmopolitan/tree/master/libc/intrin A good example is PUNPCKLBW which is such an important instruction but a name…
comment by jart · 2021-05-16 · in Verifying Vectorized Rust Revisited -
…that does less things. For example, here's the ASAN runtime that's used for the redbean web server: https://github.com/jart/cosmopolitan/blob/master/libc/intrin...
comment by jart · 2021-05-08 · in The Byte Order Fiasco -
…modern c++ practices to be honest, and that's something I talk about in one of my famous hacks: https://github.com/jart/cosmopolitan/blob/4577f7fe11e5d8ef0a...
comment by jart · 2021-05-08 · in The Byte Order Fiasco -
2 minutes and 7 seconds https://github.com/jart/cosmopolitan/runs/2482398460 on travis for a repository that builds 14,479 objects, 67 libraries, and 456 static executables, 284 of which are test executables which are run too. If I want to…
comment by jart · 2021-05-01 · in Ask HN: How Long Is Your CI Process? -
Thanks! https://github.com/jart/cosmopolitan/commit/cef08d47b652bd98...
comment by jart · 2021-05-01 · in Redbean 0.4 -
Author here. I agree. I've added the feature you've requested as a -M INT flag in https://github.com/jart/cosmopolitan/commit/1966369e8eaa894b... and pushed a new 0.4.1 release to the website https://justine.lol/redbean/index.html
comment by jart · 2021-05-01 · in Redbean 0.4 -
…workaround soon. If you're curious about the Makefile code used to generate the demo zip, see here: https://github.com/jart/cosmopolitan/blob/c029e83dd893b733c1...
comment by jart · 2021-05-01 · in Redbean 0.4 -
…cubic, so even for a fragmented messages, it only needs to consider each character a single time: https://github.com/jart/cosmopolitan/blob/master/net/http/pa...
comment by jart · 2021-04-02 · in An HTTP server in a single .c file -
You are right. Indeed it falls back to QEMU on non-x86_64 https://github.com/jart/cosmopolitan/issues/73#issuecomment-... Running QEMU on a modem would be another hack for a day :)
comment by imhoguy · 2021-04-02 · in This Blog is now hosted on a GPS/LTE modem -
…achieved a decades-long consensus, and ignoring the APIs For a link with the actual numbers: https://github.com/jart/cosmopolitan/blob/667ab245fe0326972b...
comment by enriquto · 2021-03-28 · in Conway's Game of Life TUI GUI -
…in this thread, and you've written an assembler of your own, this might be of interest to you: https://github.com/jart/cosmopolitan/blob/master/third_party... Your work was brought to my attention maybe a year and a half ago and I think…
comment by jart · 2021-03-20 · in SubX: A minimalist assembly language for a subset of the x86 ISA (2019) -
…indirect branch with overlapping moves. Here's what that looks like in "pure c" for gcc and clang. https://github.com/jart/cosmopolitan/blob/master/libc/str/me... memcpy is hard to implement in pure c99 because aliasing pointers to…
comment by jart · 2021-03-20 · in ZPL: (Almost) C99 Powerkit -
…more powerful technique is to use Numerology to identify the consensus that already exists. See https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s... and https://justine.lol/ape.html
comment by jart · 2021-03-20 · in Senior Engineers Build Consensus (2019) -
Actually Cosmopolitan doesn't support threads so Java, Go and Rust won't work at all on top of it. https://github.com/jart/cosmopolitan/blob/master/libc/runtim...
comment by roca · 2021-03-01 · in Actually Portable Executables -
Fixed for me (macOS) in this[1] commit. [1] https://github.com/jart/cosmopolitan/commit/218ef491476f15ab...
comment by fastball · 2021-02-28 · in Show HN: Redbean – Single-file distributable web server -
It doesn't appear to be supported in their libc implementation: https://github.com/jart/cosmopolitan/blob/d7ac16a9ed56ebdc70...
comment by surajrmal · 2021-02-28 · in Actually Portable Executables -
…are also zip files, the interpreter can even load its own sources from the binary itself. https://github.com/jart/cosmopolitan/blob/master/examples/he...
comment by matheusmoreira · 2021-02-28 · in Actually Portable Executables -
…GitHub issue that's tracking progress on the changes that need to be made based on what we learned: https://github.com/jart/cosmopolitan/issues/61
comment by jart · 2021-02-28 · in Actually Portable Executables -
Yup. See https://justine.lol/blinkenlights/blinkenlights-windows.png and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... and…
comment by jart · 2021-02-27 · in Actually Portable Executable -
…sbcl? I have good news for you. I did exactly that in cosmopolitan's vendored fork of chibicc here: https://github.com/jart/cosmopolitan/blob/master/third_party... I went on a coding rampage back in December, adding to chibicc pretty much…
comment by jart · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
…couldn't properly optimize memcpy. I wonder how it handles system calls. Let me check the source... https://github.com/jart/cosmopolitan/blob/master/tool/build/... https://github.com/jart/cosmopolitan/blob/master/tool/build/... > void…
comment by matheusmoreira · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
…and http://reddit.com/r/osdev Those concepts are implemented in the Cosmopolitan codebase here: https://github.com/jart/cosmopolitan/blob/master/ape/ape.S That file runs a few hundred lines of old school assembly in order to bring us into…
comment by jart · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
…driver script will try to run the binary using QEMU (which has to be installed and on the path): https://github.com/jart/cosmopolitan/blob/40291c9db386d8a952... If i have understood how the portability works, it would be pretty…
comment by twic · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
Someone already reported the same https://github.com/jart/cosmopolitan/issues/56
comment by johnx123-up · 2021-02-26 · in Show HN: Redbean – Single-file distributable web server -
…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 -
…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