1 //===-- llvm/Target/X86/X86TargetObjectFile.cpp - X86 Object Info ---------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "X86TargetObjectFile.h"
11 #include "llvm/ADT/SmallString.h"
12 #include "llvm/Support/Mangler.h"
13 #include "llvm/MC/MCExpr.h"
16 const MCExpr
*X8664_MachoTargetObjectFile::
17 getSymbolForDwarfGlobalReference(const GlobalValue
*GV
, Mangler
*Mang
,
18 MachineModuleInfo
*MMI
,
19 bool &IsIndirect
, bool &IsPCRel
) const {
21 // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
22 // is an indirect pc-relative reference.
26 SmallString
<128> Name
;
27 Mang
->getNameWithPrefix(Name
, GV
, false);
30 MCSymbolRefExpr::Create(Name
.str(), getContext());
31 const MCExpr
*Four
= MCConstantExpr::Create(4, getContext());
32 return MCBinaryExpr::CreateAdd(Res
, Four
, getContext());