authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-21 16:56:52+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 00:28:07+02:00
log6fac71ec74a54792334381b739310685f4b38ba3
tree778cef75a3c8f89f268e4f70e15346ef45d5edd0
parent1fd45766a7bb6abad614c9c2c0a3b90bcde62290
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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


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

lib/std/os/linux/start_pie.zig+11
......@@ -8,6 +8,7 @@ const R_386_RELATIVE = 8;
88const R_ARM_RELATIVE = 23;
99const R_AARCH64_RELATIVE = 1027;
1010const R_LARCH_RELATIVE = 3;
11const R_68K_RELATIVE = 22;
1112const R_RISCV_RELATIVE = 3;
1213const R_SPARC_RELATIVE = 22;
1314
......@@ -17,6 +18,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
1718 .arm => R_ARM_RELATIVE,
1819 .aarch64 => R_AARCH64_RELATIVE,
1920 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
21 .m68k => R_68K_RELATIVE,
2022 .riscv64 => R_RISCV_RELATIVE,
2123 else => @compileError("Missing R_RELATIVE definition for this target"),
2224};
......@@ -65,6 +67,15 @@ fn getDynamicSymbol() [*]elf.Dyn {
6567 \\ la.local %[ret], _DYNAMIC
6668 : [ret] "=r" (-> [*]elf.Dyn),
6769 ),
70 // Note that the - 8 is needed because pc in the second lea instruction points into the
71 // middle of that instruction. (The first lea is 6 bytes, the second is 4 bytes.)
72 .m68k => asm volatile (
73 \\ .weak _DYNAMIC
74 \\ .hidden _DYNAMIC
75 \\ lea _DYNAMIC - . - 8, %[ret]
76 \\ lea (%[ret], %%pc), %[ret]
77 : [ret] "=r" (-> [*]elf.Dyn),
78 ),
6879 .riscv64 => asm volatile (
6980 \\ .weak _DYNAMIC
7081 \\ .hidden _DYNAMIC