Skip to content

Instantly share code, notes, and snippets.

@makenowjust
Created June 22, 2014 04:31
Show Gist options
  • Save makenowjust/784958cd662775636998 to your computer and use it in GitHub Desktop.
Save makenowjust/784958cd662775636998 to your computer and use it in GitHub Desktop.
こんなボクでもやっとC言語でHello, World!が書けるようになりました! ref: http://qiita.com/make_now_just/items/e7a92a64a613a50ea698
const char main[]="H1\xc0H\xff\xc0H\x89\xc7H1\xd2H\2155\xb\0\0\0\xb2\xe\xf\5\xb0\x3cH1\xff\xf\5Hello, World!\n";
const char main[] =
/* main: */
"\x48\x31\xc0" /* xor %rax, %rax */
"\x48\xff\xc0" /* inc %rax */
"\x48\x89\xc7" /* mov %rax, %rdi */
"\x48\x31\xd2" /* xor %rdx, %rdx */
"\x48\x8d\x35\x0b\x00\x00\x00" /* lea msg(%rip), %rsi */
"\xb2\x0e" /* mov $14, %dl */
"\x0f\x05" /* syscall */
"\xb0\x3c" /* mov $60, %ral */
"\x48\x31\xff" /* xor %rdi, %rdi */
"\x0f\x05" /* syscall */
/* msg: */
"Hello, World!\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment