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