diff options
author | dzwdz | 2022-07-26 22:40:28 +0200 |
---|---|---|
committer | dzwdz | 2022-07-26 22:40:28 +0200 |
commit | 4aee2f759ab7bf2ad9534941afef0195040ba5db (patch) | |
tree | 8799d4dac4bd82cc2274e4a8246e6891356b1511 /src/user/app/testelf | |
parent | d54dcb2efc4be344900a7721ac4b65b47840c5d2 (diff) |
user/libc: a _start that automatically selfrelocates PIEs
Diffstat (limited to 'src/user/app/testelf')
-rw-r--r-- | src/user/app/testelf/main.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/user/app/testelf/main.c b/src/user/app/testelf/main.c index 93a5e11..a3e54b8 100644 --- a/src/user/app/testelf/main.c +++ b/src/user/app/testelf/main.c @@ -1,18 +1,9 @@ -#include <camellia/syscalls.h> #include <stdio.h> -#include <user/lib/elf.h> -#include <user/lib/elfload.h> -#include <unistd.h> const char *str = "Hello!\n", *str2 = "World.\n"; -__attribute__((visibility("hidden"))) -extern char _image_base[]; - int main(void) { - elf_selfreloc(); - printf("loaded at %x\n", &_image_base); - printf(str); - printf(str2); - exit(0); + printf("elftest's &main == 0x%x\n", &main); + printf("%s%s", str, str2); + return 0; } |