Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PC-relative expression relocations #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion asm/assemble.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ static void out_eops(struct out_data *data, const extop *e)
data->tsegment = e->val.num.segment;
data->toffset = e->val.num.offset;
data->twrt = e->val.num.wrt;
data->relbase = 0;
data->relbase = data->offset;
if (e->val.num.segment != NO_SEG &&
(e->val.num.segment & 1)) {
data->type = OUT_SEGMENT;
Expand All @@ -666,6 +666,11 @@ static void out_eops(struct out_data *data, const extop *e)
data->type = e->val.num.relative
? OUT_RELADDR : OUT_ADDRESS;
data->flags = OUT_WRAP;

if (e->val.num.relative) {
/* Make the address absolute again */
data->toffset += data->offset;
}
}
out(data);
}
Expand Down