aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-03-22 17:22:15 +0100
committerlemon <lsof@mailbox.org>2026-03-22 17:22:15 +0100
commit2d0b096a8c2f45370ef2535e1c500a008b949611 (patch)
tree287d4646b6a0236224a29381860106dbdaf8473f
parentadf244459ef6946c2050764906357a4ec4010b3f (diff)
eval: fix errata in EGETF addr case
The symref given by staticaddrof is in ex2, not sub. This worked by chance (with sub->ssym.off happening to be zero) on linux, but on OpenBSD it would give garbage. Which would result in messed up relocations later leading to miscompilations.
-rw-r--r--src/c_eval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/c_eval.c b/src/c_eval.c
index 927ea05..e2033a3 100644
--- a/src/c_eval.c
+++ b/src/c_eval.c
@@ -201,7 +201,7 @@ unop(Expr *ex, enum evalmode mode)
} else {
assert(ex2.t == ESSYMREF);
ex->t = ESSYMREF;
- vlong off = (vlong) sub->ssym.off + ex->fld.off;
+ vlong off = (vlong) ex2.ssym.off + ex->fld.off;
if ((int) off != off) return 0;
ex->ssym = ex2.ssym;
ex->ssym.off = off;