You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mach-O is the format macOS uses for executables and dynamic libraries.
It seems Apple no longer hosts documentation on its format (Wikipedia links to this archive). I did find this repo, which helpfully archived the original Apple PDF (Archive) and has a version of it adapted to markdown.
Alternatively we could just use ELFSharp (which contains Mach-O support) for Biohazrd, although this could put us in the same position as #1 where it does way more than we need and requires understanding the Mach-O spec to use properly anyway.
Library archives
Additionally we should support macOS static library archives. Like with everyone else, macOS .a files are a variant of the !<arch> format. Unlike everyone else they use the BSD variant since macOS is BSD-derived. Thankfully this different in format is somewhat easy to identify (there won't be any index file or longname files, and file names begin with #1/ with the real file name being part of the data portion of the file.)
In a BSD archive the equivalent of the index file (__.SYMDEF) is technically optional. macOS might use a variant that is sorted, which is denoted by the file being named __.SYMDEF SORTED. (This was used in the sample library I grabbed from my LLVM build.)
macOS can also apparently have a variant of the symbol table called __.SYMDEF_64, although it's unclear when it appears. (It wasn't there in the sample library.)
The actual object files appear to be Mach-O.
The text was updated successfully, but these errors were encountered:
PathogenDavid
changed the title
Add support for Mach-O files
Add support for Mach-O files and Darwin .a files
Oct 28, 2021
The header files referenced by the documentation are present in the macOS SDK in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/.
Mach-O is the format macOS uses for executables and dynamic libraries.
It seems Apple no longer hosts documentation on its format (Wikipedia links to this archive). I did find this repo, which helpfully archived the original Apple PDF (Archive) and has a version of it adapted to markdown.
Alternatively we could just use ELFSharp (which contains Mach-O support) for Biohazrd, although this could put us in the same position as #1 where it does way more than we need and requires understanding the Mach-O spec to use properly anyway.
Library archives
Additionally we should support macOS static library archives. Like with everyone else, macOS
.a
files are a variant of the!<arch>
format. Unlike everyone else they use the BSD variant since macOS is BSD-derived. Thankfully this different in format is somewhat easy to identify (there won't be any index file or longname files, and file names begin with#1/
with the real file name being part of the data portion of the file.)In a BSD archive the equivalent of the index file (
__.SYMDEF
) is technically optional. macOS might use a variant that is sorted, which is denoted by the file being named__.SYMDEF SORTED
. (This was used in the sample library I grabbed from my LLVM build.)macOS can also apparently have a variant of the symbol table called
__.SYMDEF_64
, although it's unclear when it appears. (It wasn't there in the sample library.)The actual object files appear to be Mach-O.
The text was updated successfully, but these errors were encountered: