1 //===- COFFWriter.h ---------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_OBJCOPY_COFF_COFFWRITER_H
10 #define LLVM_LIB_OBJCOPY_COFF_COFFWRITER_H
12 #include "llvm/MC/StringTableBuilder.h"
13 #include "llvm/Support/Error.h"
14 #include "llvm/Support/MemoryBuffer.h"
26 std::unique_ptr
<WritableMemoryBuffer
> Buf
;
31 size_t SizeOfInitializedData
;
32 StringTableBuilder StrTabBuilder
;
34 template <class SymbolTy
> std::pair
<size_t, size_t> finalizeSymbolTable();
35 Error
finalizeRelocTargets();
36 Error
finalizeSymbolContents();
37 void layoutSections();
38 Expected
<size_t> finalizeStringTable();
40 Error
finalize(bool IsBigObj
);
42 void writeHeaders(bool IsBigObj
);
44 template <class SymbolTy
> void writeSymbolStringTables();
46 Error
write(bool IsBigObj
);
48 Error
patchDebugDirectory();
49 Expected
<uint32_t> virtualAddressToFileAddress(uint32_t RVA
);
52 virtual ~COFFWriter() {}
55 COFFWriter(Object
&Obj
, raw_ostream
&Out
)
56 : Obj(Obj
), Out(Out
), StrTabBuilder(StringTableBuilder::WinCOFF
) {}
59 } // end namespace coff
60 } // end namespace objcopy
61 } // end namespace llvm
63 #endif // LLVM_LIB_OBJCOPY_COFF_COFFWRITER_H