1 #------------------------------------------------------------------------------
2 # mach file description
4 # Since Java bytecode and Mach-O fat-files have the same magic number the test
5 # must be preformed in the same "magic" sequence to get both right. The long
6 # at offset 4 in a fat file tells the number of architectures. The short at
7 # offset 4 in a Java bytecode file is the compiler minor version and the
8 # short at offset 6 is the compiler major version. Since there are only
9 # only 18 labeled Mach-O architectures at current, and the first released
10 # Java class format was version 43.0, we can safely choose any number
11 # between 18 and 39 to test the number of architectures against
12 # (and use as a hack).
15 >4 belong >19 compiled Java class data,
16 >>6 beshort x version %d.
18 >4 belong 1 Mach-O fat file with 1 architecture
20 # The following is necessary to support java class files.
21 >>4 belong <20 Mach-O fat file with %ld architectures
22 #>>4 belong <0xffff Mach-O fat file with %ld architectures
24 0 lelong&0xfeffffff 0xfeedface Mach-O
27 >12 lelong 2 executable
28 >12 lelong 3 fixed virtual memory shared library
30 >12 lelong 5 preload executable
31 >12 lelong 6 dynamically linked shared library
32 >12 lelong 7 dynamic linker
34 >12 lelong 9 dynamically linked shared library stub
36 >>12 lelong x filetype=%ld
38 >>4 lelong x architecture=%ld
41 >4 lelong 3 architecture=3
48 >4 lelong 10 architecture=10
57 >4 lelong 16777234 ppc64
59 >>4 lelong x architecture=%ld
61 0 belong&0xfffffffe 0xfeedface Mach-O
64 >12 belong 2 executable
65 >12 belong 3 fixed virtual memory shared library
67 >12 belong 5 preload executable
68 >12 belong 6 dynamically linked shared library
69 >12 belong 7 dynamic linker
71 >12 belong 9 dynamically linked shared library stub
73 >>12 belong x filetype=%ld
75 >>4 belong x architecture=%ld
78 >4 belong 3 architecture=3
81 >4 belong 6 for m68k architecture
82 # from NeXTstep 3.0 <mach/machine.h>
83 # i.e. mc680x0_all, ignore
84 # >>8 belong 1 (mc68030)
85 >>8 belong 2 (mc68040)
86 >>8 belong 3 (mc68030 only)
90 >4 belong 10 architecture=10
99 >4 belong 16777234 ppc64
101 >>4 belong x architecture=%ld