authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-21 16:25:54+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 00:27:46+02:00
log1fd45766a7bb6abad614c9c2c0a3b90bcde62290
treecd9cf3f13886ee8b729ec9e9202168292d527683
parent718f8d531488866ff3623c83e05d8ad9a8f72659
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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


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

lib/std/os/linux/start_pie.zig+8
...@@ -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_LARCH_RELATIVE = 3;
10const R_RISCV_RELATIVE = 3;11const R_RISCV_RELATIVE = 3;
11const R_SPARC_RELATIVE = 22;12const R_SPARC_RELATIVE = 22;
1213
...@@ -15,6 +16,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {...@@ -15,6 +16,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
15 .x86_64 => R_AMD64_RELATIVE,16 .x86_64 => R_AMD64_RELATIVE,
16 .arm => R_ARM_RELATIVE,17 .arm => R_ARM_RELATIVE,
17 .aarch64 => R_AARCH64_RELATIVE,18 .aarch64 => R_AARCH64_RELATIVE,
19 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
18 .riscv64 => R_RISCV_RELATIVE,20 .riscv64 => R_RISCV_RELATIVE,
19 else => @compileError("Missing R_RELATIVE definition for this target"),21 else => @compileError("Missing R_RELATIVE definition for this target"),
20};22};
...@@ -57,6 +59,12 @@ fn getDynamicSymbol() [*]elf.Dyn {...@@ -57,6 +59,12 @@ fn getDynamicSymbol() [*]elf.Dyn {
57 \\ add %[ret], %[ret], #:lo12:_DYNAMIC59 \\ add %[ret], %[ret], #:lo12:_DYNAMIC
58 : [ret] "=r" (-> [*]elf.Dyn),60 : [ret] "=r" (-> [*]elf.Dyn),
59 ),61 ),
62 .loongarch32, .loongarch64 => asm volatile (
63 \\ .weak _DYNAMIC
64 \\ .hidden _DYNAMIC
65 \\ la.local %[ret], _DYNAMIC
66 : [ret] "=r" (-> [*]elf.Dyn),
67 ),
60 .riscv64 => asm volatile (68 .riscv64 => asm volatile (
61 \\ .weak _DYNAMIC69 \\ .weak _DYNAMIC
62 \\ .hidden _DYNAMIC70 \\ .hidden _DYNAMIC