diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-07-24 09:24:33 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2024-07-24 20:12:38 +0200 |
| commit | bc054a713e3316843dcf3089c6a4b09e52c19b02 (patch) | |
| tree | 8a3d72f08485c9734fe05ab1e3aaf3050db7ad3e /lib/std/os/linux | |
| parent | 2dabb7ec778dcf7eb59162ced4d3ceacecba187a (diff) | |
| download | zig-bc054a713e3316843dcf3089c6a4b09e52c19b02.tar.gz zig-bc054a713e3316843dcf3089c6a4b09e52c19b02.zip | |
std.os.linux.start_pie: Add csky support.
Diffstat (limited to 'lib/std/os/linux')
| -rw-r--r-- | lib/std/os/linux/start_pie.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/std/os/linux/start_pie.zig b/lib/std/os/linux/start_pie.zig index 6e7f00c006..7e6ecc763c 100644 --- a/lib/std/os/linux/start_pie.zig +++ b/lib/std/os/linux/start_pie.zig @@ -7,6 +7,7 @@ const R_AMD64_RELATIVE = 8; const R_386_RELATIVE = 8; const R_ARM_RELATIVE = 23; const R_AARCH64_RELATIVE = 1027; +const R_CSKY_RELATIVE = 9; const R_LARCH_RELATIVE = 3; const R_68K_RELATIVE = 22; const R_RISCV_RELATIVE = 3; @@ -18,6 +19,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { .x86_64 => R_AMD64_RELATIVE, .arm, .armeb, .thumb, .thumbeb => R_ARM_RELATIVE, .aarch64, .aarch64_be => R_AARCH64_RELATIVE, + .csky => R_CSKY_RELATIVE, .loongarch32, .loongarch64 => R_LARCH_RELATIVE, .m68k => R_68K_RELATIVE, .riscv64 => R_RISCV_RELATIVE, @@ -63,6 +65,13 @@ fn getDynamicSymbol() [*]elf.Dyn { \\ add %[ret], %[ret], #:lo12:_DYNAMIC : [ret] "=r" (-> [*]elf.Dyn), ), + // The CSKY ABI requires the gb register to point to the GOT. Additionally, the first + // entry in the GOT is defined to hold the address of _DYNAMIC. + .csky => asm volatile ( + \\ mov %[ret], gb + \\ ldw %[ret], %[ret] + : [ret] "=r" (-> [*]elf.Dyn), + ), .loongarch32, .loongarch64 => asm volatile ( \\ .weak _DYNAMIC \\ .hidden _DYNAMIC |
