xref: /freebsd/contrib/llvm-project/lld/MachO/Writer.h (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
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::macho {
15 
16 class OutputSection;
17 class InputSection;
18 class Symbol;
19 
20 class LoadCommand {
21 public:
22   virtual ~LoadCommand() = default;
23   virtual uint32_t getSize() const = 0;
24   virtual void writeTo(uint8_t *buf) const = 0;
25 };
26 
27 template <class LP> void writeResult();
28 void resetWriter();
29 
30 void createSyntheticSections();
31 
32 // Add bindings for symbols that need weak or non-lazy bindings.
33 void addNonLazyBindingEntries(const Symbol *, const InputSection *,
34                               uint64_t offset, int64_t addend = 0);
35 
36 extern OutputSection *firstTLVDataSection;
37 
38 } // namespace lld::macho
39 
40 #endif
41