commit a0b2b987c8a4252a1ae11937fc2affe6f48ee8df (tree)
parent bc054a713e3316843dcf3089c6a4b09e52c19b02
Author: Alex Rønne Petersen <alex@alexrp.com>
Date: Wed, 24 Jul 2024 09:40:27 +0200
std.os.linux.start_pie: Add arc support.
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib/std/os/linux/start_pie.zig b/lib/std/os/linux/start_pie.zig
@@ -5,6 +5,7 @@ const assert = std.debug.assert;
const R_AMD64_RELATIVE = 8;
const R_386_RELATIVE = 8;
+const R_ARC_RELATIVE = 56;
const R_ARM_RELATIVE = 23;
const R_AARCH64_RELATIVE = 1027;
const R_CSKY_RELATIVE = 9;
@@ -17,6 +18,7 @@ const R_SPARC_RELATIVE = 22;
const R_RELATIVE = switch (builtin.cpu.arch) {
.x86 => R_386_RELATIVE,
.x86_64 => R_AMD64_RELATIVE,
+ .arc => R_ARC_RELATIVE,
.arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE,
.aarch64, .aarch64_be => R_AARCH64_RELATIVE,
.csky => R_CSKY_RELATIVE,
@@ -46,6 +48,12 @@ fn getDynamicSymbol() [*]elf.Dyn {
\\ lea _DYNAMIC(%%rip), %[ret]
: [ret] "=r" (-> [*]elf.Dyn),
),
+ .arc => asm volatile (
+ \\ .weak _DYNAMIC
+ \\ .hidden _DYNAMIC
+ \\ add %[ret], pcl, _DYNAMIC@pcl
+ : [ret] "=r" (-> [*]elf.Dyn),
+ ),
// Work around the limited offset range of `ldr`
.arm, .armeb, .thumb, .thumbeb => asm volatile (
\\ .weak _DYNAMIC