xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1 //===-- AArch64TargetObjectFile.h - AArch64 Object Info -*- 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 LLVM_LIB_TARGET_AARCH64_AARCH64TARGETOBJECTFILE_H
10 #define LLVM_LIB_TARGET_AARCH64_AARCH64TARGETOBJECTFILE_H
11 
12 #include "Utils/AArch64BaseInfo.h"
13 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
14 #include "llvm/Target/TargetLoweringObjectFile.h"
15 
16 namespace llvm {
17 
18 /// This implementation is used for AArch64 ELF targets (Linux in particular).
19 class AArch64_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
20   void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
21 
22 public:
23   AArch64_ELFTargetObjectFile() {
24     PLTRelativeVariantKind = MCSymbolRefExpr::VK_PLT;
25     SupportIndirectSymViaGOTPCRel = true;
26   }
27 
28   const MCExpr *getIndirectSymViaGOTPCRel(const GlobalValue *GV,
29                                           const MCSymbol *Sym,
30                                           const MCValue &MV, int64_t Offset,
31                                           MachineModuleInfo *MMI,
32                                           MCStreamer &Streamer) const override;
33 
34   MCSymbol *getAuthPtrSlotSymbol(const TargetMachine &TM,
35                                  MachineModuleInfo *MMI, const MCSymbol *RawSym,
36                                  AArch64PACKey::ID Key,
37                                  uint16_t Discriminator) const;
38 };
39 
40 /// AArch64_MachoTargetObjectFile - This TLOF implementation is used for Darwin.
41 class AArch64_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
42 public:
43   AArch64_MachoTargetObjectFile();
44 
45   const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
46                                         unsigned Encoding,
47                                         const TargetMachine &TM,
48                                         MachineModuleInfo *MMI,
49                                         MCStreamer &Streamer) const override;
50 
51   MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
52                                     const TargetMachine &TM,
53                                     MachineModuleInfo *MMI) const override;
54 
55   const MCExpr *getIndirectSymViaGOTPCRel(const GlobalValue *GV,
56                                           const MCSymbol *Sym,
57                                           const MCValue &MV, int64_t Offset,
58                                           MachineModuleInfo *MMI,
59                                           MCStreamer &Streamer) const override;
60 
61   void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
62                          const TargetMachine &TM) const override;
63 
64   MCSymbol *getAuthPtrSlotSymbol(const TargetMachine &TM,
65                                  MachineModuleInfo *MMI, const MCSymbol *RawSym,
66                                  AArch64PACKey::ID Key,
67                                  uint16_t Discriminator) const;
68 };
69 
70 /// This implementation is used for AArch64 COFF targets.
71 class AArch64_COFFTargetObjectFile : public TargetLoweringObjectFileCOFF {};
72 
73 } // end namespace llvm
74 
75 #endif
76