Skip to content

Commit e08970d

Browse files
author
git apple-llvm automerger
committed
Merge commit 'e3e07513da09' from apple/main into swift/next
2 parents 3dc5405 + e3e0751 commit e08970d

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

lld/COFF/PDB.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,9 +1648,13 @@ void PDBLinker::addSections(ArrayRef<OutputSection *> outputSections,
16481648
}
16491649

16501650
void PDBLinker::commit(codeview::GUID *guid) {
1651-
ExitOnError exitOnErr((config->pdbPath + ": ").str());
1652-
// Write to a file.
1653-
exitOnErr(builder.commit(config->pdbPath, guid));
1651+
// Print an error and continue if PDB writing fails. This is done mainly so
1652+
// the user can see the output of /time and /summary, which is very helpful
1653+
// when trying to figure out why a PDB file is too large.
1654+
if (Error e = builder.commit(config->pdbPath, guid)) {
1655+
checkError(std::move(e));
1656+
error("failed to write PDB file " + Twine(config->pdbPath));
1657+
}
16541658
}
16551659

16561660
static uint32_t getSecrelReloc() {

llvm/include/llvm/DebugInfo/MSF/MSFError.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace msf {
1818
enum class msf_error_code {
1919
unspecified = 1,
2020
insufficient_buffer,
21+
size_overflow,
2122
not_writable,
2223
no_stream,
2324
invalid_format,

llvm/lib/DebugInfo/MSF/MSFBuilder.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/Support/Endian.h"
1616
#include "llvm/Support/Error.h"
1717
#include "llvm/Support/FileOutputBuffer.h"
18+
#include "llvm/Support/FormatVariadic.h"
1819
#include <algorithm>
1920
#include <cassert>
2021
#include <cstdint>
@@ -348,8 +349,9 @@ Expected<FileBufferByteStream> MSFBuilder::commit(StringRef Path,
348349
// block-based and as long as each stream is small enough, PDBs larger than
349350
// 4 GiB might work. Check if tools can handle these large PDBs, and if so
350351
// add support for writing them.
351-
return make_error<MSFError>(msf_error_code::invalid_format,
352-
"Output larger than 4 GiB");
352+
return make_error<MSFError>(
353+
msf_error_code::size_overflow,
354+
formatv("File size would have been {0,1:N}", FileSize));
353355
}
354356

355357
auto OutFileOrError = FileOutputBuffer::create(Path, FileSize);

llvm/lib/DebugInfo/MSF/MSFError.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class MSFErrorCategory : public std::error_category {
2727
case msf_error_code::insufficient_buffer:
2828
return "The buffer is not large enough to read the requested number of "
2929
"bytes.";
30+
case msf_error_code::size_overflow:
31+
return "Output data is larger than 4 GiB.";
3032
case msf_error_code::not_writable:
3133
return "The specified stream is not writable.";
3234
case msf_error_code::no_stream:

0 commit comments

Comments
 (0)