From 361827c8f986a73cdccfc98ad16fe9f33ed6fb25 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 6 Mar 2015 03:47:45 +0100 Subject: PPC64: Add build infrastructure. --- src/host/buildvm.c | 2 +- src/host/buildvm_asm.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/host') diff --git a/src/host/buildvm.c b/src/host/buildvm.c index c3e7dad2..324dd263 100644 --- a/src/host/buildvm.c +++ b/src/host/buildvm.c @@ -114,7 +114,7 @@ static const char *sym_decorate(BuildCtx *ctx, else *p = '\0'; #elif LJ_TARGET_PPC && !LJ_TARGET_CONSOLE - /* Keep @plt. */ + /* Keep @plt etc. */ #else *p = '\0'; #endif diff --git a/src/host/buildvm_asm.c b/src/host/buildvm_asm.c index fe1b589a..9b7ae53a 100644 --- a/src/host/buildvm_asm.c +++ b/src/host/buildvm_asm.c @@ -140,6 +140,14 @@ static void emit_asm_wordreloc(BuildCtx *ctx, uint8_t *p, int n, fprintf(ctx->fp, "\t%s %d, %d, " TOCPREFIX "%s\n", (ins & 1) ? "bcl" : "bc", (ins >> 21) & 31, (ins >> 16) & 31, sym); } else if ((ins >> 26) == 18) { +#if LJ_ARCH_PPC64 + const char *suffix = strchr(sym, '@'); + if (suffix && suffix[1] == 'h') { + fprintf(ctx->fp, "\taddis 11, 2, %s\n", sym); + } else if (suffix && suffix[1] == 'l') { + fprintf(ctx->fp, "\tld 12, %s\n", sym); + } else +#endif fprintf(ctx->fp, "\t%s " TOCPREFIX "%s\n", (ins & 1) ? "bl" : "b", sym); } else { fprintf(stderr, @@ -237,6 +245,9 @@ void emit_asm(BuildCtx *ctx) int i, rel; fprintf(ctx->fp, "\t.file \"buildvm_%s.dasc\"\n", ctx->dasm_arch); +#if LJ_ARCH_PPC64 + fprintf(ctx->fp, "\t.abiversion 2\n"); +#endif fprintf(ctx->fp, "\t.text\n"); emit_asm_align(ctx, 4); -- cgit v1.2.3-55-g6feb