authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 10:00:58+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-07-24 20:12:38+02:00
log38c492bb531f57fa70f68276399e302f90f66176
tree8465d3bea2633277fae58114dc5094775b51f94b
parenta0b2b987c8a4252a1ae11937fc2affe6f48ee8df
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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


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

lib/std/os/linux/start_pie.zig+16
...@@ -9,6 +9,7 @@ const R_ARC_RELATIVE = 56;...@@ -9,6 +9,7 @@ const R_ARC_RELATIVE = 56;
9const R_ARM_RELATIVE = 23;9const R_ARM_RELATIVE = 23;
10const R_AARCH64_RELATIVE = 1027;10const R_AARCH64_RELATIVE = 1027;
11const R_CSKY_RELATIVE = 9;11const R_CSKY_RELATIVE = 9;
12const R_HEXAGON_RELATIVE = 35;
12const R_LARCH_RELATIVE = 3;13const R_LARCH_RELATIVE = 3;
13const R_68K_RELATIVE = 22;14const R_68K_RELATIVE = 22;
14const R_RISCV_RELATIVE = 3;15const R_RISCV_RELATIVE = 3;
...@@ -22,6 +23,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {...@@ -22,6 +23,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
22 .arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE,23 .arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE,
23 .aarch64, .aarch64_be => R_AARCH64_RELATIVE,24 .aarch64, .aarch64_be => R_AARCH64_RELATIVE,
24 .csky => R_CSKY_RELATIVE,25 .csky => R_CSKY_RELATIVE,
26 .hexagon => R_HEXAGON_RELATIVE,
25 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,27 .loongarch32, .loongarch64 => R_LARCH_RELATIVE,
26 .m68k => R_68K_RELATIVE,28 .m68k => R_68K_RELATIVE,
27 .riscv64 => R_RISCV_RELATIVE,29 .riscv64 => R_RISCV_RELATIVE,
...@@ -80,6 +82,20 @@ fn getDynamicSymbol() [*]elf.Dyn {...@@ -80,6 +82,20 @@ fn getDynamicSymbol() [*]elf.Dyn {
80 \\ ldw %[ret], %[ret]82 \\ ldw %[ret], %[ret]
81 : [ret] "=r" (-> [*]elf.Dyn),83 : [ret] "=r" (-> [*]elf.Dyn),
82 ),84 ),
85 .hexagon => asm volatile (
86 \\ .weak _DYNAMIC
87 \\ .hidden _DYNAMIC
88 \\ jump 1f
89 \\ .word _DYNAMIC - .
90 \\ 1:
91 \\ r1 = pc
92 \\ r1 = add(r1, #-4)
93 \\ %[ret] = memw(r1)
94 \\ %[ret] = add(r1, %[ret])
95 : [ret] "=r" (-> [*]elf.Dyn),
96 :
97 : "r1"
98 ),
83 .loongarch32, .loongarch64 => asm volatile (99 .loongarch32, .loongarch64 => asm volatile (
84 \\ .weak _DYNAMIC100 \\ .weak _DYNAMIC
85 \\ .hidden _DYNAMIC101 \\ .hidden _DYNAMIC