diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -421,13 +421,13 @@ .StartsWith("ppc:", CPU_TYPE_POWERPC) .StartsWith("ppc64:", CPU_TYPE_POWERPC64) .Default(CPU_TYPE_ANY); + + if (cpuType != CPU_TYPE_ANY && cpuType != target->cpuType) + continue; + // Drop the CPU type as well as the colon if (cpuType != CPU_TYPE_ANY) line = line.drop_until([](char c) { return c == ':'; }).drop_front(); - // TODO: Update when we extend support for other CPUs - if (cpuType != CPU_TYPE_ANY && cpuType != CPU_TYPE_X86_64 && - cpuType != CPU_TYPE_ARM64) - continue; constexpr std::array fileEnds = {".o:", ".o):"}; for (StringRef fileEnd : fileEnds) { @@ -869,7 +869,6 @@ errorHandler().logName = args::getFilenameWithoutExe(argsArr[0]); stderrOS.enable_colors(stderrOS.has_colors()); - // TODO: Set up error handler properly, e.g. the errorLimitExceededMsg MachOOptTable parser; InputArgList args = parser.parse(argsArr.slice(1)); diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -222,7 +222,7 @@ return None; } - if (read32be(&arch[i].cputype) != target->cpuType || + if (read32be(&arch[i].cputype) != static_cast(target->cpuType) || read32be(&arch[i].cpusubtype) != target->cpuSubtype) continue; diff --git a/lld/MachO/Target.h b/lld/MachO/Target.h --- a/lld/MachO/Target.h +++ b/lld/MachO/Target.h @@ -68,7 +68,7 @@ } uint32_t magic; - uint32_t cpuType; + llvm::MachO::CPUType cpuType; uint32_t cpuSubtype; uint64_t pageZeroSize; diff --git a/lld/test/MachO/order-file.s b/lld/test/MachO/order-file.s --- a/lld/test/MachO/order-file.s +++ b/lld/test/MachO/order-file.s @@ -127,7 +127,7 @@ _main #--- ord-arch-nomatch -ppc:-[Foo doFoo:andBar:] +arm64:-[Foo doFoo:andBar:] _main -[Foo doFoo:andBar:]