00001
00034 #ifndef YASM_SECTION_H
00035 #define YASM_SECTION_H
00036
00037 #ifndef YASM_LIB_DECL
00038 #define YASM_LIB_DECL
00039 #endif
00040
00044 typedef struct yasm_reloc yasm_reloc;
00045
00046 struct yasm_reloc {
00047 STAILQ_ENTRY(yasm_reloc) link;
00048 yasm_intnum *addr;
00049 yasm_symrec *sym;
00050 };
00051
00053 struct yasm_object {
00054 char *src_filename;
00055 char *obj_filename;
00057 yasm_symtab *symtab;
00058 yasm_arch *arch;
00059 yasm_objfmt *objfmt;
00060 yasm_dbgfmt *dbgfmt;
00065 yasm_section *cur_section;
00066
00068 STAILQ_HEAD(yasm_sectionhead, yasm_section) sections;
00069
00073 struct HAMT *directives;
00074
00076 char *global_prefix;
00077
00079 char *global_suffix;
00080 };
00081
00092 YASM_LIB_DECL
00093 yasm_object *yasm_object_create
00094 (const char *src_filename, const char *obj_filename,
00095 yasm_arch *arch,
00096 const yasm_objfmt_module *objfmt_module,
00097 const yasm_dbgfmt_module *dbgfmt_module);
00098
00113 YASM_LIB_DECL
00114 yasm_section *yasm_object_get_general
00115 (yasm_object *object, const char *name, unsigned long align, int code,
00116 int res_only, int *isnew, unsigned long line);
00117
00128 YASM_LIB_DECL
00129 int yasm_object_directive(yasm_object *object, const char *name,
00130 const char *parser, yasm_valparamhead *valparams,
00131 yasm_valparamhead *objext_valparams,
00132 unsigned long line);
00133
00138 YASM_LIB_DECL
00139 void yasm_object_destroy( yasm_object *object);
00140
00146 YASM_LIB_DECL
00147 void yasm_object_print(const yasm_object *object, FILE *f, int indent_level);
00148
00154 YASM_LIB_DECL
00155 void yasm_object_finalize(yasm_object *object, yasm_errwarns *errwarns);
00156
00164 YASM_LIB_DECL
00165 int yasm_object_sections_traverse
00166 (yasm_object *object, void *d,
00167 int (*func) (yasm_section *sect, void *d));
00168
00174 YASM_LIB_DECL
00175 yasm_section *yasm_object_find_general
00176 (yasm_object *object, const char *name);
00177
00182 YASM_LIB_DECL
00183 void yasm_object_set_source_fn(yasm_object *object, const char *src_filename);
00184
00189 YASM_LIB_DECL
00190 void yasm_object_set_global_prefix(yasm_object *object, const char *prefix);
00191
00196 YASM_LIB_DECL
00197 void yasm_object_set_global_suffix(yasm_object *object, const char *suffix);
00198
00205 YASM_LIB_DECL
00206 void yasm_object_optimize(yasm_object *object, yasm_errwarns *errwarns);
00207
00212 YASM_LIB_DECL
00213 int yasm_section_is_code(yasm_section *sect);
00214
00219 YASM_LIB_DECL
00220 unsigned long yasm_section_get_opt_flags(const yasm_section *sect);
00221
00226 YASM_LIB_DECL
00227 void yasm_section_set_opt_flags(yasm_section *sect, unsigned long opt_flags);
00228
00234 YASM_LIB_DECL
00235 int yasm_section_is_default(const yasm_section *sect);
00236
00241 YASM_LIB_DECL
00242 void yasm_section_set_default(yasm_section *sect, int def);
00243
00248 YASM_LIB_DECL
00249 yasm_object *yasm_section_get_object(const yasm_section *sect);
00250
00256 YASM_LIB_DECL
00257 void *yasm_section_get_data
00258 (yasm_section *sect, const yasm_assoc_data_callback *callback);
00259
00266 YASM_LIB_DECL
00267 void yasm_section_add_data(yasm_section *sect,
00268 const yasm_assoc_data_callback *callback,
00269 void *data);
00270
00280 YASM_LIB_DECL
00281 void yasm_section_add_reloc(yasm_section *sect, yasm_reloc *reloc,
00282 void (*destroy_func) ( void *reloc));
00283
00288 YASM_LIB_DECL
00289 yasm_reloc *yasm_section_relocs_first(yasm_section *sect);
00290
00295 yasm_reloc *yasm_section_reloc_next(yasm_reloc *reloc);
00296 #ifndef YASM_DOXYGEN
00297 #define yasm_section_reloc_next(x) STAILQ_NEXT((x), link)
00298 #endif
00299
00305 YASM_LIB_DECL
00306 void yasm_reloc_get(yasm_reloc *reloc, yasm_intnum **addrp,
00307 yasm_symrec **symp);
00308
00314 YASM_LIB_DECL
00315 yasm_bytecode *yasm_section_bcs_first(yasm_section *sect);
00316
00322 YASM_LIB_DECL
00323 yasm_bytecode *yasm_section_bcs_last(yasm_section *sect);
00324
00334 YASM_LIB_DECL
00335 yasm_bytecode *yasm_section_bcs_append
00336 (yasm_section *sect,
00337 yasm_bytecode *bc);
00338
00349 YASM_LIB_DECL
00350 int yasm_section_bcs_traverse
00351 (yasm_section *sect, yasm_errwarns *errwarns,
00352 void *d, int (*func) (yasm_bytecode *bc, void *d));
00353
00358 YASM_LIB_DECL
00359 const char *yasm_section_get_name(const yasm_section *sect);
00360
00366 YASM_LIB_DECL
00367 void yasm_section_set_align(yasm_section *sect, unsigned long align,
00368 unsigned long line);
00369
00374 YASM_LIB_DECL
00375 unsigned long yasm_section_get_align(const yasm_section *sect);
00376
00383 YASM_LIB_DECL
00384 void yasm_section_print( const yasm_section *sect, FILE *f,
00385 int indent_level, int print_bcs);
00386
00387 #endif