mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-24 07:01:35 +00:00
Fix bug where WinCOFFObjectWriter would assume starting from an empty output.
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
This commit is contained in:
parent
c68dcdb413
commit
fc0981ecbc
@ -49,6 +49,10 @@ protected: // Can only create subclasses.
|
||||
MCObjectWriter(raw_pwrite_stream &OS, bool IsLittleEndian)
|
||||
: OS(&OS), IsLittleEndian(IsLittleEndian) {}
|
||||
|
||||
unsigned getInitialOffset() {
|
||||
return OS->tell();
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~MCObjectWriter();
|
||||
|
||||
|
@ -962,7 +962,7 @@ void WinCOFFObjectWriter::writeObject(MCAssembler &Asm,
|
||||
|
||||
// Assign file offsets to COFF object file structures.
|
||||
|
||||
unsigned offset = 0;
|
||||
unsigned offset = getInitialOffset();
|
||||
|
||||
if (UseBigObj)
|
||||
offset += COFF::Header32Size;
|
||||
|
3
test/MC/COFF/stdin.s
Normal file
3
test/MC/COFF/stdin.s
Normal file
@ -0,0 +1,3 @@
|
||||
// REQUIRES: shell
|
||||
// RUN: ( echo "test"; llvm-mc -filetype=obj -triple i686-pc-win32 %s ) > %t
|
||||
|
Loading…
x
Reference in New Issue
Block a user