aboutsummaryrefslogtreecommitdiffhomepage
path: root/ir/intrin.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-13 14:21:22 +0100
committerlemon <lsof@mailbox.org>2025-12-13 14:24:30 +0100
commit854df54e1839c8b96d1aaa9aeaa32c2ebbf535f8 (patch)
treeba0d2d8b79300d0af2a53aeccd628111733ae7e8 /ir/intrin.c
parent17e5a9f573b1a60e12ed60948f45f5992914d324 (diff)
fix position independent loads of function symbols.
For `extern int x[1];`, can use PCREL32 for &x. But for `extern int x(int)`, must use GOTREL, when not being called directly (that's PLT). Therefore the type of an external symbol (actually just whether it denotes a function) matters when deciding what kind of relocation to emit, so keep that information.
Diffstat (limited to 'ir/intrin.c')
-rw-r--r--ir/intrin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ir/intrin.c b/ir/intrin.c
index cd2865a..2ef826c 100644
--- a/ir/intrin.c
+++ b/ir/intrin.c
@@ -24,7 +24,7 @@ intrin(struct block *blk, int *curi, enum intrin in, struct arg *args, int narg,
/* memcpy */
*args[1].ty = *args[0].ty = mktyperef(cls2type(KPTR));
insertinstr(blk, (*curi)++, mkarginstr(cls2type(cls), mkintcon(cls, td->siz)));
- *this = mkinstr(Ocall, 0, mksymref("memcpy"), this->r);
+ *this = mkinstr(Ocall, 0, mksymref("memcpy", 1), this->r);
calltab.p[this->r.i].narg = 3;
calltab.p[this->r.i].ret = cls2type(0);
return 0;