aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/linux
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-24 09:40:27 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-07-24 20:12:38 +0200
commita0b2b987c8a4252a1ae11937fc2affe6f48ee8df (patch)
treec04d5da855138c87302568c2b21d2b73d14db772 /lib/std/os/linux
parentbc054a713e3316843dcf3089c6a4b09e52c19b02 (diff)
downloadzig-a0b2b987c8a4252a1ae11937fc2affe6f48ee8df.tar.gz
zig-a0b2b987c8a4252a1ae11937fc2affe6f48ee8df.zip
std.os.linux.start_pie: Add arc support.
Diffstat (limited to 'lib/std/os/linux')
-rw-r--r--lib/std/os/linux/start_pie.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/os/linux/start_pie.zig b/lib/std/os/linux/start_pie.zig
index 7e6ecc763c..2f46ebb791 100644
--- 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