diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-09-02 17:49:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-09-02 17:49:30 +0000 |
commit | 7a63c3fd2d6157b77034dea8294a73b0f7030848 (patch) | |
tree | 0f4fe59e63c43e5d32ed4674474c982030c48507 /COFF/Writer.cpp | |
parent | 1e52e898a35b86ecd41b7040085e21d3a140a115 (diff) |
Vendor import of lld release_90 branch r370514:vendor/lld/lld-release_90-r370514
Notes
Notes:
svn path=/vendor/lld/dist-release_90/; revision=351718
svn path=/vendor/lld/lld-release_90-r370514/; revision=351719; tag=vendor/lld/lld-release_90-r370514
Diffstat (limited to 'COFF/Writer.cpp')
-rw-r--r-- | COFF/Writer.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/COFF/Writer.cpp b/COFF/Writer.cpp index cc75db0f519c..5736281958fa 100644 --- a/COFF/Writer.cpp +++ b/COFF/Writer.cpp @@ -626,6 +626,9 @@ void Writer::run() { writeMapFile(outputSections); + if (errorCount()) + return; + ScopedTimer t2(diskCommitTimer); if (auto e = buffer->commit()) fatal("failed to write the output file: " + toString(std::move(e))); @@ -1205,9 +1208,11 @@ void Writer::assignAddresses() { sizeOfHeaders += config->is64() ? sizeof(pe32plus_header) : sizeof(pe32_header); sizeOfHeaders = alignTo(sizeOfHeaders, config->fileAlign); - uint64_t rva = pageSize; // The first page is kept unmapped. fileSize = sizeOfHeaders; + // The first page is kept unmapped. + uint64_t rva = alignTo(sizeOfHeaders, config->align); + for (OutputSection *sec : outputSections) { if (sec == relocSec) addBaserels(); @@ -1237,10 +1242,10 @@ void Writer::assignAddresses() { sec->header.SizeOfRawData = rawSize; if (rawSize != 0) sec->header.PointerToRawData = fileSize; - rva += alignTo(virtualSize, pageSize); + rva += alignTo(virtualSize, config->align); fileSize += alignTo(rawSize, config->fileAlign); } - sizeOfImage = alignTo(rva, pageSize); + sizeOfImage = alignTo(rva, config->align); // Assign addresses to sections in MergeChunks. for (MergeChunk *mc : MergeChunk::instances) @@ -1309,7 +1314,7 @@ template <typename PEHeaderTy> void Writer::writeHeader() { pe->MinorLinkerVersion = 0; pe->ImageBase = config->imageBase; - pe->SectionAlignment = pageSize; + pe->SectionAlignment = config->align; pe->FileAlignment = config->fileAlign; pe->MajorImageVersion = config->majorImageVersion; pe->MinorImageVersion = config->minorImageVersion; |