aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2012-06-10 01:38:44 +0200
committerMike Pall <mike>2012-06-10 02:01:25 +0200
commitb8f5727ab4ab5656b19cdb2c71a92611836b5458 (patch)
treeafff6234da61ae8d3a513359a68c88cdb7b6159c /src
parent37be8a54785b893f531679adb0b479a426938504 (diff)
downloadluajit-b8f5727ab4ab5656b19cdb2c71a92611836b5458.tar.gz
luajit-b8f5727ab4ab5656b19cdb2c71a92611836b5458.tar.bz2
luajit-b8f5727ab4ab5656b19cdb2c71a92611836b5458.zip
CONSOLE: Fix PS3 build.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile20
-rw-r--r--src/host/buildvm_asm.c27
-rw-r--r--src/lib_io.c2
-rw-r--r--src/lib_jit.c9
-rw-r--r--src/lib_os.c5
-rw-r--r--src/lib_package.c1
-rw-r--r--src/lj_arch.h6
-rw-r--r--src/lj_def.h11
-rw-r--r--src/lj_err.c2
-rw-r--r--src/lj_jit.h11
-rw-r--r--src/lj_mcode.c2
-rw-r--r--src/vm_ppc.dasc6
12 files changed, 73 insertions, 29 deletions
diff --git a/src/Makefile b/src/Makefile
index 86b8b4fa..3f733c59 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -214,7 +214,7 @@ TARGET_XCFLAGS= $(TARGET_LFSFLAGS) -U_FORTIFY_SOURCE
214TARGET_XLDFLAGS= 214TARGET_XLDFLAGS=
215TARGET_XLIBS= -lm 215TARGET_XLIBS= -lm
216TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) 216TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS)
217TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_ARCH) $(TARGET_FLAGS) $(TARGET_CFLAGS) 217TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS)
218TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) 218TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS)
219TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) 219TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS)
220TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) 220TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS)
@@ -249,6 +249,15 @@ endif
249endif 249endif
250endif 250endif
251 251
252ifneq (,$(findstring __CELLOS_LV2__ ,$(TARGET_TESTARCH)))
253 TARGET_SYS= PS3
254 TARGET_ARCH+= -D__CELLOS_LV2__
255 TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
256endif
257ifneq (,$(findstring LJ_NO_UNWIND ,$(TARGET_TESTARCH)))
258 TARGET_ARCH+= -DLUAJIT_NO_UNWIND
259endif
260
252TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) 261TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH))
253TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH)) 262TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
254 263
@@ -277,7 +286,7 @@ ifeq (Windows,$(HOST_SYS))
277 HOST_RM= del 286 HOST_RM= del
278endif 287endif
279 288
280TARGET_SYS= $(HOST_SYS) 289TARGET_SYS?= $(HOST_SYS)
281ifeq (Windows,$(TARGET_SYS)) 290ifeq (Windows,$(TARGET_SYS))
282 TARGET_STRIP+= --strip-unneeded 291 TARGET_STRIP+= --strip-unneeded
283 TARGET_XSHLDFLAGS= -shared 292 TARGET_XSHLDFLAGS= -shared
@@ -310,7 +319,9 @@ else
310 TARGET_XCFLAGS+= -fno-stack-protector 319 TARGET_XCFLAGS+= -fno-stack-protector
311 endif 320 endif
312 ifneq (SunOS,$(TARGET_SYS)) 321 ifneq (SunOS,$(TARGET_SYS))
313 TARGET_XLDFLAGS+= -Wl,-E 322 ifneq (PS3,$(TARGET_SYS))
323 TARGET_XLDFLAGS+= -Wl,-E
324 endif
314 endif 325 endif
315 ifeq (Linux,$(TARGET_SYS)) 326 ifeq (Linux,$(TARGET_SYS))
316 TARGET_XLIBS+= -ldl 327 TARGET_XLIBS+= -ldl
@@ -463,6 +474,9 @@ endif
463ifeq (SunOS,$(TARGET_SYS)) 474ifeq (SunOS,$(TARGET_SYS))
464 BUILDMODE= static 475 BUILDMODE= static
465endif 476endif
477ifeq (PS3,$(TARGET_SYS))
478 BUILDMODE= static
479endif
466 480
467ifeq (static,$(BUILDMODE)) 481ifeq (static,$(BUILDMODE))
468 TARGET_DYNCC= @: 482 TARGET_DYNCC= @:
diff --git a/src/host/buildvm_asm.c b/src/host/buildvm_asm.c
index f975eadc..5fc31287 100644
--- a/src/host/buildvm_asm.c
+++ b/src/host/buildvm_asm.c
@@ -141,6 +141,24 @@ static void emit_asm_label(BuildCtx *ctx, const char *name, int size, int isfunc
141{ 141{
142 switch (ctx->mode) { 142 switch (ctx->mode) {
143 case BUILD_elfasm: 143 case BUILD_elfasm:
144#if LJ_TARGET_PS3
145 if (!strncmp(name, "lj_vm_", 6)) {
146 fprintf(ctx->fp,
147 "\n\t.globl %s\n"
148 "\n\t.section \".opd\",\"aw\"\n"
149 "%s:\n"
150 "\t.long .%s,.TOC.@tocbase32\n"
151 "\t.size %s,8\n"
152 "\t.previous\n"
153 "\t.globl .%s\n"
154 "\t.hidden .%s\n"
155 "\t.type .%s, " ELFASM_PX "function\n"
156 "\t.size .%s, %d\n"
157 ".%s:\n",
158 name, name, name, name, name, name, name, name, size, name);
159 break;
160 }
161#endif
144 fprintf(ctx->fp, 162 fprintf(ctx->fp,
145 "\n\t.globl %s\n" 163 "\n\t.globl %s\n"
146 "\t.hidden %s\n" 164 "\t.hidden %s\n"
@@ -196,7 +214,7 @@ void emit_asm(BuildCtx *ctx)
196 if (ctx->mode != BUILD_machasm) 214 if (ctx->mode != BUILD_machasm)
197 fprintf(ctx->fp, ".Lbegin:\n"); 215 fprintf(ctx->fp, ".Lbegin:\n");
198 216
199#if LJ_TARGET_ARM && defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND) 217#if LJ_TARGET_ARM && defined(__GNUC__) && !LJ_NO_UNWIND
200 /* This should really be moved into buildvm_arm.dasc. */ 218 /* This should really be moved into buildvm_arm.dasc. */
201 fprintf(ctx->fp, 219 fprintf(ctx->fp,
202 ".fnstart\n" 220 ".fnstart\n"
@@ -210,8 +228,7 @@ void emit_asm(BuildCtx *ctx)
210 for (i = rel = 0; i < ctx->nsym; i++) { 228 for (i = rel = 0; i < ctx->nsym; i++) {
211 int32_t ofs = ctx->sym[i].ofs; 229 int32_t ofs = ctx->sym[i].ofs;
212 int32_t next = ctx->sym[i+1].ofs; 230 int32_t next = ctx->sym[i+1].ofs;
213#if LJ_TARGET_ARM && defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND) && \ 231#if LJ_TARGET_ARM && defined(__GNUC__) && !LJ_NO_UNWIND && LJ_HASFFI
214 LJ_HASFFI
215 if (!strcmp(ctx->sym[i].name, "lj_vm_ffi_call")) 232 if (!strcmp(ctx->sym[i].name, "lj_vm_ffi_call"))
216 fprintf(ctx->fp, 233 fprintf(ctx->fp,
217 ".globl lj_err_unwind_arm\n" 234 ".globl lj_err_unwind_arm\n"
@@ -246,7 +263,7 @@ void emit_asm(BuildCtx *ctx)
246#endif 263#endif
247 } 264 }
248 265
249#if LJ_TARGET_ARM && defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND) 266#if LJ_TARGET_ARM && defined(__GNUC__) && !LJ_NO_UNWIND
250 fprintf(ctx->fp, 267 fprintf(ctx->fp,
251#if !LJ_HASFFI 268#if !LJ_HASFFI
252 ".globl lj_err_unwind_arm\n" 269 ".globl lj_err_unwind_arm\n"
@@ -262,7 +279,7 @@ void emit_asm(BuildCtx *ctx)
262#if LJ_TARGET_PPCSPE 279#if LJ_TARGET_PPCSPE
263 /* Soft-float ABI + SPE. */ 280 /* Soft-float ABI + SPE. */
264 fprintf(ctx->fp, "\t.gnu_attribute 4, 2\n\t.gnu_attribute 8, 3\n"); 281 fprintf(ctx->fp, "\t.gnu_attribute 4, 2\n\t.gnu_attribute 8, 3\n");
265#elif LJ_TARGET_PPC 282#elif LJ_TARGET_PPC && !LJ_TARGET_PS3
266 /* Hard-float ABI. */ 283 /* Hard-float ABI. */
267 fprintf(ctx->fp, "\t.gnu_attribute 4, 1\n"); 284 fprintf(ctx->fp, "\t.gnu_attribute 4, 1\n");
268#endif 285#endif
diff --git a/src/lib_io.c b/src/lib_io.c
index 90bc863b..ad99b9b7 100644
--- a/src/lib_io.c
+++ b/src/lib_io.c
@@ -405,7 +405,7 @@ LJLIB_CF(io_popen)
405#endif 405#endif
406 return iof->fp != NULL ? 1 : io_pushresult(L, 0, fname); 406 return iof->fp != NULL ? 1 : io_pushresult(L, 0, fname);
407#else 407#else
408 luaL_error(L, LUA_QL("popen") " not supported"); 408 return luaL_error(L, LUA_QL("popen") " not supported");
409#endif 409#endif
410} 410}
411 411
diff --git a/src/lib_jit.c b/src/lib_jit.c
index db6bcfa8..3687ad76 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -613,20 +613,13 @@ static uint32_t jit_cpudetect(lua_State *L)
613#endif 613#endif
614#endif 614#endif
615#elif LJ_TARGET_PPC 615#elif LJ_TARGET_PPC
616#if LJ_ARCH_PPC64 616#if LJ_HASJIT
617 flags |= JIT_F_PPC64;
618#endif
619#if LJ_ARCH_SQRT 617#if LJ_ARCH_SQRT
620 flags |= JIT_F_SQRT; 618 flags |= JIT_F_SQRT;
621#endif 619#endif
622#if LJ_ARCH_ROUND 620#if LJ_ARCH_ROUND
623 flags |= JIT_F_ROUND; 621 flags |= JIT_F_ROUND;
624#endif 622#endif
625#if LJ_ARCH_CELL
626 flags |= JIT_F_CELL;
627#endif
628#if LJ_ARCH_XENON
629 flags |= JIT_F_XENON;
630#endif 623#endif
631#elif LJ_TARGET_PPCSPE 624#elif LJ_TARGET_PPCSPE
632 /* Nothing to do. */ 625 /* Nothing to do. */
diff --git a/src/lib_os.c b/src/lib_os.c
index e968d5d5..38aada67 100644
--- a/src/lib_os.c
+++ b/src/lib_os.c
@@ -70,6 +70,10 @@ LJLIB_CF(os_rename)
70 70
71LJLIB_CF(os_tmpname) 71LJLIB_CF(os_tmpname)
72{ 72{
73#if LJ_TARGET_PS3
74 lj_err_caller(L, LJ_ERR_OSUNIQF);
75 return 0;
76#else
73#if LJ_TARGET_POSIX 77#if LJ_TARGET_POSIX
74 char buf[15+1]; 78 char buf[15+1];
75 int fp; 79 int fp;
@@ -86,6 +90,7 @@ LJLIB_CF(os_tmpname)
86#endif 90#endif
87 lua_pushstring(L, buf); 91 lua_pushstring(L, buf);
88 return 1; 92 return 1;
93#endif
89} 94}
90 95
91LJLIB_CF(os_getenv) 96LJLIB_CF(os_getenv)
diff --git a/src/lib_package.c b/src/lib_package.c
index 57344cd4..7435f6dc 100644
--- a/src/lib_package.c
+++ b/src/lib_package.c
@@ -521,6 +521,7 @@ static void setpath(lua_State *L, const char *fieldname, const char *envname,
521{ 521{
522#if LJ_TARGET_CONSOLE 522#if LJ_TARGET_CONSOLE
523 const char *path = NULL; 523 const char *path = NULL;
524 UNUSED(envname);
524#else 525#else
525 const char *path = getenv(envname); 526 const char *path = getenv(envname);
526#endif 527#endif
diff --git a/src/lj_arch.h b/src/lj_arch.h
index 476c1241..8d6830a3 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -279,7 +279,7 @@
279#if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 2) 279#if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 2)
280#error "Need at least GCC 4.2 or newer" 280#error "Need at least GCC 4.2 or newer"
281#endif 281#endif
282#else 282#elif !LJ_TARGET_PS3
283#if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 3) 283#if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 3)
284#error "Need at least GCC 4.3 or newer" 284#error "Need at least GCC 4.3 or newer"
285#endif 285#endif
@@ -379,8 +379,8 @@
379#define LUAJIT_NO_EXP2 379#define LUAJIT_NO_EXP2
380#endif 380#endif
381 381
382#if defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3 382#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3
383#define LUAJIT_NO_UNWIND 383#define LJ_NO_UNWIND 1
384#endif 384#endif
385 385
386#endif 386#endif
diff --git a/src/lj_def.h b/src/lj_def.h
index 876ce95f..27b6d6b7 100644
--- a/src/lj_def.h
+++ b/src/lj_def.h
@@ -197,7 +197,16 @@ static LJ_AINLINE uint64_t lj_bswap64(uint64_t x)
197} 197}
198#endif 198#endif
199#else 199#else
200#error "missing define for lj_bswap()" 200static LJ_AINLINE uint32_t lj_bswap(uint32_t x)
201{
202 return (x << 24) | ((x & 0xff00) << 8) | ((x >> 8) & 0xff00) | (x >> 24);
203}
204
205static LJ_AINLINE uint64_t lj_bswap64(uint64_t x)
206{
207 return (uint64_t)lj_bswap((uint32_t)(x >> 32)) |
208 ((uint64_t)lj_bswap((uint32_t)x) << 32);
209}
201#endif 210#endif
202 211
203typedef union __attribute__((packed)) Unaligned16 { 212typedef union __attribute__((packed)) Unaligned16 {
diff --git a/src/lj_err.c b/src/lj_err.c
index 05813cf8..34736b34 100644
--- a/src/lj_err.c
+++ b/src/lj_err.c
@@ -185,7 +185,7 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
185 185
186/* -- External frame unwinding -------------------------------------------- */ 186/* -- External frame unwinding -------------------------------------------- */
187 187
188#if defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND) 188#if defined(__GNUC__) && !LJ_NO_UNWIND
189 189
190/* 190/*
191** We have to use our own definitions instead of the mandatory (!) unwind.h, 191** We have to use our own definitions instead of the mandatory (!) unwind.h,
diff --git a/src/lj_jit.h b/src/lj_jit.h
index 6d317a9e..28cdd17a 100644
--- a/src/lj_jit.h
+++ b/src/lj_jit.h
@@ -35,15 +35,12 @@
35#define JIT_F_CPU_FIRST JIT_F_ARMV6 35#define JIT_F_CPU_FIRST JIT_F_ARMV6
36#define JIT_F_CPUSTRING "\5ARMv6\7ARMv6T2\5ARMv7" 36#define JIT_F_CPUSTRING "\5ARMv6\7ARMv6T2\5ARMv7"
37#elif LJ_TARGET_PPC 37#elif LJ_TARGET_PPC
38#define JIT_F_PPC64 0x00000010 38#define JIT_F_SQRT 0x00000010
39#define JIT_F_SQRT 0x00000020 39#define JIT_F_ROUND 0x00000020
40#define JIT_F_ROUND 0x00000040
41#define JIT_F_CELL 0x00000080
42#define JIT_F_XENON 0x00000100
43 40
44/* Names for the CPU-specific flags. Must match the order above. */ 41/* Names for the CPU-specific flags. Must match the order above. */
45#define JIT_F_CPU_FIRST JIT_F_PPC64 42#define JIT_F_CPU_FIRST JIT_F_SQRT
46#define JIT_F_CPUSTRING "\5PPC64\4SQRT\5ROUND\4CELL\5XENON" 43#define JIT_F_CPUSTRING "\4SQRT\5ROUND"
47#elif LJ_TARGET_MIPS 44#elif LJ_TARGET_MIPS
48#define JIT_F_MIPS32R2 0x00000010 45#define JIT_F_MIPS32R2 0x00000010
49 46
diff --git a/src/lj_mcode.c b/src/lj_mcode.c
index 41f7951a..34405b5a 100644
--- a/src/lj_mcode.c
+++ b/src/lj_mcode.c
@@ -13,6 +13,8 @@
13#include "lj_mcode.h" 13#include "lj_mcode.h"
14#include "lj_trace.h" 14#include "lj_trace.h"
15#include "lj_dispatch.h" 15#include "lj_dispatch.h"
16#endif
17#if LJ_HASJIT || LJ_HASFFI
16#include "lj_vm.h" 18#include "lj_vm.h"
17#endif 19#endif
18 20
diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc
index 49f92d0a..2c4940cd 100644
--- a/src/vm_ppc.dasc
+++ b/src/vm_ppc.dasc
@@ -4804,7 +4804,11 @@ static void emit_asm_debug(BuildCtx *ctx)
4804 "\t.long .LEFDE1-.LASFDE1\n" 4804 "\t.long .LEFDE1-.LASFDE1\n"
4805 ".LASFDE1:\n" 4805 ".LASFDE1:\n"
4806 "\t.long .Lframe0\n" 4806 "\t.long .Lframe0\n"
4807#if LJ_TARGET_PS3
4808 "\t.long .lj_vm_ffi_call\n"
4809#else
4807 "\t.long lj_vm_ffi_call\n" 4810 "\t.long lj_vm_ffi_call\n"
4811#endif
4808 "\t.long %d\n" 4812 "\t.long %d\n"
4809 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" 4813 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
4810 "\t.byte 0x8e\n\t.uleb128 2\n" 4814 "\t.byte 0x8e\n\t.uleb128 2\n"
@@ -4812,6 +4816,7 @@ static void emit_asm_debug(BuildCtx *ctx)
4812 "\t.align 2\n" 4816 "\t.align 2\n"
4813 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs); 4817 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
4814#endif 4818#endif
4819#if !LJ_NO_UNWIND
4815 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n"); 4820 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
4816 fprintf(ctx->fp, 4821 fprintf(ctx->fp,
4817 ".Lframe1:\n" 4822 ".Lframe1:\n"
@@ -4880,6 +4885,7 @@ static void emit_asm_debug(BuildCtx *ctx)
4880 "\t.align 2\n" 4885 "\t.align 2\n"
4881 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs); 4886 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
4882#endif 4887#endif
4888#endif
4883 break; 4889 break;
4884 default: 4890 default:
4885 break; 4891 break;