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 bool &IsIndirect
, bool &IsPCRel
) const {
20 // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
21 // is an indirect pc-relative reference.
25 SmallString
<128> Name
;
26 Mang
->getNameWithPrefix(Name
, GV
, false);
29 MCSymbolRefExpr::Create(Name
.str(), getContext());
30 const MCExpr
*Four
= MCConstantExpr::Create(4, getContext());
31 return MCBinaryExpr::CreateAdd(Res
, Four
, getContext());