All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
linker.c File Reference


#define QFOSTR(q, s)   QFO_GETSTR (q, s)
#define QFOTYPE(t)
#define REF(r)   (work->spaces[(r)->space].defs + (r)->def)
 Retreive a def from a defref. More...
#define WORKSTR(s)   QFOSTR (work, s)
#define WORKTYPE(t)


typedef struct builtin_sym_s builtin_sym_t
typedef struct defref_s defref_t
 Safe handling of defs in hash tables and other containers. More...
typedef struct path_s path_t
typedef int(* space_func )(qfo_t *qfo, qfo_mspace_t *space, int pass)


void linker_add_def (const char *name, type_t *type, unsigned flags, void *val)
int linker_add_lib (const char *libname)
int linker_add_object_file (const char *filename)
void linker_add_path (const char *path)
int linker_add_qfo (qfo_t *qfo)
int linker_add_string (const char *str)
 Add a string to the working qfo string pool. More...
void linker_begin (void)
 Initialize the linker state. More...
qfo_def_tlinker_find_def (const char *name)
qfo_tlinker_finish (void)

Macro Definition Documentation

#define QFOSTR (   q,
)    QFO_GETSTR (q, s)
#define QFOTYPE (   t)
((qfot_type_t *) (char *) \
(qfo_type_defs->d.data + (t)))
pr_type_t * data
Definition: obj_file.h:254
union qfo_mspace_s::@63 d
QFO type encoding.
Definition: obj_type.h:88
#define REF (   r)    (work->spaces[(r)->space].defs + (r)->def)

Retreive a def from a defref.

rThe defref pointing to the def (defref_t *).
A pointer to the def (qfo_def_t *).
#define WORKSTR (   s)    QFOSTR (work, s)
#define WORKTYPE (   t)
((qfot_type_t *) (char *) \
(work_type_data->data + (t)))
pr_type_t * data
backing memory for this space
Definition: defspace.h:57
QFO type encoding.
Definition: obj_type.h:88

Typedef Documentation

typedef struct builtin_sym_s builtin_sym_t
typedef struct defref_s defref_t

Safe handling of defs in hash tables and other containers.

As defs are stored in dynamic arrays, storing pointers to the defs is a recipe for disaster when using realloc(). By storing the address of the pointer to the array and the index into that that array, realloc is allowed to do its magic.

typedef struct path_s path_t
typedef int(* space_func)(qfo_t *qfo, qfo_mspace_t *space, int pass)

Function Documentation

void linker_add_def ( const char *  name,
type_t type,
unsigned  flags,
void *  val 
int linker_add_lib ( const char *  libname)
int linker_add_object_file ( const char *  filename)
void linker_add_path ( const char *  path)
int linker_add_qfo ( qfo_t qfo)
int linker_add_string ( const char *  str)

Add a string to the working qfo string pool.

If the string is already in the string pool, the already existing string index will be returned instead of adding a second copy of the string.

The strings space in the working qfo is kept up to date.

strThe string to add.
The string offset in the working qfo string pool.
void linker_begin ( void  )

Initialize the linker state.

qfo_def_t* linker_find_def ( const char *  name)
qfo_t* linker_finish ( void  )