summaryrefslogtreecommitdiff
path: root/src/user/lib/elfreloc.c
diff options
context:
space:
mode:
authordzwdz2023-02-24 22:41:50 +0100
committerdzwdz2023-02-24 22:41:50 +0100
commit5faf16e48457f3ea1dda7af76f9c59b007a054f8 (patch)
tree1ca1e620b778e6d175a7e2fb77792cc0df0d258a /src/user/lib/elfreloc.c
parentfca80df9e638a7d68147d91cbffda95aed96ab5c (diff)
toolchain: partially set up the sysroot
Diffstat (limited to 'src/user/lib/elfreloc.c')
-rw-r--r--src/user/lib/elfreloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/user/lib/elfreloc.c b/src/user/lib/elfreloc.c
index cf740f5..632f60f 100644
--- a/src/user/lib/elfreloc.c
+++ b/src/user/lib/elfreloc.c
@@ -5,7 +5,7 @@ __attribute__((visibility("hidden")))
extern struct Elf64_Dyn _DYNAMIC[];
__attribute__((visibility("hidden")))
-extern char _image_base[];
+extern char __executable_start[];
static struct Elf64_Dyn *dyn_gettag(Elf64_Xword tag) {
for (size_t i = 0;; i++) {
@@ -27,12 +27,12 @@ void elf_selfreloc(void) {
size_t relasz = dyn_gettag(DT_RELASZ)->d_val;
size_t relaent = dyn_gettag(DT_RELAENT)->d_val;
for (size_t o = 0; o < relasz; o += relaent) {
- struct Elf64_Rela *r = (void*)_image_base + rela_tag->d_ptr + o;
- uintptr_t *target = (void*)_image_base + r->r_offset;
+ struct Elf64_Rela *r = (void*)__executable_start + rela_tag->d_ptr + o;
+ uintptr_t *target = (void*)__executable_start + r->r_offset;
switch (ELF64_R_TYPE(r->r_info)) {
case R_X86_64_RELATIVE:
- *target = (uintptr_t)&_image_base + r->r_addend;
+ *target = (uintptr_t)&__executable_start + r->r_addend;
break;
default:
_klogf("elf: unsupported relocation type\n");