diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -734,18 +734,22 @@ OutputLocationOrErr->DWARFFile, Options.LinkOpts, SDKPath)) return EXIT_FAILURE; - } - - // The Mach-O object file format is limited to 4GB. Make sure that we print - // an error when we emit an invalid Mach-O companion file. Leave the - // invalid object file around on disk for inspection. - ErrorOr stat = - Options.LinkOpts.VFS->status(OutputLocationOrErr->DWARFFile); - if (stat) { - if (stat->getSize() > std::numeric_limits::max()) { - WithColor::error() << "the linked debug info exceeds the 4GB Mach-O " - "object file format."; - return EXIT_FAILURE; + } else { + // Only check the size of a skinny mach-o file. If we use temp files then + // we have multiple architectures and the "lipo" command will fail to + // produce a valid universal file if any file is over 4GB in size. + + // The Mach-O object file format is limited to 4GB. Make sure that we + // print an error when we emit an invalid Mach-O companion file. Leave the + // invalid object file around on disk for inspection. + ErrorOr stat = + Options.LinkOpts.VFS->status(OutputLocationOrErr->DWARFFile); + if (stat) { + if (stat->getSize() > std::numeric_limits::max()) { + WithColor::error() << "the linked debug info exceeds the 4GB Mach-O " + "object file format."; + return EXIT_FAILURE; + } } } }