summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/MC/WasmObjectWriter.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-09-01 16:27:59 +0000
committerpatrick <patrick@openbsd.org>2019-09-01 16:27:59 +0000
commitb19884b112052f3bf5ff9551374fbd840e2339f2 (patch)
tree9e4127bb2a982bb6f8c89d0d7b393e3fac3aee2c /gnu/llvm/lib/MC/WasmObjectWriter.cpp
parentAdd amlmmc(4), a driver for the SD/MMC controller found on various (diff)
downloadwireguard-openbsd-b19884b112052f3bf5ff9551374fbd840e2339f2.tar.xz
wireguard-openbsd-b19884b112052f3bf5ff9551374fbd840e2339f2.zip
Import LLVM 8.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/MC/WasmObjectWriter.cpp')
-rw-r--r--gnu/llvm/lib/MC/WasmObjectWriter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/gnu/llvm/lib/MC/WasmObjectWriter.cpp b/gnu/llvm/lib/MC/WasmObjectWriter.cpp
index 333748db919..b07fe05cad5 100644
--- a/gnu/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/gnu/llvm/lib/MC/WasmObjectWriter.cpp
@@ -368,7 +368,13 @@ void WasmObjectWriter::startCustomSection(SectionBookkeeping &Section,
// Now that the section is complete and we know how big it is, patch up the
// section size field at the start of the section.
void WasmObjectWriter::endSection(SectionBookkeeping &Section) {
- uint64_t Size = W.OS.tell() - Section.PayloadOffset;
+ uint64_t Size = W.OS.tell();
+ // /dev/null doesn't support seek/tell and can report offset of 0.
+ // Simply skip this patching in that case.
+ if (!Size)
+ return;
+
+ Size -= Section.PayloadOffset;
if (uint32_t(Size) != Size)
report_fatal_error("section size does not fit in a uint32_t");