Ticket #41288: luajit_tiger_leopard.patch.txt

File luajit_tiger_leopard.patch.txt, 2.5 KB (added by mackyle@…, 10 years ago)

Patch to build on intel 10.4 and 10.5 both 32-bit and 64-bit (replaces luajit_patch_leopard.diff.txt​)

Line 
1From fcc4e51e8196dfbc783b0e2b6d87cf44729092bc Mon Sep 17 00:00:00 2001
2From: "Kyle J. McKay" <mackyle@gmail.com>
3Date: Sat, 18 Jan 2014 05:01:08 -0800
4Subject: [PATCH] vm_x86.dasc: support building on OS X 10.4 and 10.5 intel
5
6The .uleb128 pseudo op is not supported by the older assemblers
7included with OS X 10.4 and 10.5.  Since the values being
8encoded are in the range 0x00-0x7F, simply replace the .uleb128
9pseudo op with .byte instead since that's what .uleb128 would
10generate for values in that range.
11
12The -fno-stack-protector option is not recognized by the older
13compiler included with OS X 10.4.  Only add the option when
14running on OS X 10.5 or later.
15
16Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
17---
18
19Patch is against master (ef59e548).
20
21With this patch I can successfully build and run on 32-bit 10.4 intel
22and 32-bit and 64-bit 10.5 intel.  Did not try 10.4 64-bit intel, but
23this patch should allow it to work as well.
24
25 src/Makefile    | 4 +++-
26 src/vm_x86.dasc | 4 ++--
27 2 files changed, 5 insertions(+), 3 deletions(-)
28
29diff --git a/src/Makefile b/src/Makefile
30index 6b4c9f93..ed6daa1b 100644
31--- a/src/Makefile
32+++ b/src/Makefile
33@@ -294,7 +294,9 @@ ifeq (Darwin,$(TARGET_SYS))
34   endif
35   TARGET_STRIP+= -x
36   TARGET_AR+= 2>/dev/null
37-  TARGET_XCFLAGS+= -fno-stack-protector
38+  ifneq (,$(shell if test `sysctl -n kern.osrelease | cut -d. -f1` -ge 9; then echo 1; fi))
39+    TARGET_XCFLAGS+= -fno-stack-protector
40+  endif
41   TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
42   TARGET_DYNXLDOPTS=
43   TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
44diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc
45index a36d2aa7..8a9b536d 100644
46--- a/src/vm_x86.dasc
47+++ b/src/vm_x86.dasc
48@@ -6344,12 +6344,12 @@ static void emit_asm_debug(BuildCtx *ctx)
49 #if LJ_64
50          "\t.byte 0xe\n\t.byte 16\n"           /* def_cfa_offset */
51          "\t.byte 0x86\n\t.byte 0x2\n"         /* offset rbp */
52-         "\t.byte 0xd\n\t.uleb128 0x6\n"       /* def_cfa_register rbp */
53+         "\t.byte 0xd\n\t.byte 0x6\n"          /* def_cfa_register rbp */
54          "\t.byte 0x83\n\t.byte 0x3\n"         /* offset rbx */
55 #else
56          "\t.byte 0xe\n\t.byte 8\n"            /* def_cfa_offset */
57          "\t.byte 0x84\n\t.byte 0x2\n"         /* offset ebp (4 for MACH-O)*/
58-         "\t.byte 0xd\n\t.uleb128 0x4\n"       /* def_cfa_register ebp */
59+         "\t.byte 0xd\n\t.byte 0x4\n"          /* def_cfa_register ebp */
60          "\t.byte 0x83\n\t.byte 0x3\n"         /* offset ebx */
61 #endif
62          "\t.align " BSZPTR "\n"
63--
641.8.5
65