| ... | @@ -19,6 +19,7 @@ const R_OR1K_RELATIVE = 21; | ... | @@ -19,6 +19,7 @@ const R_OR1K_RELATIVE = 21; |
| 19 | const R_PPC_RELATIVE = 22; | 19 | const R_PPC_RELATIVE = 22; |
| 20 | const R_RISCV_RELATIVE = 3; | 20 | const R_RISCV_RELATIVE = 3; |
| 21 | const R_390_RELATIVE = 12; | 21 | const R_390_RELATIVE = 12; |
| | 22 | const R_SH_RELATIVE = 165; |
| 22 | const R_SPARC_RELATIVE = 22; | 23 | const R_SPARC_RELATIVE = 22; |
| 23 | | 24 | |
| 24 | const R_RELATIVE = switch (builtin.cpu.arch) { | 25 | const R_RELATIVE = switch (builtin.cpu.arch) { |
| ... | @@ -38,6 +39,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { | ... | @@ -38,6 +39,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { |
| 38 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => R_PPC_RELATIVE, | 39 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => R_PPC_RELATIVE, |
| 39 | .riscv32, .riscv32be, .riscv64, .riscv64be => R_RISCV_RELATIVE, | 40 | .riscv32, .riscv32be, .riscv64, .riscv64be => R_RISCV_RELATIVE, |
| 40 | .s390x => R_390_RELATIVE, | 41 | .s390x => R_390_RELATIVE, |
| | 42 | .sh, .sheb => R_SH_RELATIVE, |
| 41 | .sparc, .sparc64 => R_SPARC_RELATIVE, | 43 | .sparc, .sparc64 => R_SPARC_RELATIVE, |
| 42 | else => @compileError("Missing R_RELATIVE definition for this target"), | 44 | else => @compileError("Missing R_RELATIVE definition for this target"), |
| 43 | }; | 45 | }; |
| ... | @@ -223,6 +225,20 @@ inline fn getDynamicSymbol() [*]const elf.Dyn { | ... | @@ -223,6 +225,20 @@ inline fn getDynamicSymbol() [*]const elf.Dyn { |
| 223 | \\ 2: | 225 | \\ 2: |
| 224 | : [ret] "=a" (-> [*]const elf.Dyn), | 226 | : [ret] "=a" (-> [*]const elf.Dyn), |
| 225 | ), | 227 | ), |
| | 228 | .sh, .sheb => asm volatile ( |
| | 229 | \\ .weak _DYNAMIC |
| | 230 | \\ .hidden _DYNAMIC |
| | 231 | \\ mova 1f, r0 |
| | 232 | \\ mov.l 1f, %[ret] |
| | 233 | \\ add r0, %[ret] |
| | 234 | \\ bra 2f |
| | 235 | \\1: |
| | 236 | \\ .balign 4 |
| | 237 | \\ .long DYNAMIC - . |
| | 238 | \\2: |
| | 239 | : [ret] "=r" (-> [*]const elf.Dyn), |
| | 240 | : |
| | 241 | : .{ .r0 = true }), |
| 226 | // The compiler does not necessarily have any obligation to load the `l7` register (pointing | 242 | // The compiler does not necessarily have any obligation to load the `l7` register (pointing |
| 227 | // to the GOT), so do it ourselves just in case. | 243 | // to the GOT), so do it ourselves just in case. |
| 228 | .sparc, .sparc64 => asm volatile ( | 244 | .sparc, .sparc64 => asm volatile ( |