From 38c492bb531f57fa70f68276399e302f90f66176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Wed, 24 Jul 2024 10:00:58 +0200 Subject: [PATCH] std.os.linux.start_pie: Add hexagon support. --- lib/std/os/linux/start_pie.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/std/os/linux/start_pie.zig b/lib/std/os/linux/start_pie.zig index 2f46ebb791..19b6c332f7 100644 --- a/lib/std/os/linux/start_pie.zig +++ b/lib/std/os/linux/start_pie.zig @@ -9,6 +9,7 @@ const R_ARC_RELATIVE = 56; const R_ARM_RELATIVE = 23; const R_AARCH64_RELATIVE = 1027; const R_CSKY_RELATIVE = 9; +const R_HEXAGON_RELATIVE = 35; const R_LARCH_RELATIVE = 3; const R_68K_RELATIVE = 22; const R_RISCV_RELATIVE = 3; @@ -22,6 +23,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { .arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE, .aarch64, .aarch64_be => R_AARCH64_RELATIVE, .csky => R_CSKY_RELATIVE, + .hexagon => R_HEXAGON_RELATIVE, .loongarch32, .loongarch64 => R_LARCH_RELATIVE, .m68k => R_68K_RELATIVE, .riscv64 => R_RISCV_RELATIVE, @@ -80,6 +82,20 @@ fn getDynamicSymbol() [*]elf.Dyn { \\ ldw %[ret], %[ret] : [ret] "=r" (-> [*]elf.Dyn), ), + .hexagon => asm volatile ( + \\ .weak _DYNAMIC + \\ .hidden _DYNAMIC + \\ jump 1f + \\ .word _DYNAMIC - . + \\ 1: + \\ r1 = pc + \\ r1 = add(r1, #-4) + \\ %[ret] = memw(r1) + \\ %[ret] = add(r1, %[ret]) + : [ret] "=r" (-> [*]elf.Dyn), + : + : "r1" + ), .loongarch32, .loongarch64 => asm volatile ( \\ .weak _DYNAMIC \\ .hidden _DYNAMIC