1 //===- MachOWriter.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 //===----------------------------------------------------------------------===//
10 #include "MachOLayoutBuilder.h"
11 #include "MachOObjcopy.h"
13 #include "llvm/BinaryFormat/MachO.h"
14 #include "llvm/Object/MachO.h"
28 MachOLayoutBuilder LayoutBuilder;
30 size_t headerSize() const;
31 size_t loadCommandsSize() const;
32 size_t symTableSize() const;
33 size_t strTableSize() const;
36 void writeLoadCommands();
37 template <typename StructType>
38 void writeSectionInLoadCommand(const Section &Sec, uint8_t *&Out);
40 void writeSymbolTable();
41 void writeStringTable();
42 void writeRebaseInfo();
44 void writeWeakBindInfo();
45 void writeLazyBindInfo();
46 void writeExportInfo();
47 void writeIndirectSymbolTable();
48 void writeLinkData(Optional<size_t> LCIndex, const LinkData &LD);
49 void writeCodeSignatureData();
50 void writeDataInCodeData();
51 void writeFunctionStartsData();
55 MachOWriter(Object &O, bool Is64Bit, bool IsLittleEndian, uint64_t PageSize,
57 : O(O), Is64Bit(Is64Bit), IsLittleEndian(IsLittleEndian),
58 PageSize(PageSize), B(B), LayoutBuilder(O, Is64Bit, PageSize) {}
60 size_t totalSize() const;
65 } // end namespace macho
66 } // end namespace objcopy
67 } // end namespace llvm