Make the type encodings findable.

The base of the type encodings block is given by the .type_encodings def.
The block begins with a "null" type (4 words of 0), followed by the first
type encoding.

At some stage, I will need to add information for extended def information
(32 bit offset, type encoding, other?), but this is good for initial
testing.
This commit is contained in:
Bill Currie 2012-11-09 11:43:19 +09:00
parent 1d060d1ac1
commit 4ef4711c3b
2 changed files with 8 additions and 2 deletions

View file

@ -772,6 +772,7 @@ qfo_to_progs (qfo_t *qfo, int *size)
pr_type_t *far_data;
pr_type_t *type_data;
dprograms_t *progs;
qfo_def_t *types_def = 0;
int i, j;
int locals_size = 0;
int locals_start;
@ -872,8 +873,10 @@ qfo_to_progs (qfo_t *qfo, int *size)
}
for (i = 0; i < qfo->spaces[qfo_near_data_space].num_defs; i++) {
convert_def (qfo, qfo->spaces[qfo_near_data_space].defs + i,
globaldefs++);
qfo_def_t *def = qfo->spaces[qfo_near_data_space].defs + i;
if (!strcmp (QFO_GETSTR (qfo, def->name), ".type_encodings"))
types_def = def;
convert_def (qfo, def, globaldefs++);
}
//FIXME ddef offsets are 16 bits
@ -908,6 +911,8 @@ qfo_to_progs (qfo_t *qfo, int *size)
qfo->spaces[qfo_type_space].d.data = type_data;
qfo_relocate_refs (qfo);
if (types_def)
globals[types_def->offset].pointer_var = type_data - globals;
// undo the relocation of the offsets of local defs so the local defs have
// the correct offset in the debug info

View file

@ -399,6 +399,7 @@ finish_link (void)
str = linker_add_string (options.debug_file);
linker_add_def (".debug_file", &type_string, flags, str);
}
linker_add_def (".type_encodings", &type_pointer, flags, 0);
qfo = linker_finish ();
if (!qfo)