summaryrefslogtreecommitdiff
path: root/src/user/lib
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
parentfca80df9e638a7d68147d91cbffda95aed96ab5c (diff)
toolchain: partially set up the sysroot
Diffstat (limited to 'src/user/lib')
-rw-r--r--src/user/lib/_start2.c4
-rw-r--r--src/user/lib/elfreloc.c8
-rw-r--r--src/user/lib/include/limits.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/user/lib/_start2.c b/src/user/lib/_start2.c
index 954fcb4..f55feab 100644
--- a/src/user/lib/_start2.c
+++ b/src/user/lib/_start2.c
@@ -10,7 +10,7 @@
int main(int argc, char **argv, char **envp);
__attribute__((visibility("hidden")))
-extern char _image_base[];
+extern char __executable_start[];
const char *shortname(const char *path) {
if (!path) return "unknown program";
@@ -39,7 +39,7 @@ _Noreturn void _start2(struct execdata *ed) {
progname = shortname(ed->argv[0]);
setprogname(progname);
- _klogf("_start2 %s %p", progname, _image_base);
+ _klogf("_start2 %s %p", progname, __executable_start);
exit(main(ed->argc, ed->argv, ed->envp));
}
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");
diff --git a/src/user/lib/include/limits.h b/src/user/lib/include/limits.h
index 065f8e0..3d74ded 100644
--- a/src/user/lib/include/limits.h
+++ b/src/user/lib/include/limits.h
@@ -1,5 +1,5 @@
#pragma once
-#include_next <limits.h>
#include <camellia/path.h> // just for PATH_MAX
+// #include_next <limits.h>
#define _POSIX2_RE_DUP_MAX 255