Revision c4687878 dyngen.c

b/dyngen.c
54 54
#define elf_check_arch(x) ( ((x) == EM_386) || ((x) == EM_486) )
55 55
#undef ELF_USES_RELOCA
56 56

  
57
#elif defined(HOST_AMD64)
57
#elif defined(HOST_X86_64)
58 58

  
59 59
#define ELF_CLASS	ELFCLASS64
60 60
#define ELF_ARCH	EM_X86_64
......
1307 1307
    p_start = text + offset;
1308 1308
    p_end = p_start + size;
1309 1309
    start_offset = offset;
1310
#if defined(HOST_I386) || defined(HOST_AMD64)
1310
#if defined(HOST_I386) || defined(HOST_X86_64)
1311 1311
#ifdef CONFIG_FORMAT_COFF
1312 1312
    {
1313 1313
        uint8_t *p;
......
1482 1482
            sym_name = get_rel_sym_name(rel);
1483 1483
            if(!sym_name)
1484 1484
                continue;
1485
            if (strstart(sym_name, "__op_param", &p)) {
1485
            if (strstart(sym_name, "__op_param", &p) ||
1486
                strstart(sym_name, "__op_gen_label", &p)) {
1486 1487
                n = strtoul(p, NULL, 10);
1487 1488
                if (n > MAX_ARGS)
1488 1489
                    error("too many arguments in %s", name);
......
1525 1526
                    continue;
1526 1527
                if (*sym_name && 
1527 1528
                    !strstart(sym_name, "__op_param", NULL) &&
1528
                    !strstart(sym_name, "__op_jmp", NULL)) {
1529
                    !strstart(sym_name, "__op_jmp", NULL) &&
1530
                    !strstart(sym_name, "__op_gen_label", NULL)) {
1529 1531
#if defined(HOST_SPARC)
1530 1532
		    if (sym_name[0] == '.') {
1531 1533
			fprintf(outfile,
......
1604 1606
                        }
1605 1607
                    }
1606 1608
#endif                    
1607

  
1608
                    if (val >= start_offset && val < start_offset + copy_size) {
1609
                    if (val >= start_offset && val <= start_offset + copy_size) {
1609 1610
                        n = strtol(p, NULL, 10);
1610 1611
                        fprintf(outfile, "    label_offsets[%d] = %ld + (gen_code_ptr - gen_code_buf);\n", n, val - start_offset);
1611 1612
                    }
......
1642 1643
                        
1643 1644
                    if (strstart(sym_name, "__op_param", &p)) {
1644 1645
                        snprintf(name, sizeof(name), "param%s", p);
1646
                    } else if (strstart(sym_name, "__op_gen_label", &p)) {
1647
                        snprintf(name, sizeof(name), "gen_labels[param%s]", p);
1645 1648
                    } else {
1646 1649
                        snprintf(name, sizeof(name), "(long)(&%s)", sym_name);
1647 1650
                    }
......
1693 1696
                }
1694 1697
                }
1695 1698
            }
1696
#elif defined(HOST_AMD64)
1699
#elif defined(HOST_X86_64)
1697 1700
            {
1698 1701
                char name[256];
1699 1702
                int type;
......
1723 1726
                                rel->r_offset - start_offset, name, rel->r_offset - start_offset, addend);
1724 1727
                        break;
1725 1728
                    default:
1726
                        error("unsupported AMD64 relocation (%d)", type);
1729
                        error("unsupported X86_64 relocation (%d)", type);
1727 1730
                    }
1728 1731
                }
1729 1732
                }
......
2232 2235
        }
2233 2236
    } else if (out_type == OUT_GEN_OP) {
2234 2237
        /* generate gen_xxx functions */
2235

  
2238
        fprintf(outfile, "#include \"dyngen-op.h\"\n");
2236 2239
        for(i = 0, sym = symtab; i < nb_syms; i++, sym++) {
2237 2240
            const char *name;
2238 2241
            name = get_sym_name(sym);
......
2250 2253
fprintf(outfile,
2251 2254
"int dyngen_code(uint8_t *gen_code_buf,\n"
2252 2255
"                uint16_t *label_offsets, uint16_t *jmp_offsets,\n"
2253
"                const uint16_t *opc_buf, const uint32_t *opparam_buf)\n"
2256
"                const uint16_t *opc_buf, const uint32_t *opparam_buf, const long *gen_labels)\n"
2254 2257
"{\n"
2255 2258
"    uint8_t *gen_code_ptr;\n"
2256 2259
"    const uint16_t *opc_ptr;\n"

Also available in: Unified diff