From e646c47f675be2dd83847717c3edda634d3e7dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 18 Oct 2025 15:00:55 +0200 Subject: [PATCH] std.pie: add or1k support --- lib/std/pie.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/std/pie.zig b/lib/std/pie.zig index de8c63fc87..1b028930c7 100644 --- a/lib/std/pie.zig +++ b/lib/std/pie.zig @@ -13,6 +13,7 @@ const R_HEXAGON_RELATIVE = 35; const R_LARCH_RELATIVE = 3; const R_68K_RELATIVE = 22; const R_MIPS_RELATIVE = 128; +const R_OR1K_RELATIVE = 21; const R_PPC_RELATIVE = 22; const R_RISCV_RELATIVE = 3; const R_390_RELATIVE = 12; @@ -29,6 +30,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { .loongarch32, .loongarch64 => R_LARCH_RELATIVE, .m68k => R_68K_RELATIVE, .mips, .mipsel, .mips64, .mips64el => R_MIPS_RELATIVE, + .or1k => R_OR1K_RELATIVE, .powerpc, .powerpcle, .powerpc64, .powerpc64le => R_PPC_RELATIVE, .riscv32, .riscv32be, .riscv64, .riscv64be => R_RISCV_RELATIVE, .s390x => R_390_RELATIVE, @@ -153,6 +155,17 @@ inline fn getDynamicSymbol() [*]const elf.Dyn { : : .{ .lr = true }), }, + .or1k => asm volatile ( + \\ .weak _DYNAMIC + \\ .hidden _DYNAMIC + \\ l.jal 1f + \\ .word _DYNAMIC - . + \\1: + \\ l.lwz %[ret], 0(r9) + \\ l.add %[ret], %[ret], r9 + : [ret] "=r" (-> [*]const elf.Dyn), + : + : .{ .r9 = true }), .powerpc, .powerpcle => asm volatile ( \\ .weak _DYNAMIC \\ .hidden _DYNAMIC