| ... | ... | @@ -8,6 +8,7 @@ const R_386_RELATIVE = 8; |
| 8 | 8 | const R_ARM_RELATIVE = 23; |
| 9 | 9 | const R_AARCH64_RELATIVE = 1027; |
| 10 | 10 | const R_LARCH_RELATIVE = 3; |
| 11 | const R_68K_RELATIVE = 22; |
| 11 | 12 | const R_RISCV_RELATIVE = 3; |
| 12 | 13 | const R_SPARC_RELATIVE = 22; |
| 13 | 14 | |
| ... | ... | @@ -17,6 +18,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { |
| 17 | 18 | .arm => R_ARM_RELATIVE, |
| 18 | 19 | .aarch64 => R_AARCH64_RELATIVE, |
| 19 | 20 | .loongarch32, .loongarch64 => R_LARCH_RELATIVE, |
| 21 | .m68k => R_68K_RELATIVE, |
| 20 | 22 | .riscv64 => R_RISCV_RELATIVE, |
| 21 | 23 | else => @compileError("Missing R_RELATIVE definition for this target"), |
| 22 | 24 | }; |
| ... | ... | @@ -65,6 +67,15 @@ fn getDynamicSymbol() [*]elf.Dyn { |
| 65 | 67 | \\ la.local %[ret], _DYNAMIC |
| 66 | 68 | : [ret] "=r" (-> [*]elf.Dyn), |
| 67 | 69 | ), |
| 70 | // Note that the - 8 is needed because pc in the second lea instruction points into the |
| 71 | // middle of that instruction. (The first lea is 6 bytes, the second is 4 bytes.) |
| 72 | .m68k => asm volatile ( |
| 73 | \\ .weak _DYNAMIC |
| 74 | \\ .hidden _DYNAMIC |
| 75 | \\ lea _DYNAMIC - . - 8, %[ret] |
| 76 | \\ lea (%[ret], %%pc), %[ret] |
| 77 | : [ret] "=r" (-> [*]elf.Dyn), |
| 78 | ), |
| 68 | 79 | .riscv64 => asm volatile ( |
| 69 | 80 | \\ .weak _DYNAMIC |
| 70 | 81 | \\ .hidden _DYNAMIC |