Hacker News new | ask | show | jobs
by oguz-ismail 728 days ago

    int
    main(void) {
        register const char *msg asm("x1") = "hello, world!\n";
        asm (
            "mov w0, #1\n"
            "mov w2, #14\n"
            "mov w16, #4\n"
            "svc #128\n"
            :
            : "r" (msg)
        );
    }
2 comments

How does one compile this?

EDIT: my bad, my source had a typo - it's as easy as you'd think:

  $ cc hello.c -o hello
  $ ./hello
thanks!