1 //===-- X86TargetObjectFile.h - X86 Object Info -----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_LIB_TARGET_X86_X86TARGETOBJECTFILE_H
11 #define LLVM_LIB_TARGET_X86_X86TARGETOBJECTFILE_H
12 
13 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
14 #include "llvm/Target/TargetLoweringObjectFile.h"
15 
16 namespace llvm {
17 
18   /// X86_64MachoTargetObjectFile - This TLOF implementation is used for Darwin
19   /// x86-64.
20   class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
21   public:
22     const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
23                                           unsigned Encoding,
24                                           const TargetMachine &TM,
25                                           MachineModuleInfo *MMI,
26                                           MCStreamer &Streamer) const override;
27 
28     // getCFIPersonalitySymbol - The symbol that gets passed to
29     // .cfi_personality.
30     MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
31                                       const TargetMachine &TM,
32                                       MachineModuleInfo *MMI) const override;
33 
34     const MCExpr *getIndirectSymViaGOTPCRel(const MCSymbol *Sym,
35                                             const MCValue &MV, int64_t Offset,
36                                             MachineModuleInfo *MMI,
37                                             MCStreamer &Streamer) const override;
38   };
39 
40   /// \brief This implemenatation is used for X86 ELF targets that don't
41   /// have a further specialization.
42   class X86ELFTargetObjectFile : public TargetLoweringObjectFileELF {
43   public:
44     X86ELFTargetObjectFile() {
45       PLTRelativeVariantKind = MCSymbolRefExpr::VK_PLT;
46     }
47 
48     /// \brief Describe a TLS variable address within debug info.
49     const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
50   };
51 
52   /// X86FreeBSDTargetObjectFile - This implementation is used for FreeBSD
53   /// on x86 and x86-64.
54   class X86FreeBSDTargetObjectFile : public X86ELFTargetObjectFile {
55     void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
56   };
57 
58   /// \brief This implementation is used for Fuchsia on x86-64.
59   class X86FuchsiaTargetObjectFile : public X86ELFTargetObjectFile {
60     void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
61   };
62 
63   /// X86LinuxNaClTargetObjectFile - This implementation is used for linux and
64   /// Native Client on x86 and x86-64.
65   class X86LinuxNaClTargetObjectFile : public X86ELFTargetObjectFile {
66     void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
67   };
68 
69   /// \brief This implementation is used for Windows targets on x86 and x86-64.
70   class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF {
71     const MCExpr *
72     lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS,
73                            const TargetMachine &TM) const override;
74 
75     /// \brief Given a mergeable constant with the specified size and relocation
76     /// information, return a section that it should be placed in.
77     MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
78                                      const Constant *C,
79                                      unsigned &Align) const override;
80   };
81 
82 } // end namespace llvm
83 
84 #endif
85