[X86][ELF] Correct relocation for DWARF TLS references
[oota-llvm.git] / lib / Target / X86 / X86TargetObjectFile.h
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     X86_64MachoTargetObjectFile();
23
24     const MCExpr *
25     getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
26                             Mangler &Mang, const TargetMachine &TM,
27                             MachineModuleInfo *MMI,
28                             MCStreamer &Streamer) const override;
29
30     // getCFIPersonalitySymbol - The symbol that gets passed to
31     // .cfi_personality.
32     MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
33                                       const TargetMachine &TM,
34                                       MachineModuleInfo *MMI) const override;
35
36     const MCExpr *
37       getIndirectSymViaGOTPCRel(const MCSymbol *Sym,
38                                 int64_t Offset) const override;
39   };
40
41   /// \brief This implemenatation is used for X86 ELF targets that don't
42   /// have a further specialization.
43   class X86ELFTargetObjectFile : public TargetLoweringObjectFileELF {
44     /// \brief Describe a TLS variable address within debug info.
45     const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
46   };
47
48   /// X86LinuxTargetObjectFile - This implementation is used for linux x86
49   /// and x86-64.
50   class X86LinuxTargetObjectFile : public X86ELFTargetObjectFile {
51     void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
52   };
53
54   /// \brief This implementation is used for Windows targets on x86 and x86-64.
55   class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF {
56     const MCExpr *
57     getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler &Mang,
58                                 const TargetMachine &TM) const override;
59
60     /// \brief Given a mergeable constant with the specified size and relocation
61     /// information, return a section that it should be placed in.
62     const MCSection *getSectionForConstant(SectionKind Kind,
63                                            const Constant *C) const override;
64   };
65
66 } // end namespace llvm
67
68 #endif