zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 1c6bee08340d23a17cbed67e171d993ab69c1152 (tree)
parent 6fac71ec74a54792334381b739310685f4b38ba3
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Sun, 21 Jul 2024 17:18:13 +0200

std.os.linux.start_pie: Add s390x support.

Diffstat:
Mlib/std/os/linux/start_pie.zig | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/lib/std/os/linux/start_pie.zig b/lib/std/os/linux/start_pie.zig @@ -10,6 +10,7 @@ const R_AARCH64_RELATIVE = 1027; const R_LARCH_RELATIVE = 3; const R_68K_RELATIVE = 22; const R_RISCV_RELATIVE = 3; +const R_390_RELATIVE = 12; const R_SPARC_RELATIVE = 22; const R_RELATIVE = switch (builtin.cpu.arch) { @@ -20,6 +21,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { .loongarch32, .loongarch64 => R_LARCH_RELATIVE, .m68k => R_68K_RELATIVE, .riscv64 => R_RISCV_RELATIVE, + .s390x => R_390_RELATIVE, else => @compileError("Missing R_RELATIVE definition for this target"), }; @@ -82,6 +84,16 @@ fn getDynamicSymbol() [*]elf.Dyn { \\ lla %[ret], _DYNAMIC : [ret] "=r" (-> [*]elf.Dyn), ), + .s390x => asm volatile ( + \\ .weak _DYNAMIC + \\ .hidden _DYNAMIC + \\ larl %[ret], 1f + \\ agf %[ret], 0(%[ret]) + \\ b 2f + \\ 1: .long _DYNAMIC - . + \\ 2: + : [ret] "=r" (-> [*]elf.Dyn), + ), else => { @compileError("PIE startup is not yet supported for this target!"); },