libyasm

libyasm/section.h

Go to the documentation of this file.
00001 
00030 #ifndef YASM_SECTION_H
00031 #define YASM_SECTION_H
00032 
00033 #ifndef YASM_LIB_DECL
00034 #define YASM_LIB_DECL
00035 #endif
00036 
00040 typedef struct yasm_reloc yasm_reloc;
00041 
00042 struct yasm_reloc {
00043     /*@reldef@*/ STAILQ_ENTRY(yasm_reloc) link; 
00044     yasm_intnum *addr;          
00045     /*@dependent@*/ yasm_symrec *sym;       
00046 };
00047 
00049 struct yasm_object {
00050     /*@owned@*/ char *src_filename;     
00051     /*@owned@*/ char *obj_filename;     
00053     /*@owned@*/ yasm_symtab *symtab;    
00054     /*@owned@*/ yasm_arch *arch;        
00055     /*@owned@*/ yasm_objfmt *objfmt;    
00056     /*@owned@*/ yasm_dbgfmt *dbgfmt;    
00061     /*@dependent@*/ /*@null@*/ yasm_section *cur_section;
00062 
00064     /*@reldef@*/ STAILQ_HEAD(yasm_sectionhead, yasm_section) sections;
00065 
00069     /*@owned@*/ struct HAMT *directives;
00070 
00072     /*@owned@*/ char *global_prefix;
00073 
00075     /*@owned@*/ char *global_suffix;
00076 };
00077 
00088 YASM_LIB_DECL
00089 /*@null@*/ /*@only@*/ yasm_object *yasm_object_create
00090     (const char *src_filename, const char *obj_filename,
00091      /*@kept@*/ yasm_arch *arch,
00092      const yasm_objfmt_module *objfmt_module,
00093      const yasm_dbgfmt_module *dbgfmt_module);
00094 
00109 YASM_LIB_DECL
00110 /*@dependent@*/ yasm_section *yasm_object_get_general
00111     (yasm_object *object, const char *name, unsigned long align, int code,
00112      int res_only, /*@out@*/ int *isnew, unsigned long line);
00113 
00124 YASM_LIB_DECL
00125 int yasm_object_directive(yasm_object *object, const char *name,
00126                           const char *parser, yasm_valparamhead *valparams,
00127                           yasm_valparamhead *objext_valparams,
00128                           unsigned long line);
00129 
00134 YASM_LIB_DECL
00135 void yasm_object_destroy(/*@only@*/ yasm_object *object);
00136 
00142 YASM_LIB_DECL
00143 void yasm_object_print(const yasm_object *object, FILE *f, int indent_level);
00144 
00150 YASM_LIB_DECL
00151 void yasm_object_finalize(yasm_object *object, yasm_errwarns *errwarns);
00152 
00160 YASM_LIB_DECL
00161 int yasm_object_sections_traverse
00162     (yasm_object *object, /*@null@*/ void *d,
00163      int (*func) (yasm_section *sect, /*@null@*/ void *d));
00164 
00170 YASM_LIB_DECL
00171 /*@dependent@*/ /*@null@*/ yasm_section *yasm_object_find_general
00172     (yasm_object *object, const char *name);
00173 
00178 YASM_LIB_DECL
00179 void yasm_object_set_source_fn(yasm_object *object, const char *src_filename);
00180 
00185 YASM_LIB_DECL
00186 void yasm_object_set_global_prefix(yasm_object *object, const char *prefix);
00187 
00192 YASM_LIB_DECL
00193 void yasm_object_set_global_suffix(yasm_object *object, const char *suffix);
00194 
00201 YASM_LIB_DECL
00202 void yasm_object_optimize(yasm_object *object, yasm_errwarns *errwarns);
00203 
00208 YASM_LIB_DECL
00209 int yasm_section_is_code(yasm_section *sect);
00210 
00215 YASM_LIB_DECL
00216 unsigned long yasm_section_get_opt_flags(const yasm_section *sect);
00217 
00222 YASM_LIB_DECL
00223 void yasm_section_set_opt_flags(yasm_section *sect, unsigned long opt_flags);
00224 
00230 YASM_LIB_DECL
00231 int yasm_section_is_default(const yasm_section *sect);
00232 
00237 YASM_LIB_DECL
00238 void yasm_section_set_default(yasm_section *sect, int def);
00239 
00244 YASM_LIB_DECL
00245 yasm_object *yasm_section_get_object(const yasm_section *sect);
00246 
00252 YASM_LIB_DECL
00253 /*@dependent@*/ /*@null@*/ void *yasm_section_get_data
00254     (yasm_section *sect, const yasm_assoc_data_callback *callback);
00255 
00262 YASM_LIB_DECL
00263 void yasm_section_add_data(yasm_section *sect,
00264                            const yasm_assoc_data_callback *callback,
00265                            /*@null@*/ /*@only@*/ void *data);
00266 
00276 YASM_LIB_DECL
00277 void yasm_section_add_reloc(yasm_section *sect, yasm_reloc *reloc,
00278     void (*destroy_func) (/*@only@*/ void *reloc));
00279 
00284 YASM_LIB_DECL
00285 /*@null@*/ yasm_reloc *yasm_section_relocs_first(yasm_section *sect);
00286 
00291 /*@null@*/ yasm_reloc *yasm_section_reloc_next(yasm_reloc *reloc);
00292 #ifndef YASM_DOXYGEN
00293 #define yasm_section_reloc_next(x)      STAILQ_NEXT((x), link)
00294 #endif
00295 
00301 YASM_LIB_DECL
00302 void yasm_reloc_get(yasm_reloc *reloc, yasm_intnum **addrp,
00303                     /*@dependent@*/ yasm_symrec **symp);
00304 
00310 YASM_LIB_DECL
00311 yasm_bytecode *yasm_section_bcs_first(yasm_section *sect);
00312 
00318 YASM_LIB_DECL
00319 yasm_bytecode *yasm_section_bcs_last(yasm_section *sect);
00320 
00330 YASM_LIB_DECL
00331 /*@only@*/ /*@null@*/ yasm_bytecode *yasm_section_bcs_append
00332     (yasm_section *sect,
00333      /*@returned@*/ /*@only@*/ /*@null@*/ yasm_bytecode *bc);
00334 
00345 YASM_LIB_DECL
00346 int yasm_section_bcs_traverse
00347     (yasm_section *sect, /*@null@*/ yasm_errwarns *errwarns,
00348      /*@null@*/ void *d, int (*func) (yasm_bytecode *bc, /*@null@*/ void *d));
00349 
00354 YASM_LIB_DECL
00355 /*@observer@*/ const char *yasm_section_get_name(const yasm_section *sect);
00356 
00362 YASM_LIB_DECL
00363 void yasm_section_set_align(yasm_section *sect, unsigned long align,
00364                             unsigned long line);
00365 
00370 YASM_LIB_DECL
00371 unsigned long yasm_section_get_align(const yasm_section *sect);
00372 
00379 YASM_LIB_DECL
00380 void yasm_section_print(/*@null@*/ const yasm_section *sect, FILE *f,
00381                         int indent_level, int print_bcs);
00382 
00383 #endif