Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can someone eli5 how this works? I sort of get that you can create one big binary file with all the necessary file headers for each platform and the actual x86 code being shared, but what about stuff like syscalls? The post also lost me when it started mentioning the need for shell scripts and emulators.


It turns out to be impossible to create a file that is simultaneously a valid ELF and Windows PE. The solution to this is to make a file that is simultaneously a valid PE and shell script, and have the shell script overwrite the start of the file with an ELF header and re-exec itself.


That means you can't copy the executable after executing once and have it run on Windows, correct?


Probably the rewriting is only done on the program loaded into RAM?


No, there's a discussion upthread about running on Darwin that specifically says you have to run as `bash ./foo` first time and `./foo` thereafter because it overwrites on disk.


Hmm, possibly, though that wouldn't really make sense, why not just execute itself at that point?


Ah thank you. And I presume the qemu part is optional, used only when the target platform is non x86?


You can read more in the libc source. The readme gives an overview.

https://github.com/jart/cosmopolitan/tree/master/libc


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 sockets" maybe not.



"Tunney has described Occupy Wall Street as a far-left movement.[13] Her former comrades have described her as a technocratic fascist.[14]"

Wow, although I'm not familiar with her, this wiki article seems a bit melodramatic


How on earth has that article met the "notability" threshold?


Well she owns/owned the Occupy Wallstreet twitter account.


I remember this person, she was on Gavin McInnes podcast quite a while ago. Here is the interview:

https://www.dailymotion.com/video/x2ke4nq


Listening to her talk, she seems a pretty standard run of the mill Libertarian with a blend of technocrat.


Reading that page, and this HN article, reminds me of a classic phrase: "There is a fine line between genius and insanity."


>technocratic fascist

>zealous googler

At this rate GPL2 will stand for Google Public License.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: