@@ -63,7 +63,7 @@ local map_type = {
63
63
}
64
64
65
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
67
mips = true , mipsel = true ,
68
68
}
69
69
@@ -237,7 +237,7 @@ typedef struct {
237
237
hdr .eendian = isbe and 2 or 1
238
238
hdr .eversion = 1
239
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
241
if ctx .arch == " mips" or ctx .arch == " mipsel" then
242
242
hdr .flags = 0x50001006
243
243
end
@@ -477,13 +477,13 @@ typedef struct {
477
477
} mach_obj_64;
478
478
typedef struct {
479
479
mach_fat_header fat ;
480
- mach_fat_arch fat_arch [4 ];
480
+ mach_fat_arch fat_arch [2 ];
481
481
struct {
482
482
mach_header hdr ;
483
483
mach_segment_command seg ;
484
484
mach_section sec ;
485
485
mach_symtab_command sym ;
486
- } arch [4 ];
486
+ } arch [2 ];
487
487
mach_nlist sym_entry ;
488
488
uint8_t space [4096 ];
489
489
} mach_fat_obj;
@@ -494,6 +494,8 @@ typedef struct {
494
494
is64 , align , mobj = true , 8 , " mach_obj_64"
495
495
elseif ctx .arch == " arm" then
496
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
499
else
498
500
check (ctx .arch == " x86" , " unsupported architecture for OSX" )
499
501
end
@@ -503,8 +505,8 @@ typedef struct {
503
505
-- Create Mach-O object and fill in header.
504
506
local o = ffi .new (mobj )
505
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 ]
507
- local cpusubtype = ({ x86 = {3 }, x64 = {3 }, arm = {3 ,6 , 9 , 11 } })[ctx .arch ]
508
+ local cputype = ({ x86 = {7 }, x64 = {0x01000007 }, arm = {7 ,12 }, arm64 = { 0x01000007 , 0x0100000c } })[ctx .arch ]
509
+ local cpusubtype = ({ x86 = {3 }, x64 = {3 }, arm = {3 ,9 }, arm64 = { 3 , 0 } })[ctx .arch ]
508
510
if isfat then
509
511
o .fat .magic = be32 (0xcafebabe )
510
512
o .fat .nfat_arch = be32 (# cpusubtype )
0 commit comments