History

riscv64-asm.c: parse_operand: document some ABI details

noneofyourbusiness committed 10 months ago

Commit b39cbc71 parent 5ec0e6f1 file · +10 −0Browse files

Unified · Split

riscv64-asm.c+10−0
@@ -209,6 +209,16 @@ static void parse_operand(TCCState *s1, Operand *op) · 208 unmodified lines
209209 if ((int) op->e.v >= -0x1000 && (int) op->e.v < 0x1000)
210210 op->type = OP_IM12S;
211211 } 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+
212222 label.type.t = VT_VOID | VT_STATIC;
213223
214224 /* use the medium PIC model: GOT, auipc, lw */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t