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 "MachOObjcopy.h"
12 #include "llvm/BinaryFormat/MachO.h"
13 #include "llvm/Object/MachO.h"
26 StringTableBuilder StrTableBuilder{StringTableBuilder::MachO};
28 size_t headerSize() const;
29 size_t loadCommandsSize() const;
30 size_t symTableSize() const;
31 size_t strTableSize() const;
33 void updateDySymTab(MachO::macho_load_command &MLC);
34 void updateSizeOfCmds();
35 void updateSymbolIndexes();
36 void constructStringTable();
40 void writeLoadCommands();
41 template <typename StructType>
42 void writeSectionInLoadCommand(const Section &Sec, uint8_t *&Out);
44 void writeSymbolTable();
45 void writeStringTable();
46 void writeRebaseInfo();
48 void writeWeakBindInfo();
49 void writeLazyBindInfo();
50 void writeExportInfo();
54 MachOWriter(Object &O, bool Is64Bit, bool IsLittleEndian, Buffer &B)
55 : O(O), Is64Bit(Is64Bit), IsLittleEndian(IsLittleEndian), B(B) {}
57 size_t totalSize() const;
62 } // end namespace macho
63 } // end namespace objcopy
64 } // end namespace llvm