Skip to content

Instantly share code, notes, and snippets.

@iwagaki
Created January 27, 2015 09:35
Show Gist options
  • Save iwagaki/f9e1d26560f941362617 to your computer and use it in GitHub Desktop.
Save iwagaki/f9e1d26560f941362617 to your computer and use it in GitHub Desktop.
gcc hello world
#include <stdio.h>
__attribute__((section(".plt"))) main;
__attribute__((constructor, destructor)) void _() {
if (main) {
__attribute__((cleanup(puts))) char _[] = "world!";
} else {
__attribute__((cleanup(printf))) char _[] = "Hello, ";
main = 0xc3;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment