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;
77const R_386_RELATIVE = 8;
88const R_ARM_RELATIVE = 23;
99const R_AARCH64_RELATIVE = 1027;
10const R_LARCH_RELATIVE = 3;
1011const R_RISCV_RELATIVE = 3;
1112const R_SPARC_RELATIVE = 22;
1213
......@@ -15,6 +16,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
1516 .x86_64 => R_AMD64_RELATIVE,
1617 .arm => R_ARM_RELATIVE,
1718 .aarch64 => R_AARCH64_RELATIVE,
19 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
1820 .riscv64 => R_RISCV_RELATIVE,
1921 else => @compileError("Missing R_RELATIVE definition for this target"),
2022};
......@@ -57,6 +59,12 @@ fn getDynamicSymbol() [*]elf.Dyn {
5759 \\ add %[ret], %[ret], #:lo12:_DYNAMIC
5860 : [ret] "=r" (-> [*]elf.Dyn),
5961 ),
62 .loongarch32, .loongarch64 => asm volatile (
63 \\ .weak _DYNAMIC
64 \\ .hidden _DYNAMIC
65 \\ la.local %[ret], _DYNAMIC
66 : [ret] "=r" (-> [*]elf.Dyn),
67 ),
6068 .riscv64 => asm volatile (
6169 \\ .weak _DYNAMIC
6270 \\ .hidden _DYNAMIC