1 //===-- llvm/Target/TargetLoweringObjectFile.cpp - Object File 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 // This file implements classes used to handle lowerings specific to common
11 // object file formats.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/Target/TargetLoweringObjectFile.h"
16 #include "llvm/Constants.h"
17 #include "llvm/DerivedTypes.h"
18 #include "llvm/GlobalVariable.h"
19 #include "llvm/MC/MCContext.h"
20 #include "llvm/MC/MCSection.h"
21 #include "llvm/Target/TargetMachine.h"
22 #include "llvm/Target/TargetData.h"
23 #include "llvm/Target/TargetOptions.h"
24 #include "llvm/Support/Mangler.h"
25 #include "llvm/ADT/StringExtras.h"
28 //===----------------------------------------------------------------------===//
30 //===----------------------------------------------------------------------===//
32 TargetLoweringObjectFile::TargetLoweringObjectFile() : Ctx(0) {
37 StaticCtorSection = 0;
38 StaticDtorSection = 0;
43 TargetLoweringObjectFile::~TargetLoweringObjectFile() {
46 static bool isSuitableForBSS(const GlobalVariable *GV) {
47 Constant *C = GV->getInitializer();
49 // Must have zero initializer.
50 if (!C->isNullValue())
53 // Leave constant zeros in readonly constant sections, so they can be shared.
57 // If the global has an explicit section specified, don't put it in BSS.
58 if (!GV->getSection().empty())
61 // If -nozero-initialized-in-bss is specified, don't ever use BSS.
65 // Otherwise, put it in BSS!
69 static bool isConstantString(const Constant *C) {
70 // First check: is we have constant array of i8 terminated with zero
71 const ConstantArray *CVA = dyn_cast<ConstantArray>(C);
72 // Check, if initializer is a null-terminated string
73 if (CVA && CVA->isCString())
76 // Another possibility: [1 x i8] zeroinitializer
77 if (isa<ConstantAggregateZero>(C))
78 if (const ArrayType *Ty = dyn_cast<ArrayType>(C->getType()))
79 return (Ty->getElementType() == Type::Int8Ty &&
80 Ty->getNumElements() == 1);
85 /// SectionKindForGlobal - This is a top-level target-independent classifier for
86 /// a global variable. Given an global variable and information from TM, it
87 /// classifies the global in a variety of ways that make various target
88 /// implementations simpler. The target implementation is free to ignore this
89 /// extra info of course.
90 static SectionKind SectionKindForGlobal(const GlobalValue *GV,
91 const TargetMachine &TM) {
92 Reloc::Model ReloModel = TM.getRelocationModel();
94 // Early exit - functions should be always in text sections.
95 const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
97 return SectionKind::getText();
100 // Handle thread-local data first.
101 if (GVar->isThreadLocal()) {
102 if (isSuitableForBSS(GVar))
103 return SectionKind::getThreadBSS();
104 return SectionKind::getThreadData();
107 // Variable can be easily put to BSS section.
108 if (isSuitableForBSS(GVar))
109 return SectionKind::getBSS();
111 Constant *C = GVar->getInitializer();
113 // If the global is marked constant, we can put it into a mergable section,
114 // a mergable string section, or general .data if it contains relocations.
115 if (GVar->isConstant()) {
116 // If the initializer for the global contains something that requires a
117 // relocation, then we may have to drop this into a wriable data section
118 // even though it is marked const.
119 switch (C->getRelocationInfo()) {
120 default: llvm_unreachable("unknown relocation info kind");
121 case Constant::NoRelocation:
122 // If initializer is a null-terminated string, put it in a "cstring"
123 // section if the target has it.
124 if (isConstantString(C))
125 return SectionKind::getMergeableCString();
127 // Otherwise, just drop it into a mergable constant section. If we have
128 // a section for this size, use it, otherwise use the arbitrary sized
130 switch (TM.getTargetData()->getTypeAllocSize(C->getType())) {
131 case 4: return SectionKind::getMergeableConst4();
132 case 8: return SectionKind::getMergeableConst8();
133 case 16: return SectionKind::getMergeableConst16();
134 default: return SectionKind::getMergeableConst();
137 case Constant::LocalRelocation:
138 // In static relocation model, the linker will resolve all addresses, so
139 // the relocation entries will actually be constants by the time the app
140 // starts up. However, we can't put this into a mergable section, because
141 // the linker doesn't take relocations into consideration when it tries to
142 // merge entries in the section.
143 if (ReloModel == Reloc::Static)
144 return SectionKind::getReadOnly();
146 // Otherwise, the dynamic linker needs to fix it up, put it in the
147 // writable data.rel.local section.
148 return SectionKind::getReadOnlyWithRelLocal();
150 case Constant::GlobalRelocations:
151 // In static relocation model, the linker will resolve all addresses, so
152 // the relocation entries will actually be constants by the time the app
153 // starts up. However, we can't put this into a mergable section, because
154 // the linker doesn't take relocations into consideration when it tries to
155 // merge entries in the section.
156 if (ReloModel == Reloc::Static)
157 return SectionKind::getReadOnly();
159 // Otherwise, the dynamic linker needs to fix it up, put it in the
160 // writable data.rel section.
161 return SectionKind::getReadOnlyWithRel();
165 // Okay, this isn't a constant. If the initializer for the global is going
166 // to require a runtime relocation by the dynamic linker, put it into a more
167 // specific section to improve startup time of the app. This coalesces these
168 // globals together onto fewer pages, improving the locality of the dynamic
170 if (ReloModel == Reloc::Static)
171 return SectionKind::getDataNoRel();
173 switch (C->getRelocationInfo()) {
174 default: llvm_unreachable("unknown relocation info kind");
175 case Constant::NoRelocation:
176 return SectionKind::getDataNoRel();
177 case Constant::LocalRelocation:
178 return SectionKind::getDataRelLocal();
179 case Constant::GlobalRelocations:
180 return SectionKind::getDataRel();
184 /// SectionForGlobal - This method computes the appropriate section to emit
185 /// the specified global variable or function definition. This should not
186 /// be passed external (or available externally) globals.
187 const MCSection *TargetLoweringObjectFile::
188 SectionForGlobal(const GlobalValue *GV, Mangler *Mang,
189 const TargetMachine &TM) const {
190 assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
191 "Can only be used for global definitions");
193 SectionKind Kind = SectionKindForGlobal(GV, TM);
195 // Select section name.
196 if (GV->hasSection()) {
197 // If the target has special section hacks for specifically named globals,
199 if (const MCSection *TS = getSpecialCasedSectionGlobals(GV, Mang, Kind))
202 // If the target has magic semantics for certain section names, make sure to
203 // pick up the flags. This allows the user to write things with attribute
204 // section and still get the appropriate section flags printed.
205 Kind = getKindForNamedSection(GV->getSection().c_str(), Kind);
207 return getOrCreateSection(GV->getSection().c_str(), false, Kind);
211 // Use default section depending on the 'type' of global
212 return SelectSectionForGlobal(GV, Kind, Mang, TM);
215 // Lame default implementation. Calculate the section name for global.
217 TargetLoweringObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
220 const TargetMachine &TM) const{
221 assert(!Kind.isThreadLocal() && "Doesn't support TLS");
224 return getTextSection();
226 if (Kind.isBSS() && BSSSection != 0)
229 if (Kind.isReadOnly() && ReadOnlySection != 0)
230 return ReadOnlySection;
232 return getDataSection();
235 /// getSectionForConstant - Given a mergable constant with the
236 /// specified size and relocation information, return a section that it
237 /// should be placed in.
239 TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
240 if (Kind.isReadOnly() && ReadOnlySection != 0)
241 return ReadOnlySection;
247 const MCSection *TargetLoweringObjectFile::
248 getOrCreateSection(const char *Name, bool isDirective, SectionKind Kind) const {
249 if (MCSection *S = Ctx->GetSection(Name))
251 return MCSection::Create(Name, isDirective, Kind, *Ctx);
256 //===----------------------------------------------------------------------===//
258 //===----------------------------------------------------------------------===//
260 void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
261 const TargetMachine &TM) {
262 TargetLoweringObjectFile::Initialize(Ctx, TM);
264 BSSSection = getOrCreateSection("\t.bss", true, SectionKind::getBSS());
266 // PPC/Linux doesn't support the .bss directive, it needs .section .bss.
267 // FIXME: Does .section .bss work everywhere??
268 // FIXME2: this should just be handle by the section printer. We should get
269 // away from syntactic view of the sections and MCSection should just be a
271 BSSSection = getOrCreateSection("\t.bss", false, SectionKind::getBSS());
274 TextSection = getOrCreateSection("\t.text", true, SectionKind::getText());
275 DataSection = getOrCreateSection("\t.data", true, SectionKind::getDataRel());
277 getOrCreateSection("\t.rodata", false, SectionKind::getReadOnly());
279 getOrCreateSection("\t.tdata", false, SectionKind::getThreadData());
280 CStringSection = getOrCreateSection("\t.rodata.str", true,
281 SectionKind::getMergeableCString());
283 TLSBSSSection = getOrCreateSection("\t.tbss", false,
284 SectionKind::getThreadBSS());
286 DataRelSection = getOrCreateSection("\t.data.rel", false,
287 SectionKind::getDataRel());
288 DataRelLocalSection = getOrCreateSection("\t.data.rel.local", false,
289 SectionKind::getDataRelLocal());
290 DataRelROSection = getOrCreateSection("\t.data.rel.ro", false,
291 SectionKind::getReadOnlyWithRel());
292 DataRelROLocalSection =
293 getOrCreateSection("\t.data.rel.ro.local", false,
294 SectionKind::getReadOnlyWithRelLocal());
296 MergeableConst4Section = getOrCreateSection(".rodata.cst4", false,
297 SectionKind::getMergeableConst4());
298 MergeableConst8Section = getOrCreateSection(".rodata.cst8", false,
299 SectionKind::getMergeableConst8());
300 MergeableConst16Section = getOrCreateSection(".rodata.cst16", false,
301 SectionKind::getMergeableConst16());
304 getOrCreateSection(".ctors", false, SectionKind::getDataRel());
306 getOrCreateSection(".dtors", false, SectionKind::getDataRel());
309 // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
310 // it contains relocatable pointers. In PIC mode, this is probably a big
311 // runtime hit for C++ apps. Either the contents of the LSDA need to be
312 // adjusted or this should be a data section.
314 getOrCreateSection(".gcc_except_table", false, SectionKind::getReadOnly());
316 getOrCreateSection(".eh_frame", false, SectionKind::getDataRel());
320 SectionKind TargetLoweringObjectFileELF::
321 getKindForNamedSection(const char *Name, SectionKind K) const {
322 if (Name[0] != '.') return K;
324 // Some lame default implementation based on some magic section names.
325 if (strncmp(Name, ".gnu.linkonce.b.", 16) == 0 ||
326 strncmp(Name, ".llvm.linkonce.b.", 17) == 0 ||
327 strncmp(Name, ".gnu.linkonce.sb.", 17) == 0 ||
328 strncmp(Name, ".llvm.linkonce.sb.", 18) == 0)
329 return SectionKind::getBSS();
331 if (strcmp(Name, ".tdata") == 0 ||
332 strncmp(Name, ".tdata.", 7) == 0 ||
333 strncmp(Name, ".gnu.linkonce.td.", 17) == 0 ||
334 strncmp(Name, ".llvm.linkonce.td.", 18) == 0)
335 return SectionKind::getThreadData();
337 if (strcmp(Name, ".tbss") == 0 ||
338 strncmp(Name, ".tbss.", 6) == 0 ||
339 strncmp(Name, ".gnu.linkonce.tb.", 17) == 0 ||
340 strncmp(Name, ".llvm.linkonce.tb.", 18) == 0)
341 return SectionKind::getThreadBSS();
346 void TargetLoweringObjectFileELF::
347 getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl<char> &Str) const {
351 if (!Kind.isMetadata())
355 if (Kind.isWriteable())
357 if (Kind.isMergeableCString() ||
358 Kind.isMergeableConst4() ||
359 Kind.isMergeableConst8() ||
360 Kind.isMergeableConst16())
362 if (Kind.isMergeableCString())
364 if (Kind.isThreadLocal())
370 // If comment string is '@', e.g. as on ARM - use '%' instead
377 if (Kind.isBSS() || Kind.isThreadBSS())
380 KindStr = "progbits";
382 Str.append(KindStr, KindStr+strlen(KindStr));
384 if (Kind.isMergeableCString()) {
385 // TODO: Eventually handle multiple byte character strings. For now, all
386 // mergable C strings are single byte.
389 } else if (Kind.isMergeableConst4()) {
392 } else if (Kind.isMergeableConst8()) {
395 } else if (Kind.isMergeableConst16()) {
403 static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) {
404 if (Kind.isText()) return ".gnu.linkonce.t.";
405 if (Kind.isReadOnly()) return ".gnu.linkonce.r.";
407 if (Kind.isThreadData()) return ".gnu.linkonce.td.";
408 if (Kind.isThreadBSS()) return ".gnu.linkonce.tb.";
410 if (Kind.isBSS()) return ".gnu.linkonce.b.";
411 if (Kind.isDataNoRel()) return ".gnu.linkonce.d.";
412 if (Kind.isDataRelLocal()) return ".gnu.linkonce.d.rel.local.";
413 if (Kind.isDataRel()) return ".gnu.linkonce.d.rel.";
414 if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local.";
416 assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
417 return ".gnu.linkonce.d.rel.ro.";
420 const MCSection *TargetLoweringObjectFileELF::
421 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
422 Mangler *Mang, const TargetMachine &TM) const {
424 // If this global is linkonce/weak and the target handles this by emitting it
425 // into a 'uniqued' section name, create and return the section now.
426 if (GV->isWeakForLinker()) {
427 const char *Prefix = getSectionPrefixForUniqueGlobal(Kind);
428 std::string Name = Mang->makeNameProper(GV->getNameStr());
429 return getOrCreateSection((Prefix+Name).c_str(), false, Kind);
432 if (Kind.isText()) return TextSection;
434 if (Kind.isMergeableCString()) {
435 assert(CStringSection && "Should have string section prefix");
437 // We also need alignment here.
438 // FIXME: this is getting the alignment of the character, not the
439 // alignment of the global!
441 TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV));
443 std::string Name = CStringSection->getName() + "1." + utostr(Align);
444 return getOrCreateSection(Name.c_str(), false,
445 SectionKind::getMergeableCString());
448 if (Kind.isMergeableConst()) {
449 if (Kind.isMergeableConst4())
450 return MergeableConst4Section;
451 if (Kind.isMergeableConst8())
452 return MergeableConst8Section;
453 if (Kind.isMergeableConst16())
454 return MergeableConst16Section;
455 return ReadOnlySection; // .const
458 if (Kind.isReadOnly()) return ReadOnlySection;
460 if (Kind.isThreadData()) return TLSDataSection;
461 if (Kind.isThreadBSS()) return TLSBSSSection;
463 if (Kind.isBSS()) return BSSSection;
465 if (Kind.isDataNoRel()) return DataSection;
466 if (Kind.isDataRelLocal()) return DataRelLocalSection;
467 if (Kind.isDataRel()) return DataRelSection;
468 if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
470 assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
471 return DataRelROSection;
474 /// getSectionForConstant - Given a mergeable constant with the
475 /// specified size and relocation information, return a section that it
476 /// should be placed in.
477 const MCSection *TargetLoweringObjectFileELF::
478 getSectionForConstant(SectionKind Kind) const {
479 if (Kind.isMergeableConst4())
480 return MergeableConst4Section;
481 if (Kind.isMergeableConst8())
482 return MergeableConst8Section;
483 if (Kind.isMergeableConst16())
484 return MergeableConst16Section;
485 if (Kind.isReadOnly())
486 return ReadOnlySection;
488 if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
489 assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
490 return DataRelROSection;
493 //===----------------------------------------------------------------------===//
495 //===----------------------------------------------------------------------===//
497 void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
498 const TargetMachine &TM) {
499 TargetLoweringObjectFile::Initialize(Ctx, TM);
500 TextSection = getOrCreateSection("\t.text", true,
501 SectionKind::getText());
502 DataSection = getOrCreateSection("\t.data", true,
503 SectionKind::getDataRel());
505 CStringSection = getOrCreateSection("\t.cstring", true,
506 SectionKind::getMergeableCString());
507 FourByteConstantSection = getOrCreateSection("\t.literal4\n", true,
508 SectionKind::getMergeableConst4());
509 EightByteConstantSection = getOrCreateSection("\t.literal8\n", true,
510 SectionKind::getMergeableConst8());
512 // ld_classic doesn't support .literal16 in 32-bit mode, and ld64 falls back
513 // to using it in -static mode.
514 if (TM.getRelocationModel() != Reloc::Static &&
515 TM.getTargetData()->getPointerSize() == 32)
516 SixteenByteConstantSection =
517 getOrCreateSection("\t.literal16\n", true,
518 SectionKind::getMergeableConst16());
520 SixteenByteConstantSection = 0;
522 ReadOnlySection = getOrCreateSection("\t.const", true,
523 SectionKind::getReadOnly());
526 getOrCreateSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions",
527 false, SectionKind::getText());
528 ConstTextCoalSection = getOrCreateSection("\t__TEXT,__const_coal,coalesced",
530 SectionKind::getText());
531 ConstDataCoalSection = getOrCreateSection("\t__DATA,__const_coal,coalesced",
533 SectionKind::getText());
534 ConstDataSection = getOrCreateSection("\t.const_data", true,
535 SectionKind::getReadOnlyWithRel());
536 DataCoalSection = getOrCreateSection("\t__DATA,__datacoal_nt,coalesced",
538 SectionKind::getDataRel());
540 if (TM.getRelocationModel() == Reloc::Static) {
542 getOrCreateSection(".constructor", true, SectionKind::getDataRel());
544 getOrCreateSection(".destructor", true, SectionKind::getDataRel());
547 getOrCreateSection(".mod_init_func", true, SectionKind::getDataRel());
549 getOrCreateSection(".mod_term_func", true, SectionKind::getDataRel());
552 LSDASection = getOrCreateSection("__DATA,__gcc_except_tab", false,
553 SectionKind::getDataRel());
555 getOrCreateSection("__TEXT,__eh_frame,coalesced,no_toc+strip_static_syms"
556 "+live_support", false, SectionKind::getReadOnly());
559 const MCSection *TargetLoweringObjectFileMachO::
560 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
561 Mangler *Mang, const TargetMachine &TM) const {
562 assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
565 return GV->isWeakForLinker() ? TextCoalSection : TextSection;
567 // If this is weak/linkonce, put this in a coalescable section, either in text
568 // or data depending on if it is writable.
569 if (GV->isWeakForLinker()) {
570 if (Kind.isReadOnly())
571 return ConstTextCoalSection;
572 return DataCoalSection;
575 // FIXME: Alignment check should be handled by section classifier.
576 if (Kind.isMergeableCString()) {
577 Constant *C = cast<GlobalVariable>(GV)->getInitializer();
578 const Type *Ty = cast<ArrayType>(C->getType())->getElementType();
579 const TargetData &TD = *TM.getTargetData();
580 unsigned Size = TD.getTypeAllocSize(Ty);
582 unsigned Align = TD.getPreferredAlignment(cast<GlobalVariable>(GV));
584 return CStringSection;
587 return ReadOnlySection;
590 if (Kind.isMergeableConst()) {
591 if (Kind.isMergeableConst4())
592 return FourByteConstantSection;
593 if (Kind.isMergeableConst8())
594 return EightByteConstantSection;
595 if (Kind.isMergeableConst16() && SixteenByteConstantSection)
596 return SixteenByteConstantSection;
597 return ReadOnlySection; // .const
600 // FIXME: ROData -> const in -static mode that is relocatable but they happen
601 // by the static linker. Why not mergeable?
602 if (Kind.isReadOnly())
603 return ReadOnlySection;
605 // If this is marked const, put it into a const section. But if the dynamic
606 // linker needs to write to it, put it in the data segment.
607 if (Kind.isReadOnlyWithRel())
608 return ConstDataSection;
610 // Otherwise, just drop the variable in the normal data section.
615 TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind) const {
616 // If this constant requires a relocation, we have to put it in the data
617 // segment, not in the text segment.
618 if (Kind.isDataRel())
619 return ConstDataSection;
621 if (Kind.isMergeableConst4())
622 return FourByteConstantSection;
623 if (Kind.isMergeableConst8())
624 return EightByteConstantSection;
625 if (Kind.isMergeableConst16() && SixteenByteConstantSection)
626 return SixteenByteConstantSection;
627 return ReadOnlySection; // .const
630 /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively decide
631 /// not to emit the UsedDirective for some symbols in llvm.used.
632 // FIXME: REMOVE this (rdar://7071300)
633 bool TargetLoweringObjectFileMachO::
634 shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const {
635 /// On Darwin, internally linked data beginning with "L" or "l" does not have
636 /// the directive emitted (this occurs in ObjC metadata).
637 if (!GV) return false;
639 // Check whether the mangled name has the "Private" or "LinkerPrivate" prefix.
640 if (GV->hasLocalLinkage() && !isa<Function>(GV)) {
641 // FIXME: ObjC metadata is currently emitted as internal symbols that have
642 // \1L and \0l prefixes on them. Fix them to be Private/LinkerPrivate and
643 // this horrible hack can go away.
644 const std::string &Name = Mang->getMangledName(GV);
645 if (Name[0] == 'L' || Name[0] == 'l')
653 //===----------------------------------------------------------------------===//
655 //===----------------------------------------------------------------------===//
657 void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx,
658 const TargetMachine &TM) {
659 TargetLoweringObjectFile::Initialize(Ctx, TM);
660 TextSection = getOrCreateSection("\t.text", true,
661 SectionKind::getText());
662 DataSection = getOrCreateSection("\t.data", true,
663 SectionKind::getDataRel());
665 getOrCreateSection(".ctors", false, SectionKind::getDataRel());
667 getOrCreateSection(".dtors", false, SectionKind::getDataRel());
670 void TargetLoweringObjectFileCOFF::
671 getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl<char> &Str) const {
672 // FIXME: Inefficient.
673 std::string Res = ",\"";
676 if (Kind.isWriteable())
680 Str.append(Res.begin(), Res.end());
683 static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) {
685 return ".text$linkonce";
686 if (Kind.isWriteable())
687 return ".data$linkonce";
688 return ".rdata$linkonce";
692 const MCSection *TargetLoweringObjectFileCOFF::
693 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
694 Mangler *Mang, const TargetMachine &TM) const {
695 assert(!Kind.isThreadLocal() && "Doesn't support TLS");
697 // If this global is linkonce/weak and the target handles this by emitting it
698 // into a 'uniqued' section name, create and return the section now.
699 if (GV->isWeakForLinker()) {
700 const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
701 std::string Name = Mang->makeNameProper(GV->getNameStr());
702 return getOrCreateSection((Prefix+Name).c_str(), false, Kind);
706 return getTextSection();
708 return getDataSection();