Hacker GitHub

← All repos

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

Mentions per year 293 mentions · busiest year 2021 (69)
20082026
  1. …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
  2. …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
  3. 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
  4. …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
  5. …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
  6. …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
  7. …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
  8. 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?
  9. Thanks! https://github.com/jart/cosmopolitan/commit/cef08d47b652bd98...
    comment by jart · 2021-05-01 · in Redbean 0.4
  10. 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
  11. …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
  12. …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
  13. 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 :)
  14. …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
  15. …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…
  16. …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
  17. …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
  18. 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
  19. Fixed for me (macOS) in this[1] commit. [1] https://github.com/jart/cosmopolitan/commit/218ef491476f15ab...
  20. 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
  21. …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
  22. …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
  23. 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
  24. …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…
  25. …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…
  26. …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…
  27. …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…
  28. Someone already reported the same https://github.com/jart/cosmopolitan/issues/56
  29. …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…
  30. 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
  31. The are a few options but all require some effort https://github.com/jart/cosmopolitan/issues/27
  32. …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…
  33. …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
  34. …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
  35. …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.
  36. …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
  37. …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…
  38. 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…
  39. …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…
  40. …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…
  41. …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
  42. …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
  43. …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
  44. …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
  45. …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...
  46. 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…
  47. …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...
  48. …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…
  49. …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 +…
  50. …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…