authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-18 15:00:55+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-18 22:27:34+02:00
loge646c47f675be2dd83847717c3edda634d3e7dbb
tree0552920d7894eaa7234d9a7531b1f9c28bb14de8
parent2d5cdfcfc2f073111c42940475d5126c3ea50e5c
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.pie: add or1k support


1 files changed, 13 insertions(+), 0 deletions(-)

lib/std/pie.zig+13
......@@ -13,6 +13,7 @@ const R_HEXAGON_RELATIVE = 35;
1313const R_LARCH_RELATIVE = 3;
1414const R_68K_RELATIVE = 22;
1515const R_MIPS_RELATIVE = 128;
16const R_OR1K_RELATIVE = 21;
1617const R_PPC_RELATIVE = 22;
1718const R_RISCV_RELATIVE = 3;
1819const R_390_RELATIVE = 12;
......@@ -29,6 +30,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
2930 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
3031 .m68k => R_68K_RELATIVE,
3132 .mips, .mipsel, .mips64, .mips64el => R_MIPS_RELATIVE,
33 .or1k => R_OR1K_RELATIVE,
3234 .powerpc, .powerpcle, .powerpc64, .powerpc64le => R_PPC_RELATIVE,
3335 .riscv32, .riscv32be, .riscv64, .riscv64be => R_RISCV_RELATIVE,
3436 .s390x => R_390_RELATIVE,
......@@ -153,6 +155,17 @@ inline fn getDynamicSymbol() [*]const elf.Dyn {
153155 :
154156 : .{ .lr = true }),
155157 },
158 .or1k => asm volatile (
159 \\ .weak _DYNAMIC
160 \\ .hidden _DYNAMIC
161 \\ l.jal 1f
162 \\ .word _DYNAMIC - .
163 \\1:
164 \\ l.lwz %[ret], 0(r9)
165 \\ l.add %[ret], %[ret], r9
166 : [ret] "=r" (-> [*]const elf.Dyn),
167 :
168 : .{ .r9 = true }),
156169 .powerpc, .powerpcle => asm volatile (
157170 \\ .weak _DYNAMIC
158171 \\ .hidden _DYNAMIC