summaryrefslogtreecommitdiff
path: root/src/user
diff options
context:
space:
mode:
Diffstat (limited to 'src/user')
-rw-r--r--src/user/app/netstack/netstack.c2
-rw-r--r--src/user/app/tests/tests.c4
-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
-rw-r--r--src/user/linker.ld2
6 files changed, 10 insertions, 12 deletions
diff --git a/src/user/app/netstack/netstack.c b/src/user/app/netstack/netstack.c
index 296fee2..55b716a 100644
--- a/src/user/app/netstack/netstack.c
+++ b/src/user/app/netstack/netstack.c
@@ -26,8 +26,6 @@ void network_thread(void *arg) { (void)arg;
void fs_thread(void *arg);
-__attribute__((visibility("hidden")))
-extern char _image_base[];
int main(int argc, char **argv) {
if (argc < 4) {
eprintf("usage: netstack iface ip gateway");
diff --git a/src/user/app/tests/tests.c b/src/user/app/tests/tests.c
index 2cb97cd..5cba682 100644
--- a/src/user/app/tests/tests.c
+++ b/src/user/app/tests/tests.c
@@ -3,7 +3,7 @@
#include <unistd.h>
__attribute__((visibility("hidden")))
-extern char _image_base[];
+extern char __executable_start[];
FILE *fail_trig;
@@ -15,7 +15,7 @@ void run_test(void (*fn)()) {
} else {
/* successful tests must return 0 */
if (_sys_await() != 0) {
- test_failf("%p, base %p", (void*)((void*)fn - (void*)_image_base), _image_base);
+ test_failf("%p, base %p", (void*)((void*)fn - (void*)__executable_start), __executable_start);
}
}
}
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
diff --git a/src/user/linker.ld b/src/user/linker.ld
index e638289..4925448 100644
--- a/src/user/linker.ld
+++ b/src/user/linker.ld
@@ -2,7 +2,7 @@ ENTRY(_start)
SECTIONS
{
- _image_base = .;
+ __executable_start = .;
.text BLOCK(4K) : ALIGN(4K)
{
*(.text)