The unified diff between revisions [58a3ccba..] and [63fe9cf9..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'src/lsc/codegen.c'
# # old_revision [58a3ccba47e51398ea76582c5b4a94bf8af04187] # new_revision [63fe9cf91eccf15b977d5be7600ee10a17d08d95] # # patch "src/lsc/codegen.c" # from [0066fecf055581632eaebac395d4caacee9c44d2] # to [eadf986764263a936e4e1daa589e245ccee66212] # ============================================================ --- src/lsc/codegen.c 0066fecf055581632eaebac395d4caacee9c44d2 +++ src/lsc/codegen.c eadf986764263a936e4e1daa589e245ccee66212 @@ -140,7 +140,7 @@ void output_functions_action(struct hash pad = (4 - (len % 4)) % 4; output_int(len+pad); output_int(0); /* type */ - output_int(get_label(ptr->value) + 8); + output_int(get_label(ptr->value) + 28); output_int(0); /* nargs */ output_string(ptr->name); output_byte(0); /* terminator */ @@ -267,9 +267,11 @@ int lookup_function(ast *node, struct fn return 1; } -int lookup_constant(ast *node, int *constant) +#define lookup_constant(node, constant) \ + lookup_constant_string(node->info.string, constant) + +int lookup_constant_string(char *constantname, int *constant) { - char *constantname = node->info.string; struct hashentry *hashptr; if (constant_count < 0) @@ -1185,6 +1187,7 @@ void output_code(void) int morepasses = 1; int passno = 0; int pc; + int abiver; while (morepasses) { ptr = instr_head; @@ -1259,10 +1262,24 @@ void output_code(void) output_byte(VERSION1); output_byte(VERSION2); +#define ABIVERSION(x) do { \ + abiver = 0; \ + if (!lookup_constant_string(x, &abiver)) \ + printf("%s not defined\n", x); \ + output_int(abiver); \ + printf("ABIVERSION(%s) = %x\n", x, abiver); \ + } while (0) + pc = (pc + 3) & ~3; /* Align table */ - output_int(pc+8); /* Pointer to function table */ + output_int(pc+28); /* Pointer to function table */ + ABIVERSION("__abiversion1"); + ABIVERSION("__abiversion2"); + ABIVERSION("__abiversion3"); + ABIVERSION("__abiversion4"); + ABIVERSION("__abiversion5"); + ptr = instr_head; pc = 0; while (ptr) {