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

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


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

lib/std/os/linux/start_pie.zig+8
...@@ -5,6 +5,7 @@ const assert = std.debug.assert;...@@ -5,6 +5,7 @@ const assert = std.debug.assert;
55
6const R_AMD64_RELATIVE = 8;6const R_AMD64_RELATIVE = 8;
7const R_386_RELATIVE = 8;7const R_386_RELATIVE = 8;
8const R_ARC_RELATIVE = 56;
8const R_ARM_RELATIVE = 23;9const R_ARM_RELATIVE = 23;
9const R_AARCH64_RELATIVE = 1027;10const R_AARCH64_RELATIVE = 1027;
10const R_CSKY_RELATIVE = 9;11const R_CSKY_RELATIVE = 9;
...@@ -17,6 +18,7 @@ const R_SPARC_RELATIVE = 22;...@@ -17,6 +18,7 @@ const R_SPARC_RELATIVE = 22;
17const R_RELATIVE = switch (builtin.cpu.arch) {18const R_RELATIVE = switch (builtin.cpu.arch) {
18 .x86 => R_386_RELATIVE,19 .x86 => R_386_RELATIVE,
19 .x86_64 => R_AMD64_RELATIVE,20 .x86_64 => R_AMD64_RELATIVE,
21 .arc => R_ARC_RELATIVE,
20 .arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE,22 .arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE,
21 .aarch64, .aarch64_be => R_AARCH64_RELATIVE,23 .aarch64, .aarch64_be => R_AARCH64_RELATIVE,
22 .csky => R_CSKY_RELATIVE,24 .csky => R_CSKY_RELATIVE,
...@@ -46,6 +48,12 @@ fn getDynamicSymbol() [*]elf.Dyn {...@@ -46,6 +48,12 @@ fn getDynamicSymbol() [*]elf.Dyn {
46 \\ lea _DYNAMIC(%%rip), %[ret]48 \\ lea _DYNAMIC(%%rip), %[ret]
47 : [ret] "=r" (-> [*]elf.Dyn),49 : [ret] "=r" (-> [*]elf.Dyn),
48 ),50 ),
51 .arc => asm volatile (
52 \\ .weak _DYNAMIC
53 \\ .hidden _DYNAMIC
54 \\ add %[ret], pcl, _DYNAMIC@pcl
55 : [ret] "=r" (-> [*]elf.Dyn),
56 ),
49 // Work around the limited offset range of `ldr`57 // Work around the limited offset range of `ldr`
50 .arm, .armeb, .thumb, .thumbeb => asm volatile (58 .arm, .armeb, .thumb, .thumbeb => asm volatile (
51 \\ .weak _DYNAMIC59 \\ .weak _DYNAMIC