diff options
author | Mike Pall <mike> | 2011-03-26 18:40:11 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-03-26 18:40:11 +0100 |
commit | b6ed9848434548a9dfbaff5491b4fc375689e4ec (patch) | |
tree | c389c91765b99afd9f50c9527a076f0df9c90d73 | |
parent | 156bf1578363c58f4bb1f1be9ba7e9758c94dd75 (diff) | |
download | luajit-b6ed9848434548a9dfbaff5491b4fc375689e4ec.tar.gz luajit-b6ed9848434548a9dfbaff5491b4fc375689e4ec.tar.bz2 luajit-b6ed9848434548a9dfbaff5491b4fc375689e4ec.zip |
ARM: Add support for ARM relocations to buildvm.
-rw-r--r-- | dynasm/dasm_arm.lua | 2 | ||||
-rw-r--r-- | src/buildvm_asm.c | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/dynasm/dasm_arm.lua b/dynasm/dasm_arm.lua index 37ba7fab..011757c1 100644 --- a/dynasm/dasm_arm.lua +++ b/dynasm/dasm_arm.lua | |||
@@ -723,7 +723,7 @@ map_op[".template__"] = function(params, template, nparams) | |||
723 | op = op + parse_gpr(p) | 723 | op = op + parse_gpr(p) |
724 | else | 724 | else |
725 | if op < 0xe0000000 then werror("unconditional instruction") end | 725 | if op < 0xe0000000 then werror("unconditional instruction") end |
726 | local mode, n, s = parse_label(params[n], false) | 726 | local mode, n, s = parse_label(p, false) |
727 | waction("REL_"..mode, n, s, 1) | 727 | waction("REL_"..mode, n, s, 1) |
728 | op = 0xfa000000 | 728 | op = 0xfa000000 |
729 | end | 729 | end |
diff --git a/src/buildvm_asm.c b/src/buildvm_asm.c index 1f5d59a3..6468912c 100644 --- a/src/buildvm_asm.c +++ b/src/buildvm_asm.c | |||
@@ -96,7 +96,17 @@ static void emit_asm_wordreloc(BuildCtx *ctx, uint8_t *p, int n, | |||
96 | emit_asm_words(ctx, p, n-4); | 96 | emit_asm_words(ctx, p, n-4); |
97 | ins = *(uint32_t *)(p+n-4); | 97 | ins = *(uint32_t *)(p+n-4); |
98 | #if LJ_TARGET_ARM | 98 | #if LJ_TARGET_ARM |
99 | UNUSED(sym); /* NYI */ | 99 | if ((ins & 0xff000000u) == 0xfa000000u) { |
100 | fprintf(ctx->fp, "\tblx %s\n", sym); | ||
101 | } else if ((ins & 0x0e000000u) == 0x0a000000u) { | ||
102 | fprintf(ctx->fp, "\t%s%.2s %s\n", (ins & 0x01000000u) ? "bl" : "b", | ||
103 | "eqnecsccmiplvsvchilsgeltgtle" + 2*(ins >> 28), sym); | ||
104 | } else { | ||
105 | fprintf(stderr, | ||
106 | "Error: unsupported opcode %08x for %s symbol relocation.\n", | ||
107 | ins, sym); | ||
108 | exit(1); | ||
109 | } | ||
100 | #elif LJ_TARGET_PPC | 110 | #elif LJ_TARGET_PPC |
101 | if ((ins >> 26) == 16) { | 111 | if ((ins >> 26) == 16) { |
102 | fprintf(ctx->fp, "\t%s %d, %d, %s\n", | 112 | fprintf(ctx->fp, "\t%s %d, %d, %s\n", |
@@ -185,7 +195,7 @@ void emit_asm(BuildCtx *ctx) | |||
185 | int32_t ofs = ctx->sym[i].ofs; | 195 | int32_t ofs = ctx->sym[i].ofs; |
186 | int32_t next = ctx->sym[i+1].ofs; | 196 | int32_t next = ctx->sym[i+1].ofs; |
187 | emit_asm_label(ctx, ctx->sym[i].name, next - ofs, 1); | 197 | emit_asm_label(ctx, ctx->sym[i].name, next - ofs, 1); |
188 | while (rel < ctx->nreloc && ctx->reloc[rel].ofs < next) { | 198 | while (rel < ctx->nreloc && ctx->reloc[rel].ofs <= next) { |
189 | BuildReloc *r = &ctx->reloc[rel]; | 199 | BuildReloc *r = &ctx->reloc[rel]; |
190 | int n = r->ofs - ofs; | 200 | int n = r->ofs - ofs; |
191 | #if LJ_TARGET_X86ORX64 | 201 | #if LJ_TARGET_X86ORX64 |