summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2015-08-25 10:16:39 +0200
committerMike Pall <mike>2015-08-25 10:16:39 +0200
commit0a3cd94631f1d2d1d18b641ecd25f49ed54f832e (patch)
treee932e344a590959fd7f75bf92a24de6d03f5fe96
parentba617df6f8ce4a9ab50974f993bcfe38bb4a28b4 (diff)
downloadluajit2-0a3cd94631f1d2d1d18b641ecd25f49ed54f832e.tar.gz
ARM64: Add support for saving bytecode as object files.
-rw-r--r--src/jit/bcsave.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/jit/bcsave.lua b/src/jit/bcsave.lua
index ef5a1aa9..1fe9d389 100644
--- a/src/jit/bcsave.lua
+++ b/src/jit/bcsave.lua
@@ -63,7 +63,7 @@ local map_type = {
}
local map_arch = {
- x86 = true, x64 = true, arm = true, ppc = true,
+ x86 = true, x64 = true, arm = true, arm64 = true, ppc = true,
mips = true, mipsel = true,
}
@@ -237,7 +237,7 @@ typedef struct {
hdr.eendian = isbe and 2 or 1
hdr.eversion = 1
hdr.type = f16(1)
- hdr.machine = f16(({ x86=3, x64=62, arm=40, ppc=20, mips=8, mipsel=8 })[ctx.arch])
+ hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, ppc=20, mips=8, mipsel=8 })[ctx.arch])
if ctx.arch == "mips" or ctx.arch == "mipsel" then
hdr.flags = 0x50001006
end
@@ -477,13 +477,13 @@ typedef struct {
} mach_obj_64;
typedef struct {
mach_fat_header fat;
- mach_fat_arch fat_arch[4];
+ mach_fat_arch fat_arch[2];
struct {
mach_header hdr;
mach_segment_command seg;
mach_section sec;
mach_symtab_command sym;
- } arch[4];
+ } arch[2];
mach_nlist sym_entry;
uint8_t space[4096];
} mach_fat_obj;
@@ -494,6 +494,8 @@ typedef struct {
is64, align, mobj = true, 8, "mach_obj_64"
elseif ctx.arch == "arm" then
isfat, mobj = true, "mach_fat_obj"
+ elseif ctx.arch == "arm64" then
+ is64, align, isfat, mobj = true, 8, true, "mach_fat_obj"
else
check(ctx.arch == "x86", "unsupported architecture for OSX")
end
@@ -503,8 +505,8 @@ typedef struct {
-- Create Mach-O object and fill in header.
local o = ffi.new(mobj)
local mach_size = aligned(ffi.offsetof(o, "space")+#symname+2, align)
- local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12,12,12} })[ctx.arch]
- local cpusubtype = ({ x86={3}, x64={3}, arm={3,6,9,11} })[ctx.arch]
+ local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12}, arm64={0x01000007,0x0100000c} })[ctx.arch]
+ local cpusubtype = ({ x86={3}, x64={3}, arm={3,9}, arm64={3,0} })[ctx.arch]
if isfat then
o.fat.magic = be32(0xcafebabe)
o.fat.nfat_arch = be32(#cpusubtype)