Starting on an input stream that is not at offset 0 would trigger the
assert in WinCOFFObjectWriter.cpp:1065:
assert(getStream().tell() <= (*i)->Header.PointerToRawData &&
"Section::PointerToRawData is insane!");
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253464
91177308-0d34-0410-b5e6-
96231b3b80d8
MCObjectWriter(raw_pwrite_stream &OS, bool IsLittleEndian)
: OS(&OS), IsLittleEndian(IsLittleEndian) {}
+ unsigned getInitialOffset() {
+ return OS->tell();
+ }
+
public:
virtual ~MCObjectWriter();
// Assign file offsets to COFF object file structures.
- unsigned offset = 0;
+ unsigned offset = getInitialOffset();
if (UseBigObj)
offset += COFF::Header32Size;
--- /dev/null
+// REQUIRES: shell
+// RUN: ( echo "test"; llvm-mc -filetype=obj -triple i686-pc-win32 %s ) > %t
+