Unified · Split
| @@ -209,6 +209,16 @@ static void parse_operand(TCCState *s1, Operand *op) · 208 unmodified lines | ||
| 209 | 209 | if ((int) op->e.v >= -0x1000 && (int) op->e.v < 0x1000) |
| 210 | 210 | op->type = OP_IM12S; |
| 211 | 211 | } else if (op->e.sym->type.t & (VT_EXTERN | VT_STATIC)) { |
| 212 | + /* see also: "RISC-V ABIs Specification" V1.0 | |
| 213 | + | |
| 214 | + section 5.2 recommends using a GOT for | |
| 215 | + "possibly-undefined weak symbols" | |
| 216 | + | |
| 217 | + section 5.3: "Medium position independent code model" | |
| 218 | + if this is a non-local symbol: use a GOT | |
| 219 | + non-local: outside of a pc-relative +- 2 GiB range | |
| 220 | + */ | |
| 221 | + | |
| 212 | 222 | label.type.t = VT_VOID | VT_STATIC; |
| 213 | 223 | |
| 214 | 224 | /* use the medium PIC model: GOT, auipc, lw */ |