Hacker News new | past | comments | ask | show | jobs | submit login
The Nitty Gritty of “Hello World” on macOS (2014) (reinterpretcast.com)
47 points by luu 5 months ago | hide | past | favorite | 7 comments



I wrote a blog post on a similar topic that goes into a bit more detail in some areas: https://adrummond.net/posts/macho There have also been some significant changes since 2014.


First time I've seen that style of visualization for the byte code. Really effective way of breaking it down though, and allows a good way of visually seeing sections of code.


It's a pretty well known technique. BinViz.io[1] is a online viewer that lets you view arbitrary binaries, Veles[2] is a stand alone viewer.

They're super neat for first-pass "is this structured or random data" analysis of binary files.

1: https://binvis.io/ 2: https://codisec.com/veles/


Shouldn't this be

    fwrite("Hello, world!\n", 1, 14, stdout)
instead? After all, the string is 14 characters in length, not including the terminating NUL char. What does writing a NUL char to stdout do, anyways?


You are correct!

To answer your question, writing a NUL char to stdout is no problem. Some utilities can actually use it as a delimiter since it’s so uncommon. I think most shells would just print nothing on the screen.


Oops, quite right. I’ll try and push up a correction later today. Thanks!





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

Search: