mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 15:14:31 +00:00
Correctly detect legacy iOS simulator Mach-O objectfiles
The code in ObjectFileMachO didn't disambiguate between ios and ios-simulator object files for Mach-O objects using the legacy ambiguous LC_VERSION_MIN load commands. This used to not matter before taught ArchSpec that ios and ios-simulator are no longer compatible. rdar://problem/66545307 Differential Revision: https://reviews.llvm.org/D85358
This commit is contained in:
1 parent
128bf458ab
commit
05df9cc703
4 files changed
+58
-20
No files matched your search
@@ -5007,8 +5007,8 @@ void ObjectFileMachO::GetAllArchSpecs(const llvm::MachO::mach_header &header,
|
||||
|
||||
struct version_min_command version_min;
|
||||
switch (load_cmd.cmd) {
|
||||
case llvm::MachO::LC_VERSION_MIN_IPHONEOS:
|
||||
case llvm::MachO::LC_VERSION_MIN_MACOSX:
|
||||
case llvm::MachO::LC_VERSION_MIN_IPHONEOS:
|
||||
case llvm::MachO::LC_VERSION_MIN_TVOS:
|
||||
case llvm::MachO::LC_VERSION_MIN_WATCHOS: {
|
||||
if (load_cmd.cmdsize != sizeof(version_min))
|
||||
@@ -5024,7 +5024,19 @@ void ObjectFileMachO::GetAllArchSpecs(const llvm::MachO::mach_header &header,
|
||||
|
||||
auto triple = base_triple;
|
||||
triple.setOSName(os.str());
|
||||
os_name.clear();
|
||||
|
||||
// Disambiguate legacy simulator platforms.
|
||||
if (load_cmd.cmd != llvm::MachO::LC_VERSION_MIN_MACOSX &&
|
||||
(base_triple.getArch() == llvm::Triple::x86_64 ||
|
||||
base_triple.getArch() == llvm::Triple::x86)) {
|
||||
// The combination of legacy LC_VERSION_MIN load command and
|
||||
// x86 architecture always indicates a simulator environment.
|
||||
// The combination of LC_VERSION_MIN and arm architecture only
|
||||
// appears for native binaries. Back-deploying simulator
|
||||
// binaries on Apple Silicon Macs use the modern unambigous
|
||||
// LC_BUILD_VERSION load commands; no special handling required.
|
||||
triple.setEnvironment(llvm::Triple::Simulator);
|
||||
}
|
||||
add_triple(triple);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user