diff options
| author | 2025-12-13 14:21:22 +0100 | |
|---|---|---|
| committer | 2025-12-13 14:24:30 +0100 | |
| commit | 854df54e1839c8b96d1aaa9aeaa32c2ebbf535f8 (patch) | |
| tree | ba0d2d8b79300d0af2a53aeccd628111733ae7e8 /ir/ir.h | |
| parent | 17e5a9f573b1a60e12ed60948f45f5992914d324 (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/ir.h')
| -rw-r--r-- | ir/ir.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -26,7 +26,7 @@ struct irdat { }; struct xcon { - bool issym, isdat, deref; + bool issym, isdat, isfunc, deref; uchar cls; union { const char *sym; @@ -250,7 +250,7 @@ union ref mkfltcon(enum irclass, double); #define isaddrcon(r,derefok) ((r).t == RXCON && !conht[(r).i].cls && (derefok || !conht[(r).i].deref)) #define intconval(r) ((r).t == RICON ? (r).i : conht[(r).i].i) #define fltconval(r) ((r).t == RICON ? (r).i : conht[(r).i].f) -union ref mksymref(const char *); +union ref mksymref(const char *, bool isfunc); union ref mkdatref(const char *name, union type ctype, uint siz, uint align, const void *, uint n, bool deref); const char *xcon2sym(int ref); struct instr mkalloca(uint siz, uint align); |