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
signature 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;...@@ -8,6 +8,7 @@ const R_386_RELATIVE = 8;
8const R_ARM_RELATIVE = 23;8const R_ARM_RELATIVE = 23;
9const R_AARCH64_RELATIVE = 1027;9const R_AARCH64_RELATIVE = 1027;
10const R_LARCH_RELATIVE = 3;10const R_LARCH_RELATIVE = 3;
11const R_68K_RELATIVE = 22;
11const R_RISCV_RELATIVE = 3;12const R_RISCV_RELATIVE = 3;
12const R_SPARC_RELATIVE = 22;13const R_SPARC_RELATIVE = 22;
1314
...@@ -17,6 +18,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {...@@ -17,6 +18,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
17 .arm => R_ARM_RELATIVE,18 .arm => R_ARM_RELATIVE,
18 .aarch64 => R_AARCH64_RELATIVE,19 .aarch64 => R_AARCH64_RELATIVE,
19 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,20 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
21 .m68k => R_68K_RELATIVE,
20 .riscv64 => R_RISCV_RELATIVE,22 .riscv64 => R_RISCV_RELATIVE,
21 else => @compileError("Missing R_RELATIVE definition for this target"),23 else => @compileError("Missing R_RELATIVE definition for this target"),
22};24};
...@@ -65,6 +67,15 @@ fn getDynamicSymbol() [*]elf.Dyn {...@@ -65,6 +67,15 @@ fn getDynamicSymbol() [*]elf.Dyn {
65 \\ la.local %[ret], _DYNAMIC67 \\ la.local %[ret], _DYNAMIC
66 : [ret] "=r" (-> [*]elf.Dyn),68 : [ret] "=r" (-> [*]elf.Dyn),
67 ),69 ),
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 ),
68 .riscv64 => asm volatile (79 .riscv64 => asm volatile (
69 \\ .weak _DYNAMIC80 \\ .weak _DYNAMIC
70 \\ .hidden _DYNAMIC81 \\ .hidden _DYNAMIC