LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
X86TargetObjectFile.cpp
Go to the documentation of this file.
1 //===-- X86TargetObjectFile.cpp - X86 Object Info -------------------------===//
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 #include "X86TargetObjectFile.h"
11 #include "llvm/MC/MCContext.h"
12 #include "llvm/MC/MCExpr.h"
13 #include "llvm/MC/MCSectionELF.h"
14 #include "llvm/Support/Dwarf.h"
15 #include "llvm/Target/Mangler.h"
16 
17 using namespace llvm;
18 using namespace dwarf;
19 
22  MachineModuleInfo *MMI, unsigned Encoding,
23  MCStreamer &Streamer) const {
24 
25  // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
26  // is an indirect pc-relative reference.
27  if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {
28  const MCSymbol *Sym = getSymbol(*Mang, GV);
29  const MCExpr *Res =
31  const MCExpr *Four = MCConstantExpr::Create(4, getContext());
32  return MCBinaryExpr::CreateAdd(Res, Four, getContext());
33  }
34 
36  getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
37 }
38 
41  MachineModuleInfo *MMI) const {
42  return getSymbol(*Mang, GV);
43 }
44 
45 void
46 X86LinuxTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM) {
48  InitializeELF(TM.Options.UseInitArray);
49 }
50 
51 const MCExpr *
52 X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
53  const MCSymbol *Sym) const {
54  return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
55 }
virtual const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const
static const MCConstantExpr * Create(int64_t Value, MCContext &Ctx)
Definition: MCExpr.cpp:152
virtual const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI, unsigned Encoding, MCStreamer &Streamer) const
virtual void Initialize(MCContext &ctx, const TargetMachine &TM)
static const MCSymbolRefExpr * Create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:270
virtual MCSymbol * getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang, MachineModuleInfo *MMI) const
static const MCBinaryExpr * CreateAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:396