authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 09:24:33+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 20:12:38+02:00
logbc054a713e3316843dcf3089c6a4b09e52c19b02
tree8a3d72f08485c9734fe05ab1e3aaf3050db7ad3e
parent2dabb7ec778dcf7eb59162ced4d3ceacecba187a
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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


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

lib/std/os/linux/start_pie.zig+9
...@@ -7,6 +7,7 @@ const R_AMD64_RELATIVE = 8;...@@ -7,6 +7,7 @@ const R_AMD64_RELATIVE = 8;
7const R_386_RELATIVE = 8;7const 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_CSKY_RELATIVE = 9;
10const R_LARCH_RELATIVE = 3;11const R_LARCH_RELATIVE = 3;
11const R_68K_RELATIVE = 22;12const R_68K_RELATIVE = 22;
12const R_RISCV_RELATIVE = 3;13const R_RISCV_RELATIVE = 3;
...@@ -18,6 +19,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {...@@ -18,6 +19,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
18 .x86_64 => R_AMD64_RELATIVE,19 .x86_64 => R_AMD64_RELATIVE,
19 .arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE,20 .arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE,
20 .aarch64, .aarch64_be => R_AARCH64_RELATIVE,21 .aarch64, .aarch64_be => R_AARCH64_RELATIVE,
22 .csky => R_CSKY_RELATIVE,
21 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,23 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
22 .m68k => R_68K_RELATIVE,24 .m68k => R_68K_RELATIVE,
23 .riscv64 => R_RISCV_RELATIVE,25 .riscv64 => R_RISCV_RELATIVE,
...@@ -63,6 +65,13 @@ fn getDynamicSymbol() [*]elf.Dyn {...@@ -63,6 +65,13 @@ fn getDynamicSymbol() [*]elf.Dyn {
63 \\ add %[ret], %[ret], #:lo12:_DYNAMIC65 \\ add %[ret], %[ret], #:lo12:_DYNAMIC
64 : [ret] "=r" (-> [*]elf.Dyn),66 : [ret] "=r" (-> [*]elf.Dyn),
65 ),67 ),
68 // The CSKY ABI requires the gb register to point to the GOT. Additionally, the first
69 // entry in the GOT is defined to hold the address of _DYNAMIC.
70 .csky => asm volatile (
71 \\ mov %[ret], gb
72 \\ ldw %[ret], %[ret]
73 : [ret] "=r" (-> [*]elf.Dyn),
74 ),
66 .loongarch32, .loongarch64 => asm volatile (75 .loongarch32, .loongarch64 => asm volatile (
67 \\ .weak _DYNAMIC76 \\ .weak _DYNAMIC
68 \\ .hidden _DYNAMIC77 \\ .hidden _DYNAMIC