Skip to content

Instantly share code, notes, and snippets.

@ashafq
Last active October 27, 2023 15:51
Show Gist options
  • Save ashafq/41a0ef4ef626850edcec96b9e9c1b2ef to your computer and use it in GitHub Desktop.
Save ashafq/41a0ef4ef626850edcec96b9e9c1b2ef to your computer and use it in GitHub Desktop.
/*
* This work is released under the Creative Commons CC0 1.0 Universal License.
*
* Must compile with GCC for x86_64 target:
* gcc -fno-pie -fno-stack-protector -o hello hello.c && ./hello
*
* Last tested: 2023-10-27, on gcc-13.2
* https://godbolt.org/z/o8o97Pjca
*/
__attribute__((section(".text")))
const char main[] =
"\xb8\x01\0\0\0"
"\xbf\x01\0\0\0"
"\x67\x8d\x35\x0a\0\0\0"
"\xba\x13\0\0\0"
"\x0f\x05"
"\x31\xc0"
"\xc3"
"\xf0\x9f\x92\xa9 "
"Hello, world!\n"
"Who says main() has to be a function?";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment