mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Make .type_encodings more useful.
Rather than just a pointer, it is now a struct with a pointer and size indicating the extent of the type encodings block.
This commit is contained in:
parent
74ac4ee142
commit
9691b50f0f
5 changed files with 23 additions and 3 deletions
|
@ -99,6 +99,11 @@ typedef struct qfot_type_s {
|
|||
} t;
|
||||
} qfot_type_t;
|
||||
|
||||
typedef struct qfot_type_encodings_s {
|
||||
pointer_t types;
|
||||
pr_int_t size;
|
||||
} qfot_type_encodings_t;
|
||||
|
||||
struct type_s;
|
||||
struct def_s *qfo_encode_type (struct type_s *type);
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ extern type_t *type_default; // default type (float or int)
|
|||
extern type_t type_va_list;
|
||||
extern type_t type_param;
|
||||
extern type_t type_zero;
|
||||
extern type_t type_type_encodings;
|
||||
|
||||
extern struct symtab_s *vector_struct;
|
||||
extern struct symtab_s *quaternion_struct;
|
||||
|
|
|
@ -918,8 +918,12 @@ 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;
|
||||
if (types_def) {
|
||||
qfot_type_encodings_t *encodings;
|
||||
encodings = (qfot_type_encodings_t *) &globals[types_def->offset];
|
||||
encodings->types = type_data - globals;
|
||||
encodings->size = qfo->spaces[qfo_type_space].data_size;
|
||||
}
|
||||
|
||||
// undo the relocation of the offsets of local defs so the local defs have
|
||||
// the correct offset in the debug info
|
||||
|
|
|
@ -402,7 +402,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);
|
||||
linker_add_def (".type_encodings", &type_type_encodings, flags, 0);
|
||||
|
||||
qfo = linker_finish ();
|
||||
if (!qfo)
|
||||
|
|
|
@ -83,6 +83,7 @@ type_t *type_default;
|
|||
type_t type_va_list = { ev_invalid, "@va_list", ty_struct };
|
||||
type_t type_param = { ev_invalid, "@param", ty_struct };
|
||||
type_t type_zero = { ev_invalid, "@zero", ty_struct };
|
||||
type_t type_type_encodings = { ev_invalid, "@type_encodings", ty_struct };
|
||||
|
||||
type_t type_floatfield = { ev_field, ".float", ty_none, {{&type_float}} };
|
||||
|
||||
|
@ -850,6 +851,11 @@ init_types (void)
|
|||
{"v", &type_vector},
|
||||
{0, 0}
|
||||
};
|
||||
static struct_def_t type_encoding_struct[] = {
|
||||
{"types", &type_pointer},
|
||||
{"size", &type_integer},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
type_nil = &type_quaternion;
|
||||
type_default = &type_integer;
|
||||
|
@ -869,6 +875,9 @@ init_types (void)
|
|||
type_vector.type = ev_vector;
|
||||
type_vector.meta = ty_none;
|
||||
|
||||
make_structure ("@type_encodings", 's', type_encoding_struct,
|
||||
&type_type_encodings);
|
||||
|
||||
if (options.traditional)
|
||||
return;
|
||||
|
||||
|
@ -905,6 +914,7 @@ chain_initial_types (void)
|
|||
|
||||
chain_type (&type_param);
|
||||
chain_type (&type_zero);
|
||||
chain_type (&type_type_encodings);
|
||||
|
||||
va_list_struct[1].type = pointer_type (&type_param);
|
||||
make_structure ("@va_list", 's', va_list_struct, &type_va_list);
|
||||
|
|
Loading…
Reference in a new issue