| ... | ... | @@ -32,6 +32,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { |
| 32 | 32 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => R_PPC_RELATIVE, |
| 33 | 33 | .riscv32, .riscv64 => R_RISCV_RELATIVE, |
| 34 | 34 | .s390x => R_390_RELATIVE, |
| 35 | .sparc, .sparc64 => R_SPARC_RELATIVE, |
| 35 | 36 | else => @compileError("Missing R_RELATIVE definition for this target"), |
| 36 | 37 | }; |
| 37 | 38 | |
| ... | ... | @@ -182,6 +183,16 @@ inline fn getDynamicSymbol() [*]elf.Dyn { |
| 182 | 183 | \\ 2: |
| 183 | 184 | : [ret] "=r" (-> [*]elf.Dyn), |
| 184 | 185 | ), |
| 186 | // The compiler does not necessarily have any obligation to load the `l7` register (pointing |
| 187 | // to the GOT), so do it ourselves just in case. |
| 188 | .sparc, .sparc64 => asm volatile ( |
| 189 | \\ sethi %%hi(_GLOBAL_OFFSET_TABLE_ - 4), %%l7 |
| 190 | \\ call 1f |
| 191 | \\ add %%l7, %%lo(_GLOBAL_OFFSET_TABLE_ + 4), %%l7 |
| 192 | \\ 1: |
| 193 | \\ add %%l7, %%o7, %[ret] |
| 194 | : [ret] "=r" (-> [*]elf.Dyn), |
| 195 | ), |
| 185 | 196 | else => { |
| 186 | 197 | @compileError("PIE startup is not yet supported for this target!"); |
| 187 | 198 | }, |