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 @@ -35,6 +35,7 @@ #include "llvm/Support/CrashRecoveryContext.h" #include "llvm/Support/FileCollector.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/LLVMDriver.h" #include "llvm/Support/Path.h" @@ -801,12 +802,14 @@ ErrorOr stat = Options.LinkOpts.VFS->status(File.path()); if (!stat) break; - FileOffset += stat->getSize(); if (FileOffset > UINT32_MAX) { - WithColor::error() << "the universal binary has a slice with an " - "offset exceeds 4GB and will produce an invalid Mach-O file."; + WithColor::error() << formatv( + "the universal binary has a slice with a starting offset ({0:x}) " + "that exceeds 4GB and will produce an invalid Mach-O file.", + FileOffset); return EXIT_FAILURE; } + FileOffset += stat->getSize(); } if (!MachOUtils::generateUniversalBinary(TempFiles, OutputLocationOrErr->DWARFFile,