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;...@@ -10,6 +10,7 @@ const R_AARCH64_RELATIVE = 1027;
10const R_LARCH_RELATIVE = 3;10const R_LARCH_RELATIVE = 3;
11const R_68K_RELATIVE = 22;11const R_68K_RELATIVE = 22;
12const R_RISCV_RELATIVE = 3;12const R_RISCV_RELATIVE = 3;
13const R_390_RELATIVE = 12;
13const R_SPARC_RELATIVE = 22;14const R_SPARC_RELATIVE = 22;
1415
15const R_RELATIVE = switch (builtin.cpu.arch) {16const R_RELATIVE = switch (builtin.cpu.arch) {
...@@ -20,6 +21,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {...@@ -20,6 +21,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
20 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,21 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
21 .m68k => R_68K_RELATIVE,22 .m68k => R_68K_RELATIVE,
22 .riscv64 => R_RISCV_RELATIVE,23 .riscv64 => R_RISCV_RELATIVE,
24 .s390x => R_390_RELATIVE,
23 else => @compileError("Missing R_RELATIVE definition for this target"),25 else => @compileError("Missing R_RELATIVE definition for this target"),
24};26};
2527
...@@ -82,6 +84,16 @@ fn getDynamicSymbol() [*]elf.Dyn {...@@ -82,6 +84,16 @@ fn getDynamicSymbol() [*]elf.Dyn {
82 \\ lla %[ret], _DYNAMIC84 \\ lla %[ret], _DYNAMIC
83 : [ret] "=r" (-> [*]elf.Dyn),85 : [ret] "=r" (-> [*]elf.Dyn),
84 ),86 ),
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 ),
85 else => {97 else => {
86 @compileError("PIE startup is not yet supported for this target!");98 @compileError("PIE startup is not yet supported for this target!");
87 },99 },