blob: f6aa570b6332af2a518c65385129219f8dfdc6a5 [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- X86TargetObjectFile.h - X86 Object Info -----------------*- C++ -*-===//
Chris Lattnerb8666022009-09-16 01:46:41 +00002//
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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_LIB_TARGET_X86_X86TARGETOBJECTFILE_H
11#define LLVM_LIB_TARGET_X86_X86TARGETOBJECTFILE_H
Chris Lattnerb8666022009-09-16 01:46:41 +000012
Anton Korobeynikovab663a02010-02-15 22:37:53 +000013#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
Chris Lattnerb8666022009-09-16 01:46:41 +000014#include "llvm/Target/TargetLoweringObjectFile.h"
15
16namespace llvm {
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +000017
Bill Wendling8ed44462012-06-26 10:05:06 +000018 /// X86_64MachoTargetObjectFile - This TLOF implementation is used for Darwin
Bill Wendling03448742010-03-15 19:04:37 +000019 /// x86-64.
Bill Wendling8ed44462012-06-26 10:05:06 +000020 class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
Bill Wendling03448742010-03-15 19:04:37 +000021 public:
Eric Christopher4367c7f2016-09-16 07:33:15 +000022 const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
23 unsigned Encoding,
24 const TargetMachine &TM,
25 MachineModuleInfo *MMI,
26 MCStreamer &Streamer) const override;
Rafael Espindola08704342011-04-27 23:08:15 +000027
28 // getCFIPersonalitySymbol - The symbol that gets passed to
29 // .cfi_personality.
Eric Christopher4367c7f2016-09-16 07:33:15 +000030 MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
Rafael Espindoladaeafb42014-02-19 17:23:20 +000031 const TargetMachine &TM,
Craig Topper73156022014-03-02 09:09:27 +000032 MachineModuleInfo *MMI) const override;
Bruno Cardoso Lopes24492b02015-02-23 21:26:18 +000033
Bruno Cardoso Lopes618c67a2015-03-06 13:49:05 +000034 const MCExpr *getIndirectSymViaGOTPCRel(const MCSymbol *Sym,
35 const MCValue &MV, int64_t Offset,
36 MachineModuleInfo *MMI,
37 MCStreamer &Streamer) const override;
Chris Lattnerb8666022009-09-16 01:46:41 +000038 };
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +000039
Paul Robinson06a8eb82015-03-03 21:01:27 +000040 /// \brief This implemenatation is used for X86 ELF targets that don't
41 /// have a further specialization.
42 class X86ELFTargetObjectFile : public TargetLoweringObjectFileELF {
Peter Collingbourne265ebd72016-04-22 20:40:10 +000043 public:
44 X86ELFTargetObjectFile() {
45 PLTRelativeVariantKind = MCSymbolRefExpr::VK_PLT;
46 }
47
David Blaikie1b01ae82013-07-01 21:45:25 +000048 /// \brief Describe a TLS variable address within debug info.
Craig Topper73156022014-03-02 09:09:27 +000049 const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
Rafael Espindolaca3e0ee2012-06-19 00:48:28 +000050 };
51
Davide Italianoa9f85d62016-09-26 22:53:15 +000052 /// 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
Petr Hoseke023d622016-10-06 05:17:26 +000058 /// \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
Derek Schuff072f93f2015-03-11 16:16:09 +000063 /// X86LinuxNaClTargetObjectFile - This implementation is used for linux and
64 /// Native Client on x86 and x86-64.
65 class X86LinuxNaClTargetObjectFile : public X86ELFTargetObjectFile {
Paul Robinson06a8eb82015-03-03 21:01:27 +000066 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
67 };
68
Davide Italiano9b8e3d32017-06-21 20:36:32 +000069 /// \brief This implementation is used for Solaris on x86/x86-64.
70 class X86SolarisTargetObjectFile : public X86ELFTargetObjectFile {
71 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
72 };
73
David Majnemerdee10572014-01-15 09:16:42 +000074 /// \brief This implementation is used for Windows targets on x86 and x86-64.
75 class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF {
Craig Topper73156022014-03-02 09:09:27 +000076 const MCExpr *
Peter Collingbourne265ebd72016-04-22 20:40:10 +000077 lowerRelativeReference(const GlobalValue *LHS, const GlobalValue *RHS,
Peter Collingbourne265ebd72016-04-22 20:40:10 +000078 const TargetMachine &TM) const override;
David Majnemer8bce66b2014-07-14 22:57:27 +000079
80 /// \brief Given a mergeable constant with the specified size and relocation
81 /// information, return a section that it should be placed in.
Mehdi Amini5c0fa582015-07-16 06:04:17 +000082 MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
David Majnemera3ea4072016-02-21 01:30:30 +000083 const Constant *C,
84 unsigned &Align) const override;
David Majnemerdee10572014-01-15 09:16:42 +000085 };
86
Chris Lattnerb8666022009-09-16 01:46:41 +000087} // end namespace llvm
88
89#endif