xref: /llvm-project-15.0.7/lld/MachO/Target.h (revision fbdcfcd4)
1 //===- Target.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_TARGET_H
10 #define LLD_MACHO_TARGET_H
11 
12 #include <cstdint>
13 
14 namespace lld {
15 namespace macho {
16 
17 enum {
18   // We are currently only supporting 64-bit targets since macOS and iOS are
19   // deprecating 32-bit apps.
20   WordSize = 8,
21   PageSize = 4096,
22   ImageBase = 4096,
23   MaxAlignmentPowerOf2 = 32,
24 };
25 
26 class TargetInfo {
27 public:
28   virtual ~TargetInfo() = default;
29   virtual uint64_t getImplicitAddend(const uint8_t *loc,
30                                      uint8_t type) const = 0;
31   virtual void relocateOne(uint8_t *loc, uint8_t type, uint64_t val) const = 0;
32 
33   uint32_t cpuType;
34   uint32_t cpuSubtype;
35 };
36 
37 TargetInfo *createX86_64TargetInfo();
38 
39 extern TargetInfo *target;
40 
41 } // namespace macho
42 } // namespace lld
43 
44 #endif
45