Doesn’t seem to work on Mac OS X (Darwin Kernel Version 13.4.0). Compiles with gcc but terminates with segfault 11
Are you going through the steps to generate asm that’s appropriate for OS X or just using the asm section from the article? The numbers for OS X’s syscalls probably differ from the Linux ones used in the article and the segment names in OS X’s Mach-O likely differ from those in Linux/ELF, perhaps among other differences.
The syscalls will definitely be a little different. In addition to write being 4 on OSX (instead of 1), there is the additional complexity of class-specifiers in the upper bits. The code in this article, though, should give you everything you need.