xref: /freebsd/contrib/llvm-project/llvm/lib/Target/X86/X86TargetObjectFile.h (revision a8089ea5aee578e08acab2438e82fc9a9ae50ed8)
1 //===-- X86TargetObjectFile.h - X86 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_X86_X86TARGETOBJECTFILE_H
10 #define LLVM_LIB_TARGET_X86_X86TARGETOBJECTFILE_H
11 
12 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
13 
14 namespace llvm {
15 
16   /// X86_64MachoTargetObjectFile - This TLOF implementation is used for Darwin
17   /// x86-64.
18   class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
19   public:
20     const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
21                                           unsigned Encoding,
22                                           const TargetMachine &TM,
23                                           MachineModuleInfo *MMI,
24                                           MCStreamer &Streamer) const override;
25 
26     // getCFIPersonalitySymbol - The symbol that gets passed to
27     // .cfi_personality.
28     MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
29                                       const TargetMachine &TM,
30                                       MachineModuleInfo *MMI) const override;
31 
32     const MCExpr *getIndirectSymViaGOTPCRel(const GlobalValue *GV,
33                                             const MCSymbol *Sym,
34                                             const MCValue &MV, int64_t Offset,
35                                             MachineModuleInfo *MMI,
36                                             MCStreamer &Streamer) const override;
37   };
38 
39   /// This implementation is used for X86 ELF targets that don't have a further
40   /// specialization (and as a base class for X86_64, which does).
41   class X86ELFTargetObjectFile : public TargetLoweringObjectFileELF {
42   public:
43     X86ELFTargetObjectFile() {
44       PLTRelativeVariantKind = MCSymbolRefExpr::VK_PLT;
45     }
46     /// Describe a TLS variable address within debug info.
47     const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
48   };
49 
50   /// This implementation is used for X86_64 ELF targets, and defers to
51   /// X86ELFTargetObjectFile for commonalities with 32-bit targets.
52   class X86_64ELFTargetObjectFile : public X86ELFTargetObjectFile {
53   public:
54     X86_64ELFTargetObjectFile() { SupportIndirectSymViaGOTPCRel = true; }
55 
56     const MCExpr *
57     getIndirectSymViaGOTPCRel(const GlobalValue *GV, const MCSymbol *Sym,
58                               const MCValue &MV, int64_t Offset,
59                               MachineModuleInfo *MMI,
60                               MCStreamer &Streamer) const override;
61   };
62 
63 } // end namespace llvm
64 
65 #endif
66