xref: /llvm-project/llvm/lib/Target/AArch64/AArch64TargetObjectFile.h (revision f65a21a4ecc2e712c700c59842b6b9a1d2a9a060)
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   void emitPersonalityValueImpl(MCStreamer &Streamer, const DataLayout &DL,
40                                 const MCSymbol *Sym,
41                                 const MachineModuleInfo *MMI) const override;
42 };
43 
44 /// AArch64_MachoTargetObjectFile - This TLOF implementation is used for Darwin.
45 class AArch64_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
46 public:
47   AArch64_MachoTargetObjectFile();
48 
49   const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
50                                         unsigned Encoding,
51                                         const TargetMachine &TM,
52                                         MachineModuleInfo *MMI,
53                                         MCStreamer &Streamer) const override;
54 
55   MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
56                                     const TargetMachine &TM,
57                                     MachineModuleInfo *MMI) const override;
58 
59   const MCExpr *getIndirectSymViaGOTPCRel(const GlobalValue *GV,
60                                           const MCSymbol *Sym,
61                                           const MCValue &MV, int64_t Offset,
62                                           MachineModuleInfo *MMI,
63                                           MCStreamer &Streamer) const override;
64 
65   void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
66                          const TargetMachine &TM) const override;
67 
68   MCSymbol *getAuthPtrSlotSymbol(const TargetMachine &TM,
69                                  MachineModuleInfo *MMI, const MCSymbol *RawSym,
70                                  AArch64PACKey::ID Key,
71                                  uint16_t Discriminator) const;
72 };
73 
74 /// This implementation is used for AArch64 COFF targets.
75 class AArch64_COFFTargetObjectFile : public TargetLoweringObjectFileCOFF {};
76 
77 } // end namespace llvm
78 
79 #endif
80