authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-21 17:18:13+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 00:28:08+02:00
log1c6bee08340d23a17cbed67e171d993ab69c1152
tree4b552983a8b784d5fd6fc433269cb0b87b028855
parent6fac71ec74a54792334381b739310685f4b38ba3
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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


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

lib/std/os/linux/start_pie.zig+12
......@@ -10,6 +10,7 @@ const R_AARCH64_RELATIVE = 1027;
1010const R_LARCH_RELATIVE = 3;
1111const R_68K_RELATIVE = 22;
1212const R_RISCV_RELATIVE = 3;
13const R_390_RELATIVE = 12;
1314const R_SPARC_RELATIVE = 22;
1415
1516const R_RELATIVE = switch (builtin.cpu.arch) {
......@@ -20,6 +21,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
2021 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
2122 .m68k => R_68K_RELATIVE,
2223 .riscv64 => R_RISCV_RELATIVE,
24 .s390x => R_390_RELATIVE,
2325 else => @compileError("Missing R_RELATIVE definition for this target"),
2426};
2527
......@@ -82,6 +84,16 @@ fn getDynamicSymbol() [*]elf.Dyn {
8284 \\ lla %[ret], _DYNAMIC
8385 : [ret] "=r" (-> [*]elf.Dyn),
8486 ),
87 .s390x => asm volatile (
88 \\ .weak _DYNAMIC
89 \\ .hidden _DYNAMIC
90 \\ larl %[ret], 1f
91 \\ agf %[ret], 0(%[ret])
92 \\ b 2f
93 \\ 1: .long _DYNAMIC - .
94 \\ 2:
95 : [ret] "=r" (-> [*]elf.Dyn),
96 ),
8597 else => {
8698 @compileError("PIE startup is not yet supported for this target!");
8799 },