blob: a184b92d3c9f31b306033663f04a58f747163e98 [file] [log] [blame]
Chris Lattner5e693ed2009-07-28 03:13:23 +00001//===-- llvm/Target/TargetLoweringObjectFile.cpp - Object File 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// This file implements classes used to handle lowerings specific to common
11// object file formats.
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/Target/TargetLoweringObjectFile.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000016#include "llvm/IR/Constants.h"
17#include "llvm/IR/DataLayout.h"
18#include "llvm/IR/DerivedTypes.h"
19#include "llvm/IR/Function.h"
20#include "llvm/IR/GlobalVariable.h"
Rafael Espindola894843c2014-01-07 21:19:40 +000021#include "llvm/IR/Mangler.h"
Rafael Espindola117b20c2013-12-05 05:53:12 +000022#include "llvm/MC/MCAsmInfo.h"
Chris Lattner4d2c0f92009-07-31 18:48:30 +000023#include "llvm/MC/MCContext.h"
Chris Lattnerb8666022009-09-16 01:46:41 +000024#include "llvm/MC/MCExpr.h"
Chris Lattner03627cb2010-03-11 21:55:20 +000025#include "llvm/MC/MCStreamer.h"
Chris Lattnerccbeed22010-01-13 21:29:21 +000026#include "llvm/MC/MCSymbol.h"
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +000027#include "llvm/Support/Dwarf.h"
Chris Lattnerd82510e2009-11-07 09:20:54 +000028#include "llvm/Support/ErrorHandling.h"
Chris Lattnerccbeed22010-01-13 21:29:21 +000029#include "llvm/Support/raw_ostream.h"
Rafael Espindoladaeafb42014-02-19 17:23:20 +000030#include "llvm/Target/TargetLowering.h"
Chandler Carruth442f7842014-03-04 10:07:28 +000031#include "llvm/Target/TargetMachine.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000032#include "llvm/Target/TargetOptions.h"
Eric Christopherd9134482014-08-04 21:25:23 +000033#include "llvm/Target/TargetSubtargetInfo.h"
Chris Lattner5e693ed2009-07-28 03:13:23 +000034using namespace llvm;
35
36//===----------------------------------------------------------------------===//
37// Generic Code
38//===----------------------------------------------------------------------===//
39
Evan Cheng76792992011-07-20 05:58:47 +000040/// Initialize - this method must be called before any actual lowering is
41/// done. This specifies the current context for codegen, and gives the
42/// lowering implementations a chance to set up their default sections.
43void TargetLoweringObjectFile::Initialize(MCContext &ctx,
44 const TargetMachine &TM) {
45 Ctx = &ctx;
Eric Christopher8b770652015-01-26 19:03:15 +000046 DL = TM.getDataLayout();
Evan Chengbbf3b0d2011-07-20 19:50:42 +000047 InitMCObjectFileInfo(TM.getTargetTriple(),
48 TM.getRelocationModel(), TM.getCodeModel(), *Ctx);
Chris Lattner5e693ed2009-07-28 03:13:23 +000049}
Saleem Abdulrasool0d3d6c42014-04-16 04:15:25 +000050
Chris Lattner5e693ed2009-07-28 03:13:23 +000051TargetLoweringObjectFile::~TargetLoweringObjectFile() {
52}
53
Nick Lewycky50f02cb2011-12-02 22:16:29 +000054static bool isSuitableForBSS(const GlobalVariable *GV, bool NoZerosInBSS) {
Jay Foad60020682011-06-19 18:37:11 +000055 const Constant *C = GV->getInitializer();
Anton Korobeynikov1df58862009-09-09 08:41:20 +000056
Chris Lattner5e693ed2009-07-28 03:13:23 +000057 // Must have zero initializer.
58 if (!C->isNullValue())
59 return false;
Anton Korobeynikov1df58862009-09-09 08:41:20 +000060
Chris Lattner5e693ed2009-07-28 03:13:23 +000061 // Leave constant zeros in readonly constant sections, so they can be shared.
62 if (GV->isConstant())
63 return false;
Anton Korobeynikov1df58862009-09-09 08:41:20 +000064
Chris Lattner5e693ed2009-07-28 03:13:23 +000065 // If the global has an explicit section specified, don't put it in BSS.
David Majnemer483e4e02014-05-17 05:18:40 +000066 if (GV->hasSection())
Chris Lattner5e693ed2009-07-28 03:13:23 +000067 return false;
Anton Korobeynikov1df58862009-09-09 08:41:20 +000068
Chris Lattner5e693ed2009-07-28 03:13:23 +000069 // If -nozero-initialized-in-bss is specified, don't ever use BSS.
70 if (NoZerosInBSS)
71 return false;
Anton Korobeynikov1df58862009-09-09 08:41:20 +000072
Chris Lattner5e693ed2009-07-28 03:13:23 +000073 // Otherwise, put it in BSS!
74 return true;
75}
76
Chris Lattner81bbf442009-08-04 16:13:09 +000077/// IsNullTerminatedString - Return true if the specified constant (which is
78/// known to have a type that is an array of 1/2/4 byte elements) ends with a
Chris Lattner139822f2012-01-24 14:17:05 +000079/// nul value and contains no other nuls in it. Note that this is more general
80/// than ConstantDataSequential::isString because we allow 2 & 4 byte strings.
Chris Lattner81bbf442009-08-04 16:13:09 +000081static bool IsNullTerminatedString(const Constant *C) {
Chris Lattner139822f2012-01-24 14:17:05 +000082 // First check: is we have constant array terminated with zero
Chris Lattner139822f2012-01-24 14:17:05 +000083 if (const ConstantDataSequential *CDS = dyn_cast<ConstantDataSequential>(C)) {
84 unsigned NumElts = CDS->getNumElements();
85 assert(NumElts != 0 && "Can't have an empty CDS");
86
87 if (CDS->getElementAsInteger(NumElts-1) != 0)
88 return false; // Not null terminated.
89
90 // Verify that the null doesn't occur anywhere else in the string.
91 for (unsigned i = 0; i != NumElts-1; ++i)
92 if (CDS->getElementAsInteger(i) == 0)
93 return false;
94 return true;
95 }
Chris Lattner5e693ed2009-07-28 03:13:23 +000096
97 // Another possibility: [1 x i8] zeroinitializer
98 if (isa<ConstantAggregateZero>(C))
Chris Lattner139822f2012-01-24 14:17:05 +000099 return cast<ArrayType>(C->getType())->getNumElements() == 1;
Chris Lattner5e693ed2009-07-28 03:13:23 +0000100
101 return false;
102}
103
Rafael Espindolaf4e6b292013-12-02 16:25:47 +0000104MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
Rafael Espindoladaeafb42014-02-19 17:23:20 +0000105 const GlobalValue *GV, StringRef Suffix, Mangler &Mang,
106 const TargetMachine &TM) const {
Rafael Espindola117b20c2013-12-05 05:53:12 +0000107 assert(!Suffix.empty());
Rafael Espindola117b20c2013-12-05 05:53:12 +0000108
Rafael Espindolaf4e6b292013-12-02 16:25:47 +0000109 SmallString<60> NameStr;
Rafael Espindola58873562014-01-03 19:21:54 +0000110 NameStr += DL->getPrivateGlobalPrefix();
Rafael Espindolaa3ad4e62014-02-19 20:30:41 +0000111 TM.getNameWithPrefix(NameStr, GV, Mang);
Rafael Espindolaf4e6b292013-12-02 16:25:47 +0000112 NameStr.append(Suffix.begin(), Suffix.end());
Jim Grosbach6f482002015-05-18 18:43:14 +0000113 return Ctx->getOrCreateSymbol(NameStr);
Rafael Espindolaf4e6b292013-12-02 16:25:47 +0000114}
Rafael Espindolae133ed82013-10-29 17:28:26 +0000115
Rafael Espindoladaeafb42014-02-19 17:23:20 +0000116MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
117 const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
118 MachineModuleInfo *MMI) const {
Rafael Espindolaa3ad4e62014-02-19 20:30:41 +0000119 return TM.getSymbol(GV, Mang);
Rafael Espindolaa83b1772011-04-16 03:51:21 +0000120}
121
122void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
123 const TargetMachine &TM,
124 const MCSymbol *Sym) const {
Rafael Espindolaa83b1772011-04-16 03:51:21 +0000125}
126
127
Chris Lattnercbc7b262009-08-05 04:25:40 +0000128/// getKindForGlobal - This is a top-level target-independent classifier for
Chris Lattnerc9c277b2009-08-01 21:11:14 +0000129/// a global variable. Given an global variable and information from TM, it
130/// classifies the global in a variety of ways that make various target
131/// implementations simpler. The target implementation is free to ignore this
132/// extra info of course.
Chris Lattnercbc7b262009-08-05 04:25:40 +0000133SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV,
134 const TargetMachine &TM){
135 assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
136 "Can only be used for global definitions");
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000137
Chris Lattner5e693ed2009-07-28 03:13:23 +0000138 Reloc::Model ReloModel = TM.getRelocationModel();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000139
Chris Lattner5e693ed2009-07-28 03:13:23 +0000140 // Early exit - functions should be always in text sections.
141 const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
Craig Topper062a2ba2014-04-25 05:30:21 +0000142 if (!GVar)
Chris Lattnerf8d97102009-08-01 23:57:16 +0000143 return SectionKind::getText();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000144
Chris Lattner5e693ed2009-07-28 03:13:23 +0000145 // Handle thread-local data first.
146 if (GVar->isThreadLocal()) {
Nick Lewycky50f02cb2011-12-02 22:16:29 +0000147 if (isSuitableForBSS(GVar, TM.Options.NoZerosInBSS))
Chris Lattnerf8d97102009-08-01 23:57:16 +0000148 return SectionKind::getThreadBSS();
149 return SectionKind::getThreadData();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000150 }
151
Chris Lattner5b585f82010-01-19 02:48:26 +0000152 // Variables with common linkage always get classified as common.
153 if (GVar->hasCommonLinkage())
154 return SectionKind::getCommon();
155
Chris Lattner5e693ed2009-07-28 03:13:23 +0000156 // Variable can be easily put to BSS section.
Nick Lewycky50f02cb2011-12-02 22:16:29 +0000157 if (isSuitableForBSS(GVar, TM.Options.NoZerosInBSS)) {
Chris Lattnerb2534212010-01-19 04:15:51 +0000158 if (GVar->hasLocalLinkage())
159 return SectionKind::getBSSLocal();
160 else if (GVar->hasExternalLinkage())
161 return SectionKind::getBSSExtern();
Chris Lattnerf8d97102009-08-01 23:57:16 +0000162 return SectionKind::getBSS();
Chris Lattnerb2534212010-01-19 04:15:51 +0000163 }
Chris Lattner5e693ed2009-07-28 03:13:23 +0000164
Jay Foad60020682011-06-19 18:37:11 +0000165 const Constant *C = GVar->getInitializer();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000166
Chris Lattner5e693ed2009-07-28 03:13:23 +0000167 // If the global is marked constant, we can put it into a mergable section,
168 // a mergable string section, or general .data if it contains relocations.
Chris Lattnerea4e9832011-01-18 01:23:44 +0000169 if (GVar->isConstant()) {
Chris Lattner5e693ed2009-07-28 03:13:23 +0000170 // If the initializer for the global contains something that requires a
Eric Christopherde9e92e2012-05-05 01:16:06 +0000171 // relocation, then we may have to drop this into a writable data section
Chris Lattner5e693ed2009-07-28 03:13:23 +0000172 // even though it is marked const.
173 switch (C->getRelocationInfo()) {
Chris Lattner5e693ed2009-07-28 03:13:23 +0000174 case Constant::NoRelocation:
Chris Lattnerea4e9832011-01-18 01:23:44 +0000175 // If the global is required to have a unique address, it can't be put
176 // into a mergable section: just drop it into the general read-only
177 // section instead.
178 if (!GVar->hasUnnamedAddr())
179 return SectionKind::getReadOnly();
180
Chris Lattner5e693ed2009-07-28 03:13:23 +0000181 // If initializer is a null-terminated string, put it in a "cstring"
Chris Lattner81bbf442009-08-04 16:13:09 +0000182 // section of the right width.
Chris Lattner229907c2011-07-18 04:54:35 +0000183 if (ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) {
184 if (IntegerType *ITy =
Chris Lattner81bbf442009-08-04 16:13:09 +0000185 dyn_cast<IntegerType>(ATy->getElementType())) {
186 if ((ITy->getBitWidth() == 8 || ITy->getBitWidth() == 16 ||
187 ITy->getBitWidth() == 32) &&
188 IsNullTerminatedString(C)) {
189 if (ITy->getBitWidth() == 8)
190 return SectionKind::getMergeable1ByteCString();
191 if (ITy->getBitWidth() == 16)
192 return SectionKind::getMergeable2ByteCString();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000193
Chris Lattner81bbf442009-08-04 16:13:09 +0000194 assert(ITy->getBitWidth() == 32 && "Unknown width");
195 return SectionKind::getMergeable4ByteCString();
196 }
197 }
198 }
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000199
Chris Lattner5e693ed2009-07-28 03:13:23 +0000200 // Otherwise, just drop it into a mergable constant section. If we have
201 // a section for this size, use it, otherwise use the arbitrary sized
202 // mergable section.
Eric Christopher8b770652015-01-26 19:03:15 +0000203 switch (TM.getDataLayout()->getTypeAllocSize(C->getType())) {
Chris Lattnerf8d97102009-08-01 23:57:16 +0000204 case 4: return SectionKind::getMergeableConst4();
205 case 8: return SectionKind::getMergeableConst8();
206 case 16: return SectionKind::getMergeableConst16();
Rafael Espindola33804ca2015-01-29 14:12:41 +0000207 default:
208 return SectionKind::getReadOnly();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000209 }
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000210
Chris Lattner5e693ed2009-07-28 03:13:23 +0000211 case Constant::LocalRelocation:
212 // In static relocation model, the linker will resolve all addresses, so
213 // the relocation entries will actually be constants by the time the app
214 // starts up. However, we can't put this into a mergable section, because
215 // the linker doesn't take relocations into consideration when it tries to
216 // merge entries in the section.
217 if (ReloModel == Reloc::Static)
Chris Lattnerf8d97102009-08-01 23:57:16 +0000218 return SectionKind::getReadOnly();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000219
Chris Lattner5e693ed2009-07-28 03:13:23 +0000220 // Otherwise, the dynamic linker needs to fix it up, put it in the
221 // writable data.rel.local section.
Chris Lattnerf8d97102009-08-01 23:57:16 +0000222 return SectionKind::getReadOnlyWithRelLocal();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000223
Chris Lattner5e693ed2009-07-28 03:13:23 +0000224 case Constant::GlobalRelocations:
225 // In static relocation model, the linker will resolve all addresses, so
226 // the relocation entries will actually be constants by the time the app
227 // starts up. However, we can't put this into a mergable section, because
228 // the linker doesn't take relocations into consideration when it tries to
229 // merge entries in the section.
230 if (ReloModel == Reloc::Static)
Chris Lattnerf8d97102009-08-01 23:57:16 +0000231 return SectionKind::getReadOnly();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000232
Chris Lattner5e693ed2009-07-28 03:13:23 +0000233 // Otherwise, the dynamic linker needs to fix it up, put it in the
234 // writable data.rel section.
Chris Lattnerf8d97102009-08-01 23:57:16 +0000235 return SectionKind::getReadOnlyWithRel();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000236 }
237 }
238
239 // Okay, this isn't a constant. If the initializer for the global is going
240 // to require a runtime relocation by the dynamic linker, put it into a more
241 // specific section to improve startup time of the app. This coalesces these
242 // globals together onto fewer pages, improving the locality of the dynamic
243 // linker.
244 if (ReloModel == Reloc::Static)
Chris Lattnerf8d97102009-08-01 23:57:16 +0000245 return SectionKind::getDataNoRel();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000246
247 switch (C->getRelocationInfo()) {
Chris Lattner5e693ed2009-07-28 03:13:23 +0000248 case Constant::NoRelocation:
Chris Lattnerf8d97102009-08-01 23:57:16 +0000249 return SectionKind::getDataNoRel();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000250 case Constant::LocalRelocation:
Chris Lattnerf8d97102009-08-01 23:57:16 +0000251 return SectionKind::getDataRelLocal();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000252 case Constant::GlobalRelocations:
Chris Lattnerf8d97102009-08-01 23:57:16 +0000253 return SectionKind::getDataRel();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000254 }
Chandler Carruthf3e85022012-01-10 18:08:01 +0000255 llvm_unreachable("Invalid relocation");
Chris Lattner5e693ed2009-07-28 03:13:23 +0000256}
257
Rafael Espindola0709a7b2015-05-21 19:20:38 +0000258/// This method computes the appropriate section to emit the specified global
259/// variable or function definition. This should not be passed external (or
260/// available externally) globals.
261MCSection *
262TargetLoweringObjectFile::SectionForGlobal(const GlobalValue *GV,
263 SectionKind Kind, Mangler &Mang,
264 const TargetMachine &TM) const {
Chris Lattner5e693ed2009-07-28 03:13:23 +0000265 // Select section name.
Chris Lattner1ff90132009-08-06 16:39:58 +0000266 if (GV->hasSection())
267 return getExplicitSectionGlobal(GV, Kind, Mang, TM);
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000268
269
Chris Lattner5e693ed2009-07-28 03:13:23 +0000270 // Use default section depending on the 'type' of global
Chris Lattner26fb2772009-08-01 21:46:23 +0000271 return SelectSectionForGlobal(GV, Kind, Mang, TM);
Chris Lattner5e693ed2009-07-28 03:13:23 +0000272}
273
Rafael Espindola0709a7b2015-05-21 19:20:38 +0000274MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
Rafael Espindola29786d42015-02-12 17:16:46 +0000275 const Function &F, Mangler &Mang, const TargetMachine &TM) const {
276 return getSectionForConstant(SectionKind::getReadOnly(), /*C=*/nullptr);
277}
278
Rafael Espindoladf195192015-02-17 23:34:51 +0000279bool TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection(
280 bool UsesLabelDifference, const Function &F) const {
281 // In PIC mode, we need to emit the jump table to the same section as the
282 // function body itself, otherwise the label differences won't make sense.
283 // FIXME: Need a better predicate for this: what about custom entries?
284 if (UsesLabelDifference)
285 return true;
286
287 // We should also do if the section name is NULL or function is declared
288 // in discardable section
289 // FIXME: this isn't the right predicate, should be based on the MCSection
290 // for the function.
291 if (F.isWeakForLinker())
292 return true;
293
294 return false;
295}
296
Rafael Espindola0709a7b2015-05-21 19:20:38 +0000297/// Given a mergable constant with the specified size and relocation
298/// information, return a section that it should be placed in.
299MCSection *
David Majnemer8bce66b2014-07-14 22:57:27 +0000300TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind,
301 const Constant *C) const {
Craig Topper062a2ba2014-04-25 05:30:21 +0000302 if (Kind.isReadOnly() && ReadOnlySection != nullptr)
Chris Lattner5e693ed2009-07-28 03:13:23 +0000303 return ReadOnlySection;
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000304
Chris Lattner5e693ed2009-07-28 03:13:23 +0000305 return DataSection;
306}
307
Anton Korobeynikove42af362012-11-14 01:47:00 +0000308/// getTTypeGlobalReference - Return an MCExpr to use for a
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000309/// reference to the specified global variable from exception
310/// handling information.
Rafael Espindola15b26692014-02-09 14:50:44 +0000311const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
312 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
Rafael Espindoladaeafb42014-02-19 17:23:20 +0000313 const TargetMachine &TM, MachineModuleInfo *MMI,
314 MCStreamer &Streamer) const {
Anton Korobeynikove42af362012-11-14 01:47:00 +0000315 const MCSymbolRefExpr *Ref =
Rafael Espindolaa3ad4e62014-02-19 20:30:41 +0000316 MCSymbolRefExpr::Create(TM.getSymbol(GV, Mang), getContext());
Anton Korobeynikove42af362012-11-14 01:47:00 +0000317
318 return getTTypeReference(Ref, Encoding, Streamer);
Chris Lattnerb8666022009-09-16 01:46:41 +0000319}
Chris Lattner5e693ed2009-07-28 03:13:23 +0000320
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000321const MCExpr *TargetLoweringObjectFile::
Anton Korobeynikove42af362012-11-14 01:47:00 +0000322getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
323 MCStreamer &Streamer) const {
Rafael Espindolaa01cdb02011-04-15 15:11:06 +0000324 switch (Encoding & 0x70) {
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000325 default:
Chris Lattner2104b8d2010-04-07 22:58:41 +0000326 report_fatal_error("We do not support this DWARF encoding yet!");
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000327 case dwarf::DW_EH_PE_absptr:
328 // Do nothing special
Anton Korobeynikove42af362012-11-14 01:47:00 +0000329 return Sym;
Chris Lattner03627cb2010-03-11 21:55:20 +0000330 case dwarf::DW_EH_PE_pcrel: {
331 // Emit a label to the streamer for the current position. This gives us
332 // .-foo addressing.
Jim Grosbach6f482002015-05-18 18:43:14 +0000333 MCSymbol *PCSym = getContext().createTempSymbol();
Chris Lattner03627cb2010-03-11 21:55:20 +0000334 Streamer.EmitLabel(PCSym);
335 const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, getContext());
Anton Korobeynikove42af362012-11-14 01:47:00 +0000336 return MCBinaryExpr::CreateSub(Sym, PC, getContext());
Chris Lattner03627cb2010-03-11 21:55:20 +0000337 }
338 }
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000339}
David Blaikief2694972013-06-28 20:05:11 +0000340
Ulrich Weigand2b6fc8d2013-07-02 18:47:09 +0000341const MCExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
David Blaikief2694972013-06-28 20:05:11 +0000342 // FIXME: It's not clear what, if any, default this should have - perhaps a
343 // null return could mean 'no location' & we should just do that here.
344 return MCSymbolRefExpr::Create(Sym, *Ctx);
345}
David Majnemer7db449a2015-03-17 23:54:51 +0000346
347void TargetLoweringObjectFile::getNameWithPrefix(
348 SmallVectorImpl<char> &OutName, const GlobalValue *GV,
349 bool CannotUsePrivateLabel, Mangler &Mang, const TargetMachine &TM) const {
350 Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
351}