[PATCH] D121398: Return an error when dsymutil might produce an invalid mach-o file.

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 16:03:03 PST 2022


JDevlieghere added inline comments.


================
Comment at: llvm/tools/dsymutil/dsymutil.cpp:732
 
     if (NeedsTempFiles) {
       if (!MachOUtils::generateUniversalBinary(TempFiles,
----------------
So instead of the check below we now want to check the fat binary. Something like this: 
```
uint64_t offset = 0;
for(size_t i = 0; i < NeedsTempFiles.size() - 1; ++i) {
  ErrorOr<vfs::Status> stat =
        Options.LinkOpts.VFS->status(OutputLocationOrErr->DWARFFile);
  if(!stat)
    break;
  offset += stat->getSize();
  if (offset > UINT32_MAX) 
    WithColor::error() << "the fat binary has a slice with an offset exceeds 4GB and will produce an invalid mach-o file.";
        return EXIT_FAILURE;
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121398/new/

https://reviews.llvm.org/D121398



More information about the llvm-commits mailing list