4 ms·
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
by krackers 6y ago
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.
- Mathnerd314 6y agoHe talks about it a bit as the "magic numbers". You can see the big table: https://github.com/jart/cosmopolitan/blob/c91b3c50068224929cd4d3ddf36c5a10254cbd9c/libc/sysv/consts.sh 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.
- reallyeli 6y agoThe author is a "she": https://en.wikipedia.org/wiki/Justine_Tunney https://en.wikipedia.org/wiki/Justine_Tunney
- Rebelgecko 6y ago"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
- jessaustin 6y agoHow on earth has that article met the "notability" threshold?
- mlindner 6y agoWell she owns/owned the Occupy Wallstreet twitter account.
- cringepirate 6y agoI remember this person, she was on Gavin McInnes podcast quite a while ago. Here is the interview: https://www.dailymotion.com/video/x2ke4nq https://www.dailymotion.com/video/x2ke4nq
- mlindner 6y agoListening to her talk, she seems a pretty standard run of the mill Libertarian with a blend of technocrat.
- userbinator 6y agoReading that page, and this HN article, reminds me of a classic phrase: "There is a fine line between genius and insanity."
- deleted 6y ago[deleted]
- GoblinSlayer 6y ago>technocratic fascist >zealous googler At this rate GPL2 will stand for Google Public License.
- ChrisSD 6y agoYou can read more in the libc source. The readme gives an overview. https://github.com/jart/cosmopolitan/tree/master/libc https://github.com/jart/cosmopolitan/tree/master/libc
- tbodt 6y agoIt 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.
- krackers 6y agoAh thank you. And I presume the qemu part is optional, used only when the target platform is non x86?
- StavrosK 6y agoThat means you can't copy the executable after executing once and have it run on Windows, correct?
- shandor 6y agoProbably the rewriting is only done on the program loaded into RAM?
- StavrosK 6y agoHmm, possibly, though that wouldn't really make sense, why not just execute itself at that point?
- yjftsjthsd-h 6y agoNo, 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.