1 //===- Writer.h -------------------------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLD_MACHO_WRITER_H
10 #define LLD_MACHO_WRITER_H
11 
12 #include <cstdint>
13 
14 namespace lld {
15 namespace macho {
16 
17 class OutputSection;
18 class InputSection;
19 class Symbol;
20 
21 class LoadCommand {
22 public:
23   virtual ~LoadCommand() = default;
24   virtual uint32_t getSize() const = 0;
25   virtual void writeTo(uint8_t *buf) const = 0;
26 };
27 
28 template <class LP> void writeResult();
29 void resetWriter();
30 
31 void createSyntheticSections();
32 
33 // Add bindings for symbols that need weak or non-lazy bindings.
34 void addNonLazyBindingEntries(const Symbol *, const InputSection *,
35                               uint64_t offset, int64_t addend = 0);
36 
37 extern OutputSection *firstTLVDataSection;
38 
39 } // namespace macho
40 } // namespace lld
41 
42 #endif
43