Set the target of string relocs to the string index.

This commit is contained in:
Bill Currie 2011-03-04 21:29:10 +09:00
parent 7fb22bd1e4
commit bc78b84869
2 changed files with 10 additions and 5 deletions

View file

@ -302,9 +302,8 @@ qfo_relocs (qfo_t *qfo)
break;
case rel_def_string:
printf (" def@%d:%x string:%x `%s'",
reloc->space, reloc->offset,
QFO_STRING (qfo, reloc->space, reloc->offset),
QFO_GSTRING (qfo, reloc->space, reloc->offset));
reloc->space, reloc->offset, reloc->target,
QFO_GETSTR (qfo, reloc->target));
break;
case rel_def_field:
def = qfo->defs + reloc->target;

View file

@ -315,11 +315,17 @@ qfo_from_progs (pr_info_t *pr)
qfo->num_loose_relocs = qfo->num_relocs - (reloc - qfo->relocs);
for (r = pr->relocs; r; r = r->next) {
if (r->type == rel_def_op)
if (r->type == rel_def_op) {
qfo_encode_one_reloc (r, &reloc, r->label->dest->offset);
else
} else if (r->type == rel_def_string) {
def_t d;
d.space = r->space;
d.offset = r->offset;
qfo_encode_one_reloc (r, &reloc, D_STRING (&d));
} else {
qfo_encode_one_reloc (r, &reloc, 0);
}
}
return qfo;
}