xref: /freebsd/contrib/llvm-project/llvm/lib/Target/X86/X86TargetObjectFile.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
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     /// Describe a TLS variable address within debug info.
45     const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
46   };
47 
48   /// This implementation is used for X86_64 ELF targets, and defers to
49   /// X86ELFTargetObjectFile for commonalities with 32-bit targets.
50   class X86_64ELFTargetObjectFile : public X86ELFTargetObjectFile {
51   public:
X86_64ELFTargetObjectFile()52     X86_64ELFTargetObjectFile() { SupportIndirectSymViaGOTPCRel = true; }
53 
54     const MCExpr *
55     getIndirectSymViaGOTPCRel(const GlobalValue *GV, const MCSymbol *Sym,
56                               const MCValue &MV, int64_t Offset,
57                               MachineModuleInfo *MMI,
58                               MCStreamer &Streamer) const override;
59   };
60 
61 } // end namespace llvm
62 
63 #endif
64