aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr/klibc/arch/riscv64/MCONFIG9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr/klibc/arch/riscv64/MCONFIG b/usr/klibc/arch/riscv64/MCONFIG
index 340610861c9e5..717aedaadea81 100644
--- a/usr/klibc/arch/riscv64/MCONFIG
+++ b/usr/klibc/arch/riscv64/MCONFIG
@@ -13,8 +13,13 @@ KLIBCOPTFLAGS += -g
endif
KLIBCBITSIZE = 64
-# Normal binaries start at 64 KB, so start the libary at 2 MB.
-KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x00200000
+# Normal binaries start at 64 kiB. Jumps can use either a single
+# instruction with offset of ±1 MiB, or two instructions with offset
+# of ±2 GiB. Putting klibc.so close above the executable can cause
+# breakage, so instead swap them around: klibc.so at 64 kiB and
+# executable at 576 kiB.
+KLIBCLDFLAGS = $(LD_IMAGE_BASE_OPT) 0x90000
+KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x10000
KLIBCSHAREDFLAGS += --defsym '__global_pointer$$=0'
# Kernel has never used stack trampolines