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 writeDataInCodeData();
49 void writeFunctionStartsData();
53 MachOWriter(Object
&O
, bool Is64Bit
, bool IsLittleEndian
, uint64_t PageSize
,
55 : O(O
), Is64Bit(Is64Bit
), IsLittleEndian(IsLittleEndian
),
56 PageSize(PageSize
), B(B
), LayoutBuilder(O
, Is64Bit
, PageSize
) {}
58 size_t totalSize() const;
63 } // end namespace macho
64 } // end namespace objcopy
65 } // end namespace llvm