Re:αcτµαlly pδrταblε εxεcµταblε
by krackers on Sunday August 23, 2020 @11:03PM
(#24257218)
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.
[ Parent
| on HN ]
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?
Re:αcτµαlly pδrταblε εxεcµταblε
by yjftsjthsd-h on Monday August 24, 2020 @09:45AM
(#24260565)
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.
Re:αcτµαlly pδrταblε εxεcµταblε
by Mathnerd314 on Sunday August 23, 2020 @11:14PM
(#24257255)
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.
The author is a "she": https://en.wikipedia.org/wiki/Justine_Tunney
Re:αcτµαlly pδrταblε εxεcµταblε
by Rebelgecko on Sunday August 23, 2020 @11:39PM
(#24257353)
"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
Re:αcτµαlly pδrταblε εxεcµταblε
by jessaustin on Sunday August 23, 2020 @11:50PM
(#24257398)
How on earth has that article met the "notability" threshold?
Well she owns/owned the Occupy Wallstreet twitter account.
Re:αcτµαlly pδrταblε εxεcµταblε
by cringepirate on Sunday August 23, 2020 @11:57PM
(#24257419)
I remember this person, she was on Gavin McInnes podcast quite a while ago. Here is the interview:
Listening to her talk, she seems a pretty standard run of the mill Libertarian with a blend of technocrat.
Re:αcτµαlly pδrταblε εxεcµταblε
by userbinator on Monday August 24, 2020 @12:29AM
(#24257524)
Reading that page, and this HN article, reminds me of a classic phrase: "There is a fine line between genius and insanity."
Re:αcτµαlly pδrταblε εxεcµταblε
by GoblinSlayer on Monday August 24, 2020 @06:44AM
(#24259332)
>technocratic fascist
>zealous googler
At this rate GPL2 will stand for Google Public License.