| ... | @@ -12,6 +12,7 @@ const R_CSKY_RELATIVE = 9; | ... | @@ -12,6 +12,7 @@ const R_CSKY_RELATIVE = 9; |
| 12 | const R_HEXAGON_RELATIVE = 35; | 12 | const R_HEXAGON_RELATIVE = 35; |
| 13 | const R_LARCH_RELATIVE = 3; | 13 | const R_LARCH_RELATIVE = 3; |
| 14 | const R_68K_RELATIVE = 22; | 14 | const R_68K_RELATIVE = 22; |
| | 15 | const R_MIPS_RELATIVE = 128; |
| 15 | const R_RISCV_RELATIVE = 3; | 16 | const R_RISCV_RELATIVE = 3; |
| 16 | const R_390_RELATIVE = 12; | 17 | const R_390_RELATIVE = 12; |
| 17 | const R_SPARC_RELATIVE = 22; | 18 | const R_SPARC_RELATIVE = 22; |
| ... | @@ -26,6 +27,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { | ... | @@ -26,6 +27,7 @@ const R_RELATIVE = switch (builtin.cpu.arch) { |
| 26 | .hexagon => R_HEXAGON_RELATIVE, | 27 | .hexagon => R_HEXAGON_RELATIVE, |
| 27 | .loongarch32, .loongarch64 => R_LARCH_RELATIVE, | 28 | .loongarch32, .loongarch64 => R_LARCH_RELATIVE, |
| 28 | .m68k => R_68K_RELATIVE, | 29 | .m68k => R_68K_RELATIVE, |
| | 30 | .mips, .mipsel, .mips64, .mips64el => R_MIPS_RELATIVE, |
| 29 | .riscv32, .riscv64 => R_RISCV_RELATIVE, | 31 | .riscv32, .riscv64 => R_RISCV_RELATIVE, |
| 30 | .s390x => R_390_RELATIVE, | 32 | .s390x => R_390_RELATIVE, |
| 31 | else => @compileError("Missing R_RELATIVE definition for this target"), | 33 | else => @compileError("Missing R_RELATIVE definition for this target"), |
| ... | @@ -111,6 +113,31 @@ fn getDynamicSymbol() [*]elf.Dyn { | ... | @@ -111,6 +113,31 @@ fn getDynamicSymbol() [*]elf.Dyn { |
| 111 | \\ lea (%[ret], %%pc), %[ret] | 113 | \\ lea (%[ret], %%pc), %[ret] |
| 112 | : [ret] "=r" (-> [*]elf.Dyn), | 114 | : [ret] "=r" (-> [*]elf.Dyn), |
| 113 | ), | 115 | ), |
| | 116 | .mips, .mipsel => asm volatile ( |
| | 117 | \\ .weak _DYNAMIC |
| | 118 | \\ .hidden _DYNAMIC |
| | 119 | \\ bal 1f |
| | 120 | \\ .gpword _DYNAMIC |
| | 121 | \\ 1: |
| | 122 | \\ lw %[ret], 0($ra) |
| | 123 | \\ addu %[ret], %[ret], $gp |
| | 124 | : [ret] "=r" (-> [*]elf.Dyn), |
| | 125 | : |
| | 126 | : "lr" |
| | 127 | ), |
| | 128 | .mips64, .mips64el => asm volatile ( |
| | 129 | \\ .weak _DYNAMIC |
| | 130 | \\ .hidden _DYNAMIC |
| | 131 | \\ .balign 8 |
| | 132 | \\ bal 1f |
| | 133 | \\ .gpdword _DYNAMIC |
| | 134 | \\ 1: |
| | 135 | \\ ld %[ret], 0($ra) |
| | 136 | \\ daddu %[ret], %[ret], $gp |
| | 137 | : [ret] "=r" (-> [*]elf.Dyn), |
| | 138 | : |
| | 139 | : "lr" |
| | 140 | ), |
| 114 | .riscv32, .riscv64 => asm volatile ( | 141 | .riscv32, .riscv64 => asm volatile ( |
| 115 | \\ .weak _DYNAMIC | 142 | \\ .weak _DYNAMIC |
| 116 | \\ .hidden _DYNAMIC | 143 | \\ .hidden _DYNAMIC |