diff options
author | Mike Pall <mike> | 2015-08-25 10:16:39 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2015-08-25 10:16:39 +0200 |
commit | 0a3cd94631f1d2d1d18b641ecd25f49ed54f832e (patch) | |
tree | e932e344a590959fd7f75bf92a24de6d03f5fe96 /src/jit | |
parent | ba617df6f8ce4a9ab50974f993bcfe38bb4a28b4 (diff) | |
download | luajit-0a3cd94631f1d2d1d18b641ecd25f49ed54f832e.tar.gz luajit-0a3cd94631f1d2d1d18b641ecd25f49ed54f832e.tar.bz2 luajit-0a3cd94631f1d2d1d18b641ecd25f49ed54f832e.zip |
ARM64: Add support for saving bytecode as object files.
Diffstat (limited to 'src/jit')
-rw-r--r-- | src/jit/bcsave.lua | 14 |
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 = { | |||
63 | } | 63 | } |
64 | 64 | ||
65 | local map_arch = { | 65 | local map_arch = { |
66 | x86 = true, x64 = true, arm = true, ppc = true, | 66 | x86 = true, x64 = true, arm = true, arm64 = true, ppc = true, |
67 | mips = true, mipsel = true, | 67 | mips = true, mipsel = true, |
68 | } | 68 | } |
69 | 69 | ||
@@ -237,7 +237,7 @@ typedef struct { | |||
237 | hdr.eendian = isbe and 2 or 1 | 237 | hdr.eendian = isbe and 2 or 1 |
238 | hdr.eversion = 1 | 238 | hdr.eversion = 1 |
239 | hdr.type = f16(1) | 239 | hdr.type = f16(1) |
240 | hdr.machine = f16(({ x86=3, x64=62, arm=40, ppc=20, mips=8, mipsel=8 })[ctx.arch]) | 240 | hdr.machine = f16(({ x86=3, x64=62, arm=40, arm64=183, ppc=20, mips=8, mipsel=8 })[ctx.arch]) |
241 | if ctx.arch == "mips" or ctx.arch == "mipsel" then | 241 | if ctx.arch == "mips" or ctx.arch == "mipsel" then |
242 | hdr.flags = 0x50001006 | 242 | hdr.flags = 0x50001006 |
243 | end | 243 | end |
@@ -477,13 +477,13 @@ typedef struct { | |||
477 | } mach_obj_64; | 477 | } mach_obj_64; |
478 | typedef struct { | 478 | typedef struct { |
479 | mach_fat_header fat; | 479 | mach_fat_header fat; |
480 | mach_fat_arch fat_arch[4]; | 480 | mach_fat_arch fat_arch[2]; |
481 | struct { | 481 | struct { |
482 | mach_header hdr; | 482 | mach_header hdr; |
483 | mach_segment_command seg; | 483 | mach_segment_command seg; |
484 | mach_section sec; | 484 | mach_section sec; |
485 | mach_symtab_command sym; | 485 | mach_symtab_command sym; |
486 | } arch[4]; | 486 | } arch[2]; |
487 | mach_nlist sym_entry; | 487 | mach_nlist sym_entry; |
488 | uint8_t space[4096]; | 488 | uint8_t space[4096]; |
489 | } mach_fat_obj; | 489 | } mach_fat_obj; |
@@ -494,6 +494,8 @@ typedef struct { | |||
494 | is64, align, mobj = true, 8, "mach_obj_64" | 494 | is64, align, mobj = true, 8, "mach_obj_64" |
495 | elseif ctx.arch == "arm" then | 495 | elseif ctx.arch == "arm" then |
496 | isfat, mobj = true, "mach_fat_obj" | 496 | isfat, mobj = true, "mach_fat_obj" |
497 | elseif ctx.arch == "arm64" then | ||
498 | is64, align, isfat, mobj = true, 8, true, "mach_fat_obj" | ||
497 | else | 499 | else |
498 | check(ctx.arch == "x86", "unsupported architecture for OSX") | 500 | check(ctx.arch == "x86", "unsupported architecture for OSX") |
499 | end | 501 | end |
@@ -503,8 +505,8 @@ typedef struct { | |||
503 | -- Create Mach-O object and fill in header. | 505 | -- Create Mach-O object and fill in header. |
504 | local o = ffi.new(mobj) | 506 | local o = ffi.new(mobj) |
505 | local mach_size = aligned(ffi.offsetof(o, "space")+#symname+2, align) | 507 | local mach_size = aligned(ffi.offsetof(o, "space")+#symname+2, align) |
506 | local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12,12,12} })[ctx.arch] | 508 | local cputype = ({ x86={7}, x64={0x01000007}, arm={7,12}, arm64={0x01000007,0x0100000c} })[ctx.arch] |
507 | local cpusubtype = ({ x86={3}, x64={3}, arm={3,6,9,11} })[ctx.arch] | 509 | local cpusubtype = ({ x86={3}, x64={3}, arm={3,9}, arm64={3,0} })[ctx.arch] |
508 | if isfat then | 510 | if isfat then |
509 | o.fat.magic = be32(0xcafebabe) | 511 | o.fat.magic = be32(0xcafebabe) |
510 | o.fat.nfat_arch = be32(#cpusubtype) | 512 | o.fat.nfat_arch = be32(#cpusubtype) |