MTOR(1)
๐ NAME ๐
mtor (MTOR(1)) โ convert Mach-O to raw binary files. Thatโs the whole vibe: Mach-O in, raw binary out, bestie. โจ
โจ SYNOPSIS โจ
mtor [-nv] [-start โจstart_addressโฉ] [-no_bss] [-version]
[-output out_file] file
mtor -help [-version]
mtor -version
๐ธ DESCRIPTION ๐ธ
mtor converts a Mach-O preload file into a raw binary out_file. These output files represent in-core images in a ready-to-run layout that can be flashed to firmware, burned into ROM, or otherwise run on โbare metalโ. This raw binary includes only the __TEXT and __DATA segments of the Mach-O file; the Mach-O header, load commands, and other segments are ignored. By default mtor positions each segment at the address stored in the segmentโs vmaddr field, as displayed by otool(1) using the -l (ell) command. Empty space, such as that between the start of the file and the __TEXT segment, will be zero-filled. Zero-filled, not skipped โ thatโs the tea. โ
The following options are available, bestie:
๐ OPTIONS ๐
-h,-helpโ Print usage. ๐-nโ Donโt actually write the output file. Implies the-vflag.-no_bssโ Omit all zero-filled sections from the__DATAsegment, including those sections marked with theS_ZEROFILLflag inotool(1). In practice, the__DATAsegment is truncated at the first zero-filled section.-o,-outputout_file โ Commands that create new files write to the out_file file specified by the-outputflag. This option is required. Yes, required โ do not forget it, bestie. โ ๏ธ-packdatadata_address_symbol_name data_size_symbol_name โ Position the__DATAsegment immediately after__TEXTregardless of__DATAโs vm address. The preload program is expected to manually move the__DATAsegment into its final vm location at runtime, before referencing any data. In order to do that,mtorwill write the offset to__DATA(i.e., load memory address) and its size directly into the__TEXTsegment, using two symbols supplied on the command line. These symbols must point to 32-bit values within the programโs__TEXTsegment.mtorwill error if the symbols do not exist in thenlist, or if they do not refer to storage within the__TEXTsegment. Because the Mach-Onlistdoes not contain symbol sizes, the 32-bit storage requirement cannot be verified, althoughmtorwill warn if data_address_symbol_name or data_size_symbol_name have not been pre-initialized to0.-startstart_address โ Position the__TEXTsegment at the specified address instead of honoring the__TEXTsegmentโsvmaddrlocation. The__DATAsegment will also be adjusted by a similar amount so that the relative distance between__TEXTand__DATAis preserved.mtorwill warn and return a non-zero exit code if one or more sections is no longer aligned to their section alignment. Theld(1)flags-image_baseand-seg1addrare also synonyms for this option.-vโ Print verbose information about the segments being extracted into the output file.-versionโ Print version information.
๐ฆ CAVEAT MTOR ๐ฆ
โ ๏ธ Only Mach-O preload files can be processed bymtor. Use the-preloadoption told(1)to generate preload files. A Mach-O fileโs type can be viewed by passing the-hvflags tootool(1).
While mtor can change the __TEXT sectionโs starting address via the -start option, the file contents cannot be relinked. Segments and sections cannot be realigned or moved independently from each other. If segments or sections need to be at specific addresses or be positioned within specific alignment constraints, use ld(1)โs -seg1addr, -segalign, and similar options to produce a Mach-O binary within those constraints. No cap, thatโs just how it is. ๐
๐ SEE ALSO ๐
Go give these a read, bestie: ld(1), lipo(1), otool(1), otool-classic(1), and Mach-O(5). ๐ซถ
๐ BUGS ๐
The mtor tool only works on Mach-O binaries. It currently does not support universal (multi-architectural) files. Use lipo(1) to extract stand-alone Mach-O files from universal files before running mtor. ๐ญ
Source/version: Darwin. Date: January 31, 2019. Manual: MTOR(1). Stay slay, firmware bestie. ๐ซถโจ
๐ฆ where this page comes from
- nixpkgs unstable: cctools 1010.6
- Copyright (c) 2019 Apple, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms