16using namespace object;
18void XCOFFWriter::finalizeHeaders() {
20 FileSize +=
sizeof(XCOFFFileHeader32);
24 FileSize +=
sizeof(XCOFFSectionHeader32) * Obj.
Sections.size();
27void XCOFFWriter::finalizeSections() {
28 for (
const Section &Sec : Obj.
Sections) {
30 FileSize += Sec.Contents.size();
33 Sec.SectionHeader.NumberOfRelocations *
sizeof(XCOFFRelocation32);
37void XCOFFWriter::finalizeSymbolStringTable() {
47void XCOFFWriter::finalize() {
51 finalizeSymbolStringTable();
54void XCOFFWriter::writeHeaders() {
58 Ptr +=
sizeof(XCOFFFileHeader32);
67 for (
const Section &Sec : Obj.
Sections) {
68 memcpy(
Ptr, &Sec.SectionHeader,
sizeof(XCOFFSectionHeader32));
69 Ptr +=
sizeof(XCOFFSectionHeader32);
73void XCOFFWriter::writeSections() {
75 for (
const Section &Sec : Obj.
Sections) {
77 Sec.SectionHeader.FileOffsetToRawData;
78 Ptr = std::copy(Sec.Contents.begin(), Sec.Contents.end(),
Ptr);
82 for (
const Section &Sec : Obj.
Sections) {
84 Sec.SectionHeader.FileOffsetToRelocationInfo;
85 for (
const XCOFFRelocation32 &Rel : Sec.Relocations) {
86 memcpy(
Ptr, &Rel,
sizeof(XCOFFRelocation32));
87 Ptr +=
sizeof(XCOFFRelocation32);
92void XCOFFWriter::writeSymbolStringTable() {
100 memcpy(
Ptr,
Sym.AuxSymbolEntries.data(),
Sym.AuxSymbolEntries.size());
101 Ptr +=
Sym.AuxSymbolEntries.size();
113 "failed to allocate memory buffer of " +
118 writeSymbolStringTable();
119 Out.
write(Buf->getBufferStart(), Buf->getBufferSize());
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
constexpr size_t size() const
size - Get the string size.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
static Twine utohexstr(const uint64_t &Val)
static std::unique_ptr< WritableMemoryBuffer > getNewMemBuffer(size_t Size, const Twine &BufferName="")
Allocate a new zero-initialized MemoryBuffer of the specified size.
raw_ostream & write(unsigned char C)
constexpr size_t SymbolTableEntrySize
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
XCOFFAuxiliaryHeader32 OptionalFileHeader
std::vector< Symbol > Symbols
XCOFFFileHeader32 FileHeader
std::vector< Section > Sections