[vm] Add LC_ENCRYPTION_INFO(_64) load command to iOS snapshots.
When uploading to the App Store, the program must contain an LC_ENCRYPTION_INFO segment in the Mach-O header so the App Store can appropriately modify it for its purposes without changing the header size and/or offsets/addresses in the rest of the shared object. By default, the load command is only added to iOS snapshots, but it can be added to any Mach-O snapshot using the --macho-encryptable command line option. TEST=vm/dart/use_macho_options_test Cq-Include-Trybots: luci.dart.try:vm-aot-mac-debug-x64-try,vm-aot-mac-debug-arm64-try,vm-aot-linux-debug-x64-try Change-Id: I4e79fd9cfb9ba9d49707ec209eca3fee1cefc28c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475040 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>
This commit is contained in:
committed by
Commit Queue
parent
87005f595c
commit
8cbf864289
@@ -140,6 +140,14 @@ static constexpr uint32_t LC_RPATH = (0x1c | LC_REQ_DYLD);
|
||||
// The code signature which protects the preceding portion of the object file.
|
||||
// Must be the last contents in the object file. (linkedit_data_command)
|
||||
static constexpr uint32_t LC_CODE_SIGNATURE = 0x1d;
|
||||
// Information about encrypted segments for 32-bit targets. Must also be present
|
||||
// for programs with no encrypted segments that are uploaded to the App Store
|
||||
// so it can be updated appropriately.
|
||||
static constexpr uint32_t LC_ENCRYPTION_INFO = 0x21;
|
||||
// Information about encrypted segments for 64-bit targets. Must also be present
|
||||
// for programs with no encrypted segments that are uploaded to the App Store
|
||||
// so it can be updated appropriately.
|
||||
static constexpr uint32_t LC_ENCRYPTION_INFO_64 = 0x2c;
|
||||
// An arbitrary piece of data not specified by the Mach-O format. (note_command)
|
||||
static constexpr uint32_t LC_NOTE = 0x31;
|
||||
// The target platform and minimum and target OS versions for this object file.
|
||||
@@ -743,6 +751,23 @@ static constexpr uint32_t RELOC_TYPE_ARM64_UNSIGNED = 0 << 28;
|
||||
// _before_ the target (UNSIGNED) entry that it is subtracted from.
|
||||
static constexpr uint32_t RELOC_TYPE_ARM64_SUBTRACTOR = 1 << 28;
|
||||
|
||||
struct encryption_info_command {
|
||||
uint32_t cmd; // LC_ENCRYPTION_INFO
|
||||
uint32_t cmdsize;
|
||||
uint32_t cryptoff; // file offset of the encrypted segment(s)
|
||||
uint32_t cryptsize; // file size of the encrypted segment(s)
|
||||
uint32_t cryptid; // encryption cypher used (0 == not encrypted)
|
||||
};
|
||||
|
||||
struct encryption_info_command_64 {
|
||||
uint32_t cmd; // LC_ENCRYPTION_INFO_64
|
||||
uint32_t cmdsize;
|
||||
uint32_t cryptoff; // file offset of the encrypted segment(s)
|
||||
uint32_t cryptsize; // file size of the encrypted segment(s)
|
||||
uint32_t cryptid; // encryption cypher used (0 == not encrypted)
|
||||
uint32_t pad; // padding to a multiple of 64 bits
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
} // namespace mach_o
|
||||
|
||||
Reference in New Issue
Block a user