Created
October 28, 2019 09:09
-
-
Save metanest/82bc88feb73bbb297a5b77b81ad2c69c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
ssize_t __sys_write(int, const void *, size_t); | |
void __sys_exit(int); | |
void hoge_start(void) { | |
char const msg[] = "hello\n"; | |
void **user_stack_ptr = __builtin_frame_address(0); | |
*(user_stack_ptr--) = &&cont1; | |
goto hello; __builtin_unreachable(); | |
cont1: | |
*(user_stack_ptr--) = &&cont2; | |
goto hello; __builtin_unreachable(); | |
cont2: | |
__sys_exit(0); __builtin_unreachable(); | |
hello: | |
__sys_write(1, msg, sizeof(msg)-1); | |
goto **(++user_stack_ptr); | |
__builtin_unreachable(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment