const elf_machine_handler * elf_set_arch(yasm_arch *arch, yasm_symtab *symtab, int bits_pref) { const char *machine = yasm_arch_get_machine(arch); int i; for (i=0, elf_march = elf_machine_handlers[0]; elf_march != NULL; elf_march = elf_machine_handlers[++i]) { if (yasm__strcasecmp(yasm_arch_keyword(arch), elf_march->arch)==0) if (yasm__strcasecmp(machine, elf_march->machine)==0) if (bits_pref == 0 || bits_pref == elf_march->bits) break; } if (elf_march && elf_march->num_ssyms > 0) { /* Allocate "special" syms */ elf_ssyms = yasm_xmalloc(elf_march->num_ssyms * sizeof(yasm_symrec *)); for (i=0; (unsigned int)i<elf_march->num_ssyms; i++) { /* FIXME: misuse of NULL bytecode */ elf_ssyms[i] = yasm_symtab_define_label(symtab, elf_march->ssyms[i].name, NULL, 0, 0); } } return elf_march; }
static void xdf_objfmt_init_new_section(yasm_section *sect, unsigned long line) { yasm_object *object = yasm_section_get_object(sect); const char *sectname = yasm_section_get_name(sect); yasm_objfmt_xdf *objfmt_xdf = (yasm_objfmt_xdf *)object->objfmt; xdf_section_data *data; yasm_symrec *sym; data = yasm_xmalloc(sizeof(xdf_section_data)); data->scnum = objfmt_xdf->parse_scnum++; data->flags = 0; data->addr = NULL; data->vaddr = NULL; data->scnptr = 0; data->size = 0; data->relptr = 0; data->nreloc = 0; yasm_section_add_data(sect, &xdf_section_data_cb, data); sym = yasm_symtab_define_label(object->symtab, sectname, yasm_section_bcs_first(sect), 1, line); data->sym = sym; }