aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile3
-rw-r--r--src/host/buildvm_asm.c11
-rw-r--r--src/host/buildvm_peobj.c15
-rw-r--r--src/lj_arch.h6
-rw-r--r--src/vm_ppc.dasc1
5 files changed, 3 insertions, 33 deletions
diff --git a/src/Makefile b/src/Makefile
index 386f279f..1777cbe6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -461,9 +461,6 @@ ifeq (ppc,$(TARGET_LJARCH))
461 ifeq (PS3,$(TARGET_SYS)) 461 ifeq (PS3,$(TARGET_SYS))
462 DASM_AFLAGS+= -D PPE -D TOC 462 DASM_AFLAGS+= -D PPE -D TOC
463 endif 463 endif
464 ifneq (,$(findstring LJ_ARCH_PPC64 ,$(TARGET_TESTARCH)))
465 DASM_ARCH= ppc64
466 endif
467endif 464endif
468endif 465endif
469endif 466endif
diff --git a/src/host/buildvm_asm.c b/src/host/buildvm_asm.c
index 43595b31..85ce79f9 100644
--- a/src/host/buildvm_asm.c
+++ b/src/host/buildvm_asm.c
@@ -144,14 +144,6 @@ static void emit_asm_wordreloc(BuildCtx *ctx, uint8_t *p, int n,
144 fprintf(ctx->fp, "\t%s %d, %d, " TOCPREFIX "%s\n", 144 fprintf(ctx->fp, "\t%s %d, %d, " TOCPREFIX "%s\n",
145 (ins & 1) ? "bcl" : "bc", (ins >> 21) & 31, (ins >> 16) & 31, sym); 145 (ins & 1) ? "bcl" : "bc", (ins >> 21) & 31, (ins >> 16) & 31, sym);
146 } else if ((ins >> 26) == 18) { 146 } else if ((ins >> 26) == 18) {
147#if LJ_ARCH_PPC64
148 const char *suffix = strchr(sym, '@');
149 if (suffix && suffix[1] == 'h') {
150 fprintf(ctx->fp, "\taddis 11, 2, %s\n", sym);
151 } else if (suffix && suffix[1] == 'l') {
152 fprintf(ctx->fp, "\tld 12, %s\n", sym);
153 } else
154#endif
155 fprintf(ctx->fp, "\t%s " TOCPREFIX "%s\n", (ins & 1) ? "bl" : "b", sym); 147 fprintf(ctx->fp, "\t%s " TOCPREFIX "%s\n", (ins & 1) ? "bl" : "b", sym);
156 } else { 148 } else {
157 fprintf(stderr, 149 fprintf(stderr,
@@ -250,9 +242,6 @@ void emit_asm(BuildCtx *ctx)
250 int i, rel; 242 int i, rel;
251 243
252 fprintf(ctx->fp, "\t.file \"buildvm_%s.dasc\"\n", ctx->dasm_arch); 244 fprintf(ctx->fp, "\t.file \"buildvm_%s.dasc\"\n", ctx->dasm_arch);
253#if LJ_ARCH_PPC64
254 fprintf(ctx->fp, "\t.abiversion 2\n");
255#endif
256 fprintf(ctx->fp, "\t.text\n"); 245 fprintf(ctx->fp, "\t.text\n");
257 emit_asm_align(ctx, 4); 246 emit_asm_align(ctx, 4);
258 247
diff --git a/src/host/buildvm_peobj.c b/src/host/buildvm_peobj.c
index 2eb2bb7b..280ea8d2 100644
--- a/src/host/buildvm_peobj.c
+++ b/src/host/buildvm_peobj.c
@@ -9,7 +9,7 @@
9#include "buildvm.h" 9#include "buildvm.h"
10#include "lj_bc.h" 10#include "lj_bc.h"
11 11
12#if LJ_TARGET_X86ORX64 || LJ_TARGET_PPC 12#if LJ_TARGET_X86ORX64
13 13
14/* Context for PE object emitter. */ 14/* Context for PE object emitter. */
15static char *strtab; 15static char *strtab;
@@ -93,12 +93,6 @@ typedef struct PEsymaux {
93#define PEOBJ_RELOC_ADDR32NB 0x03 93#define PEOBJ_RELOC_ADDR32NB 0x03
94#define PEOBJ_RELOC_OFS 0 94#define PEOBJ_RELOC_OFS 0
95#define PEOBJ_TEXT_FLAGS 0x60500020 /* 60=r+x, 50=align16, 20=code. */ 95#define PEOBJ_TEXT_FLAGS 0x60500020 /* 60=r+x, 50=align16, 20=code. */
96#elif LJ_TARGET_PPC
97#define PEOBJ_ARCH_TARGET 0x01f2
98#define PEOBJ_RELOC_REL32 0x06
99#define PEOBJ_RELOC_DIR32 0x02
100#define PEOBJ_RELOC_OFS (-4)
101#define PEOBJ_TEXT_FLAGS 0x60400020 /* 60=r+x, 40=align8, 20=code. */
102#endif 96#endif
103 97
104/* Section numbers (0-based). */ 98/* Section numbers (0-based). */
@@ -251,15 +245,8 @@ void emit_peobj(BuildCtx *ctx)
251 /* Write .text section. */ 245 /* Write .text section. */
252 host_endian.u = 1; 246 host_endian.u = 1;
253 if (host_endian.b != LJ_ENDIAN_SELECT(1, 0)) { 247 if (host_endian.b != LJ_ENDIAN_SELECT(1, 0)) {
254#if LJ_TARGET_PPC
255 uint32_t *p = (uint32_t *)ctx->code;
256 int n = (int)(ctx->codesz >> 2);
257 for (i = 0; i < n; i++, p++)
258 *p = lj_bswap(*p); /* Byteswap .text section. */
259#else
260 fprintf(stderr, "Error: different byte order for host and target\n"); 248 fprintf(stderr, "Error: different byte order for host and target\n");
261 exit(1); 249 exit(1);
262#endif
263 } 250 }
264 owrite(ctx, ctx->code, ctx->codesz); 251 owrite(ctx, ctx->code, ctx->codesz);
265 for (i = 0; i < ctx->nreloc; i++) { 252 for (i = 0; i < ctx->nreloc; i++) {
diff --git a/src/lj_arch.h b/src/lj_arch.h
index cd1a0568..d561917b 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -296,9 +296,7 @@
296#define LJ_ARCH_PPC32ON64 1 296#define LJ_ARCH_PPC32ON64 1
297#define LJ_ARCH_NOFFI 1 297#define LJ_ARCH_NOFFI 1
298#elif LJ_ARCH_BITS == 64 298#elif LJ_ARCH_BITS == 64
299#define LJ_ARCH_PPC64 1 299#error "No support for PPC64"
300#define LJ_TARGET_GC64 1
301#define LJ_ARCH_NOJIT 1 /* NYI */
302#endif 300#endif
303 301
304#if _ARCH_PWR7 302#if _ARCH_PWR7
@@ -465,7 +463,7 @@
465#error "No support for ILP32 model on ARM64" 463#error "No support for ILP32 model on ARM64"
466#endif 464#endif
467#elif LJ_TARGET_PPC 465#elif LJ_TARGET_PPC
468#if !LJ_ARCH_PPC64 && (defined(_LITTLE_ENDIAN) && (!defined(_BYTE_ORDER) || (_BYTE_ORDER == _LITTLE_ENDIAN))) 466#if defined(_LITTLE_ENDIAN) && (!defined(_BYTE_ORDER) || (_BYTE_ORDER == _LITTLE_ENDIAN))
469#error "No support for little-endian PPC32" 467#error "No support for little-endian PPC32"
470#endif 468#endif
471#if defined(__NO_FPRS__) && !defined(_SOFT_FLOAT) 469#if defined(__NO_FPRS__) && !defined(_SOFT_FLOAT)
diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc
index 0839668c..51543397 100644
--- a/src/vm_ppc.dasc
+++ b/src/vm_ppc.dasc
@@ -18,7 +18,6 @@
18|// DynASM defines used by the PPC port: 18|// DynASM defines used by the PPC port:
19|// 19|//
20|// P64 64 bit pointers (only for GPR64 testing). 20|// P64 64 bit pointers (only for GPR64 testing).
21|// Note: see vm_ppc64.dasc for a full PPC64 _LP64 port.
22|// GPR64 64 bit registers (but possibly 32 bit pointers, e.g. PS3). 21|// GPR64 64 bit registers (but possibly 32 bit pointers, e.g. PS3).
23|// Affects reg saves, stack layout, carry/overflow/dot flags etc. 22|// Affects reg saves, stack layout, carry/overflow/dot flags etc.
24|// FRAME32 Use 32 bit frame layout, even with GPR64 (Xbox 360). 23|// FRAME32 Use 32 bit frame layout, even with GPR64 (Xbox 360).