llvm.org GIT mirror llvm / 7173869
Merging r352806: ------------------------------------------------------------------------ r352806 | sbc | 2019-01-31 14:38:22 -0800 (Thu, 31 Jan 2019) | 5 lines [WebAssembly] MC: Fix for outputing wasm object to /dev/null Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D57479 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_80@360949 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 3 months ago
2 changed file(s) with 17 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
367367 // Now that the section is complete and we know how big it is, patch up the
368368 // section size field at the start of the section.
369369 void WasmObjectWriter::endSection(SectionBookkeeping &Section) {
370 uint64_t Size = W.OS.tell() - Section.PayloadOffset;
370 uint64_t Size = W.OS.tell();
371 // /dev/null doesn't support seek/tell and can report offset of 0.
372 // Simply skip this patching in that case.
373 if (!Size)
374 return;
375
376 Size -= Section.PayloadOffset;
371377 if (uint32_t(Size) != Size)
372378 report_fatal_error("section size does not fit in a uint32_t");
373379
0 # RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj -o /dev/null < %s
1
2 .text
3 .section .text.main,"",@
4 .type main,@function
5 main:
6 .functype main (i32, i32) -> (i32)
7 end_function
8 .Lfunc_end0:
9 .size main, .Lfunc_end0-main