The Mach-O corefiles have a "main bin spec" LC_NOTE which allows the corefile creator to specify a binary's UUID, load address, and type (userland, kernel, frimware). This patch extends that structure with two new fields - an optional slide, and an optional platform (currently unused).
We have a corefile creator that will only know the offset that a binary was loaded at, as well as its UUID, so lldb will need to find the original binary and add the offset to its file address to get the correct load address.
I changed the ObjectFile::GetCorefileMainBinaryInfo method from taking a load address, to taking a value and a bool of whether the value is an address or an offset. This is based on Module::SetLoadAddress, and it seemed good to stick with that argument style.
The majority of the patch is changing TestFirmwareCorefiles.py. I changed create-empty-corefile.cpp to work on Intel or Apple Silicon macs, have it generate version 2 of the 'main bin spec' LC_NOTE, both with an address and with a slide.
No need to change this, but if you ever have situation where the buffer is variable length, LLVM's formatv makes this very easy: