CVMACH(6)

NAME
cvmach - convert an executable file from ack.out to Mach-o

SYNOPSIS
~em/lib/ack/cvmach -mnumber [ infile [outfile]]

DESCRIPTION
The cvmach utility converts an executable file from ack.out(5) format to Mach-object format. It can produce Mach-o executables for Mac OS X. If the infile or outfile are not given, then cvmach reads from standard input or writes to standard output.

The option is required:

-mnumber
    Sets the CPU type in the Mach header. This must be -m7 for Intel i386 or -m18 for PowerPC. cvmach doesn't know how to make Mach-o files for other CPU types.

The input file must have four segments: TEXT, ROM, DATA and BSS, in that order. cvmach converts them into four Mach sections in two Mach segments. TEXT and ROM go in the RX segment (Read and eXecute). DATA and BSS go in the RW segment (Read and Write). cvmach sets the page protection so programs can't write the RX segment, and can't execute the RW segment. The program will begin execution at the beginning of TEXT.

cvmach also converts the symbol table.

DIAGNOSTICS

text segment must have base 0x%lx, not 0x%lx TEXT must begin immediately after the Mach header and load commands. The message gives the correct base. Relinking the program with em_led -b0:base would fix it.

the %s segment must follow the %s segment. TEXT and ROM must be continuous in memory, because cvmach maps them in the same Mach segment. Likewise, DATA and BSS must be contiguous. There may be a small gap between TEXT and ROM, or between DATA and BSS, only if the gap is necessary to align ROM or BSS.

the data and rom segments are too close. DATA and ROM must not share a page in memory, because cvmach maps them in different Mach segments, with different page protections. The page size for i386 and PowerPC is 4096 or 0x1000 bytes. For example, if ROM ends at address 0x2bed, then DATA may not begin at 0x2bf0, because cvmach can't put the page from 0x2000 to 0x2fff in both Mach segments. Relinking the program with em_led -a2:4096 would fix it.

the bss space contains initialized data. BSS must not contain initialized data, because cvmach converts it to a zero-fill section.

CAVEATS
Mac OS X 10.4 for PowerPC does not protect pages against execution. All mapped pages are executable, whether or not the execute bit is set in the page protection. cvmach can't prevent the execution of the RW segment.

BUGS
The symbol conversion preserves the name and value of each symbol, but may lose other information, such as the symbol type.