llvm.org GIT mirror llvm / 9936b80
Compute the ELF SectionKind from the flags. Any code creating an MCSectionELF knows ELF and already provides the flags. SectionKind is an abstraction used by common code that uses a plain MCSection. Use the flags to compute the SectionKind. This removes a lot of guessing and boilerplate from the MCSectionELF construction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227476 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
21 changed file(s) with 201 addition(s) and 396 deletion(s). Raw diff Collapse all Expand all
270270 }
271271
272272 const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
273 unsigned Flags, SectionKind Kind);
273 unsigned Flags);
274274
275275 const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
276 unsigned Flags, SectionKind Kind,
277 unsigned EntrySize, StringRef Group);
276 unsigned Flags, unsigned EntrySize,
277 StringRef Group);
278278
279279 void renameELFSection(const MCSectionELF *Section, StringRef Name);
280280
9191 static bool classof(const MCSection *S) {
9292 return S->getVariant() == SV_ELF;
9393 }
94
95 // Return the entry size for sections with fixed-width data.
96 static unsigned DetermineEntrySize(SectionKind Kind);
97
9894 };
9995
10096 } // end namespace llvm
5151
5252 // Put this in a custom .note section.
5353 AP.OutStreamer.SwitchSection(
54 AP.getObjFileLowering().getContext().getELFSection(
55 ".note.gc", ELF::SHT_PROGBITS, 0, SectionKind::getDataRel()));
54 AP.getObjFileLowering().getContext().getELFSection(".note.gc",
55 ELF::SHT_PROGBITS, 0));
5656
5757 // For each function...
5858 for (GCModuleInfo::FuncInfoVec::iterator FI = Info.funcinfo_begin(),
7070 const MCSection *Sec = getContext().getELFSection(NameData,
7171 ELF::SHT_PROGBITS,
7272 Flags,
73 SectionKind::getDataRel(),
7473 0, Label->getName());
7574 unsigned Size = TM.getDataLayout()->getPointerSize();
7675 Streamer.SwitchSection(Sec);
218217 }
219218 return getContext().getELFSection(SectionName,
220219 getELFSectionType(SectionName, Kind), Flags,
221 Kind, /*EntrySize=*/0, Group);
220 /*EntrySize=*/0, Group);
222221 }
223222
224223 /// getSectionPrefixForGlobal - Return the section prefix name used by options
267266 Group = C->getName();
268267 }
269268
270 return getContext().getELFSection(Name.str(),
271 getELFSectionType(Name.str(), Kind),
272 Flags, Kind, 0, Group);
269 return getContext().getELFSection(
270 Name.str(), getELFSectionType(Name.str(), Kind), Flags, 0, Group);
273271 }
274272
275273 if (Kind.isText()) return TextSection;
282280 unsigned Align =
283281 TM.getDataLayout()->getPreferredAlignment(cast(GV));
284282
285 const char *SizeSpec = ".rodata.str1.";
283 unsigned EntrySize = 1;
286284 if (Kind.isMergeable2ByteCString())
287 SizeSpec = ".rodata.str2.";
285 EntrySize = 2;
288286 else if (Kind.isMergeable4ByteCString())
289 SizeSpec = ".rodata.str4.";
287 EntrySize = 4;
290288 else
291289 assert(Kind.isMergeable1ByteCString() && "unknown string width");
292290
293
291 std::string SizeSpec = ".rodata.str" + utostr(EntrySize) + ".";
294292 std::string Name = SizeSpec + utostr(Align);
295 return getContext().getELFSection(Name, ELF::SHT_PROGBITS,
296 ELF::SHF_ALLOC |
297 ELF::SHF_MERGE |
298 ELF::SHF_STRINGS,
299 Kind);
293 return getContext().getELFSection(
294 Name, ELF::SHT_PROGBITS,
295 ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::SHF_STRINGS, EntrySize, "");
300296 }
301297
302298 if (Kind.isMergeableConst()) {
356352 std::string Name;
357353 unsigned Type;
358354 unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE;
359 SectionKind Kind = SectionKind::getDataRel();
360355 StringRef COMDAT = KeySym ? KeySym->getName() : "";
361356
362357 if (KeySym)
388383 Type = ELF::SHT_PROGBITS;
389384 }
390385
391 return Ctx.getELFSection(Name, Type, Flags, Kind, 0, COMDAT);
386 return Ctx.getELFSection(Name, Type, Flags, 0, COMDAT);
392387 }
393388
394389 const MCSection *TargetLoweringObjectFileELF::getStaticCtorSection(
409404 if (!UseInitArray)
410405 return;
411406
412 StaticCtorSection =
413 getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY,
414 ELF::SHF_WRITE |
415 ELF::SHF_ALLOC,
416 SectionKind::getDataRel());
417 StaticDtorSection =
418 getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY,
419 ELF::SHF_WRITE |
420 ELF::SHF_ALLOC,
421 SectionKind::getDataRel());
407 StaticCtorSection = getContext().getELFSection(
408 ".init_array", ELF::SHT_INIT_ARRAY, ELF::SHF_WRITE | ELF::SHF_ALLOC);
409 StaticDtorSection = getContext().getELFSection(
410 ".fini_array", ELF::SHT_FINI_ARRAY, ELF::SHF_WRITE | ELF::SHF_ALLOC);
422411 }
423412
424413 //===----------------------------------------------------------------------===//
324324
325325 MCContext &Ctx = Asm.getContext();
326326 const MCSectionELF *SymtabShndxSection =
327 Ctx.getELFSection(".symtab_shndxr", ELF::SHT_SYMTAB_SHNDX, 0,
328 SectionKind::getReadOnly(), 4, "");
327 Ctx.getELFSection(".symtab_shndxr", ELF::SHT_SYMTAB_SHNDX, 0, 4, "");
329328 MCSectionData *SymtabShndxSD =
330329 &Asm.getOrCreateSectionData(*SymtabShndxSection);
331330 SymtabShndxSD->setAlignment(4);
11501149 const MCSectionELF *RelaSection =
11511150 Ctx.getELFSection(RelaSectionName, hasRelocationAddend() ?
11521151 ELF::SHT_RELA : ELF::SHT_REL, Flags,
1153 SectionKind::getReadOnly(),
11541152 EntrySize, Group);
11551153 RelMap[&Section] = RelaSection;
11561154 Asm.getOrCreateSectionData(*RelaSection);
14091407
14101408 // We construct .shstrtab, .symtab and .strtab in this order to match gnu as.
14111409 const MCSectionELF *ShstrtabSection =
1412 Ctx.getELFSection(".shstrtab", ELF::SHT_STRTAB, 0,
1413 SectionKind::getReadOnly());
1410 Ctx.getELFSection(".shstrtab", ELF::SHT_STRTAB, 0);
14141411 MCSectionData &ShstrtabSD = Asm.getOrCreateSectionData(*ShstrtabSection);
14151412 ShstrtabSD.setAlignment(1);
14161413
14171414 const MCSectionELF *SymtabSection =
14181415 Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0,
1419 SectionKind::getReadOnly(),
14201416 EntrySize, "");
14211417 MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection);
14221418 SymtabSD.setAlignment(is64Bit() ? 8 : 4);
14231419
14241420 const MCSectionELF *StrtabSection;
1425 StrtabSection = Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0,
1426 SectionKind::getReadOnly());
1421 StrtabSection = Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0);
14271422 MCSectionData &StrtabSD = Asm.getOrCreateSectionData(*StrtabSection);
14281423 StrtabSD.setAlignment(1);
14291424
15201515 case ELF::SHT_RELA: {
15211516 const MCSectionELF *SymtabSection;
15221517 const MCSectionELF *InfoSection;
1523 SymtabSection = Asm.getContext().getELFSection(".symtab", ELF::SHT_SYMTAB,
1524 0,
1525 SectionKind::getReadOnly());
1518 SymtabSection =
1519 Asm.getContext().getELFSection(".symtab", ELF::SHT_SYMTAB, 0);
15261520 sh_link = SectionIndexMap.lookup(SymtabSection);
15271521 assert(sh_link && ".symtab not found");
15281522
15331527 Section.getGroup() ? Section.getGroup()->getName() : "";
15341528
15351529 InfoSection = Asm.getContext().getELFSection(SectionName, ELF::SHT_PROGBITS,
1536 0, SectionKind::getReadOnly(),
1537 0, GroupName);
1530 0, 0, GroupName);
15381531 sh_info = SectionIndexMap.lookup(InfoSection);
15391532 break;
15401533 }
15781571 Section.getType() == ELF::SHT_ARM_EXIDX) {
15791572 StringRef SecName(Section.getSectionName());
15801573 if (SecName == ".ARM.exidx") {
1581 sh_link = SectionIndexMap.lookup(
1582 Asm.getContext().getELFSection(".text",
1583 ELF::SHT_PROGBITS,
1584 ELF::SHF_EXECINSTR | ELF::SHF_ALLOC,
1585 SectionKind::getText()));
1574 sh_link = SectionIndexMap.lookup(Asm.getContext().getELFSection(
1575 ".text", ELF::SHT_PROGBITS, ELF::SHF_EXECINSTR | ELF::SHF_ALLOC));
15861576 } else if (SecName.startswith(".ARM.exidx")) {
15871577 StringRef GroupName =
15881578 Section.getGroup() ? Section.getGroup()->getName() : "";
15891579 sh_link = SectionIndexMap.lookup(Asm.getContext().getELFSection(
15901580 SecName.substr(sizeof(".ARM.exidx") - 1), ELF::SHT_PROGBITS,
1591 ELF::SHF_EXECINSTR | ELF::SHF_ALLOC, SectionKind::getText(), 0,
1592 GroupName));
1581 ELF::SHF_EXECINSTR | ELF::SHF_ALLOC, 0, GroupName));
15931582 }
15941583 }
15951584
2121
2222 const MCSection *
2323 MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
24 return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS,
25 0, SectionKind::getMetadata());
24 return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS, 0);
2625 }
2726
2827 MCAsmInfoELF::MCAsmInfoELF() {
251251 Reserved2, Kind);
252252 }
253253
254 const MCSectionELF *MCContext::
255 getELFSection(StringRef Section, unsigned Type, unsigned Flags,
256 SectionKind Kind) {
257 return getELFSection(Section, Type, Flags, Kind, 0, "");
254 const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
255 unsigned Flags) {
256 return getELFSection(Section, Type, Flags, 0, "");
258257 }
259258
260259 void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) {
270269 const_cast(Section)->setSectionName(CachedName);
271270 }
272271
273 const MCSectionELF *MCContext::
274 getELFSection(StringRef Section, unsigned Type, unsigned Flags,
275 SectionKind Kind, unsigned EntrySize, StringRef Group) {
272 const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
273 unsigned Flags, unsigned EntrySize,
274 StringRef Group) {
276275 // Do the lookup, if we have a hit, return it.
277276 auto IterBool = ELFUniquingMap.insert(
278277 std::make_pair(SectionGroupPair(Section, Group), nullptr));
279278 auto &Entry = *IterBool.first;
280279 if (!IterBool.second) return Entry.second;
281280
282 // Possibly refine the entry size first.
283 if (!EntrySize) {
284 EntrySize = MCSectionELF::DetermineEntrySize(Kind);
285 }
286
287281 MCSymbol *GroupSym = nullptr;
288282 if (!Group.empty())
289283 GroupSym = GetOrCreateSymbol(Group);
290284
291285 StringRef CachedName = Entry.first.first;
286
287 SectionKind Kind;
288 if (Flags & ELF::SHF_EXECINSTR)
289 Kind = SectionKind::getText();
290 else
291 Kind = SectionKind::getReadOnly();
292
292293 MCSectionELF *Result = new (*this)
293294 MCSectionELF(CachedName, Type, Flags, Kind, EntrySize, GroupSym);
294295 Entry.second = Result;
258258 MCELF::SetType(SD, ELF::STT_OBJECT);
259259
260260 if (MCELF::GetBinding(SD) == ELF_STB_Local) {
261 const MCSection *Section = getAssembler().getContext().getELFSection(".bss",
262 ELF::SHT_NOBITS,
263 ELF::SHF_WRITE |
264 ELF::SHF_ALLOC,
265 SectionKind::getBSS());
261 const MCSection *Section = getAssembler().getContext().getELFSection(
262 ".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
266263
267264 AssignSection(Symbol, Section);
268265
317314
318315 void MCELFStreamer::EmitIdent(StringRef IdentString) {
319316 const MCSection *Comment = getAssembler().getContext().getELFSection(
320 ".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS,
321 SectionKind::getReadOnly(), 1, "");
317 ".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, "");
322318 PushSection();
323319 SwitchSection(Comment);
324320 if (!SeenIdent) {
415415
416416
417417 // ELF
418 BSSSection =
419 Ctx->getELFSection(".bss", ELF::SHT_NOBITS,
420 ELF::SHF_WRITE | ELF::SHF_ALLOC,
421 SectionKind::getBSS());
422
423 TextSection =
424 Ctx->getELFSection(".text", ELF::SHT_PROGBITS,
425 ELF::SHF_EXECINSTR |
426 ELF::SHF_ALLOC,
427 SectionKind::getText());
428
429 DataSection =
430 Ctx->getELFSection(".data", ELF::SHT_PROGBITS,
431 ELF::SHF_WRITE |ELF::SHF_ALLOC,
432 SectionKind::getDataRel());
418 BSSSection = Ctx->getELFSection(".bss", ELF::SHT_NOBITS,
419 ELF::SHF_WRITE | ELF::SHF_ALLOC);
420
421 TextSection = Ctx->getELFSection(".text", ELF::SHT_PROGBITS,
422 ELF::SHF_EXECINSTR | ELF::SHF_ALLOC);
423
424 DataSection = Ctx->getELFSection(".data", ELF::SHT_PROGBITS,
425 ELF::SHF_WRITE | ELF::SHF_ALLOC);
433426
434427 ReadOnlySection =
435 Ctx->getELFSection(".rodata", ELF::SHT_PROGBITS,
436 ELF::SHF_ALLOC,
437 SectionKind::getReadOnly());
428 Ctx->getELFSection(".rodata", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
438429
439430 TLSDataSection =
440 Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS,
441 ELF::SHF_ALLOC | ELF::SHF_TLS |
442 ELF::SHF_WRITE,
443 SectionKind::getThreadData());
444
445 TLSBSSSection =
446 Ctx->getELFSection(".tbss", ELF::SHT_NOBITS,
447 ELF::SHF_ALLOC | ELF::SHF_TLS |
448 ELF::SHF_WRITE,
449 SectionKind::getThreadBSS());
450
451 DataRelSection =
452 Ctx->getELFSection(".data.rel", ELF::SHT_PROGBITS,
453 ELF::SHF_ALLOC |ELF::SHF_WRITE,
454 SectionKind::getDataRel());
455
456 DataRelLocalSection =
457 Ctx->getELFSection(".data.rel.local", ELF::SHT_PROGBITS,
458 ELF::SHF_ALLOC |ELF::SHF_WRITE,
459 SectionKind::getDataRelLocal());
460
461 DataRelROSection =
462 Ctx->getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
463 ELF::SHF_ALLOC |ELF::SHF_WRITE,
464 SectionKind::getReadOnlyWithRel());
465
466 DataRelROLocalSection =
467 Ctx->getELFSection(".data.rel.ro.local", ELF::SHT_PROGBITS,
468 ELF::SHF_ALLOC |ELF::SHF_WRITE,
469 SectionKind::getReadOnlyWithRelLocal());
431 Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS,
432 ELF::SHF_ALLOC | ELF::SHF_TLS | ELF::SHF_WRITE);
433
434 TLSBSSSection = Ctx->getELFSection(
435 ".tbss", ELF::SHT_NOBITS, ELF::SHF_ALLOC | ELF::SHF_TLS | ELF::SHF_WRITE);
436
437 DataRelSection = Ctx->getELFSection(".data.rel", ELF::SHT_PROGBITS,
438 ELF::SHF_ALLOC | ELF::SHF_WRITE);
439
440 DataRelLocalSection = Ctx->getELFSection(".data.rel.local", ELF::SHT_PROGBITS,
441 ELF::SHF_ALLOC | ELF::SHF_WRITE);
442
443 DataRelROSection = Ctx->getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
444 ELF::SHF_ALLOC | ELF::SHF_WRITE);
445
446 DataRelROLocalSection = Ctx->getELFSection(
447 ".data.rel.ro.local", ELF::SHT_PROGBITS, ELF::SHF_ALLOC | ELF::SHF_WRITE);
470448
471449 MergeableConst4Section =
472 Ctx->getELFSection(".rodata.cst4", ELF::SHT_PROGBITS,
473 ELF::SHF_ALLOC |ELF::SHF_MERGE,
474 SectionKind::getMergeableConst4());
450 Ctx->getELFSection(".rodata.cst4", ELF::SHT_PROGBITS,
451 ELF::SHF_ALLOC | ELF::SHF_MERGE, 4, "");
475452
476453 MergeableConst8Section =
477 Ctx->getELFSection(".rodata.cst8", ELF::SHT_PROGBITS,
478 ELF::SHF_ALLOC |ELF::SHF_MERGE,
479 SectionKind::getMergeableConst8());
454 Ctx->getELFSection(".rodata.cst8", ELF::SHT_PROGBITS,
455 ELF::SHF_ALLOC | ELF::SHF_MERGE, 8, "");
480456
481457 MergeableConst16Section =
482 Ctx->getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
483 ELF::SHF_ALLOC |ELF::SHF_MERGE,
484 SectionKind::getMergeableConst16());
485
486 StaticCtorSection =
487 Ctx->getELFSection(".ctors", ELF::SHT_PROGBITS,
488 ELF::SHF_ALLOC |ELF::SHF_WRITE,
489 SectionKind::getDataRel());
490
491 StaticDtorSection =
492 Ctx->getELFSection(".dtors", ELF::SHT_PROGBITS,
493 ELF::SHF_ALLOC |ELF::SHF_WRITE,
494 SectionKind::getDataRel());
458 Ctx->getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
459 ELF::SHF_ALLOC | ELF::SHF_MERGE, 16, "");
460
461 StaticCtorSection = Ctx->getELFSection(".ctors", ELF::SHT_PROGBITS,
462 ELF::SHF_ALLOC | ELF::SHF_WRITE);
463
464 StaticDtorSection = Ctx->getELFSection(".dtors", ELF::SHT_PROGBITS,
465 ELF::SHF_ALLOC | ELF::SHF_WRITE);
495466
496467 // Exception Handling Sections.
497468
499470 // it contains relocatable pointers. In PIC mode, this is probably a big
500471 // runtime hit for C++ apps. Either the contents of the LSDA need to be
501472 // adjusted or this should be a data section.
502 LSDASection =
503 Ctx->getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
504 ELF::SHF_ALLOC,
505 SectionKind::getReadOnly());
473 LSDASection = Ctx->getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
474 ELF::SHF_ALLOC);
506475
507476 COFFDebugSymbolsSection = nullptr;
508477
509478 // Debug Info Sections.
510479 DwarfAbbrevSection =
511 Ctx->getELFSection(".debug_abbrev", ELF::SHT_PROGBITS, 0,
512 SectionKind::getMetadata());
513 DwarfInfoSection =
514 Ctx->getELFSection(".debug_info", ELF::SHT_PROGBITS, 0,
515 SectionKind::getMetadata());
516 DwarfLineSection =
517 Ctx->getELFSection(".debug_line", ELF::SHT_PROGBITS, 0,
518 SectionKind::getMetadata());
519 DwarfFrameSection =
520 Ctx->getELFSection(".debug_frame", ELF::SHT_PROGBITS, 0,
521 SectionKind::getMetadata());
480 Ctx->getELFSection(".debug_abbrev", ELF::SHT_PROGBITS, 0);
481 DwarfInfoSection = Ctx->getELFSection(".debug_info", ELF::SHT_PROGBITS, 0);
482 DwarfLineSection = Ctx->getELFSection(".debug_line", ELF::SHT_PROGBITS, 0);
483 DwarfFrameSection = Ctx->getELFSection(".debug_frame", ELF::SHT_PROGBITS, 0);
522484 DwarfPubNamesSection =
523 Ctx->getELFSection(".debug_pubnames", ELF::SHT_PROGBITS, 0,
524 SectionKind::getMetadata());
485 Ctx->getELFSection(".debug_pubnames", ELF::SHT_PROGBITS, 0);
525486 DwarfPubTypesSection =
526 Ctx->getELFSection(".debug_pubtypes", ELF::SHT_PROGBITS, 0,
527 SectionKind::getMetadata());
487 Ctx->getELFSection(".debug_pubtypes", ELF::SHT_PROGBITS, 0);
528488 DwarfGnuPubNamesSection =
529 Ctx->getELFSection(".debug_gnu_pubnames", ELF::SHT_PROGBITS, 0,
530 SectionKind::getMetadata());
489 Ctx->getELFSection(".debug_gnu_pubnames", ELF::SHT_PROGBITS, 0);
531490 DwarfGnuPubTypesSection =
532 Ctx->getELFSection(".debug_gnu_pubtypes", ELF::SHT_PROGBITS, 0,
533 SectionKind::getMetadata());
491 Ctx->getELFSection(".debug_gnu_pubtypes", ELF::SHT_PROGBITS, 0);
534492 DwarfStrSection =
535 Ctx->getELFSection(".debug_str", ELF::SHT_PROGBITS,
536 ELF::SHF_MERGE | ELF::SHF_STRINGS,
537 SectionKind::getMergeable1ByteCString());
538 DwarfLocSection =
539 Ctx->getELFSection(".debug_loc", ELF::SHT_PROGBITS, 0,
540 SectionKind::getMetadata());
493 Ctx->getELFSection(".debug_str", ELF::SHT_PROGBITS,
494 ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, "");
495 DwarfLocSection = Ctx->getELFSection(".debug_loc", ELF::SHT_PROGBITS, 0);
541496 DwarfARangesSection =
542 Ctx->getELFSection(".debug_aranges", ELF::SHT_PROGBITS, 0,
543 SectionKind::getMetadata());
497 Ctx->getELFSection(".debug_aranges", ELF::SHT_PROGBITS, 0);
544498 DwarfRangesSection =
545 Ctx->getELFSection(".debug_ranges", ELF::SHT_PROGBITS, 0,
546 SectionKind::getMetadata());
499 Ctx->getELFSection(".debug_ranges", ELF::SHT_PROGBITS, 0);
547500 DwarfMacroInfoSection =
548 Ctx->getELFSection(".debug_macinfo", ELF::SHT_PROGBITS, 0,
549 SectionKind::getMetadata());
501 Ctx->getELFSection(".debug_macinfo", ELF::SHT_PROGBITS, 0);
550502
551503 // DWARF5 Experimental Debug Info
552504
553505 // Accelerator Tables
554506 DwarfAccelNamesSection =
555 Ctx->getELFSection(".apple_names", ELF::SHT_PROGBITS, 0,
556 SectionKind::getMetadata());
507 Ctx->getELFSection(".apple_names", ELF::SHT_PROGBITS, 0);
557508 DwarfAccelObjCSection =
558 Ctx->getELFSection(".apple_objc", ELF::SHT_PROGBITS, 0,
559 SectionKind::getMetadata());
509 Ctx->getELFSection(".apple_objc", ELF::SHT_PROGBITS, 0);
560510 DwarfAccelNamespaceSection =
561 Ctx->getELFSection(".apple_namespaces", ELF::SHT_PROGBITS, 0,
562 SectionKind::getMetadata());
511 Ctx->getELFSection(".apple_namespaces", ELF::SHT_PROGBITS, 0);
563512 DwarfAccelTypesSection =
564 Ctx->getELFSection(".apple_types", ELF::SHT_PROGBITS, 0,
565 SectionKind::getMetadata());
513 Ctx->getELFSection(".apple_types", ELF::SHT_PROGBITS, 0);
566514
567515 // Fission Sections
568516 DwarfInfoDWOSection =
569 Ctx->getELFSection(".debug_info.dwo", ELF::SHT_PROGBITS, 0,
570 SectionKind::getMetadata());
517 Ctx->getELFSection(".debug_info.dwo", ELF::SHT_PROGBITS, 0);
571518 DwarfTypesDWOSection =
572 Ctx->getELFSection(".debug_types.dwo", ELF::SHT_PROGBITS, 0,
573 SectionKind::getMetadata());
519 Ctx->getELFSection(".debug_types.dwo", ELF::SHT_PROGBITS, 0);
574520 DwarfAbbrevDWOSection =
575 Ctx->getELFSection(".debug_abbrev.dwo", ELF::SHT_PROGBITS, 0,
576 SectionKind::getMetadata());
521 Ctx->getELFSection(".debug_abbrev.dwo", ELF::SHT_PROGBITS, 0);
577522 DwarfStrDWOSection =
578 Ctx->getELFSection(".debug_str.dwo", ELF::SHT_PROGBITS,
579 ELF::SHF_MERGE | ELF::SHF_STRINGS,
580 SectionKind::getMergeable1ByteCString());
523 Ctx->getELFSection(".debug_str.dwo", ELF::SHT_PROGBITS,
524 ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, "");
581525 DwarfLineDWOSection =
582 Ctx->getELFSection(".debug_line.dwo", ELF::SHT_PROGBITS, 0,
583 SectionKind::getMetadata());
526 Ctx->getELFSection(".debug_line.dwo", ELF::SHT_PROGBITS, 0);
584527 DwarfLocDWOSection =
585 Ctx->getELFSection(".debug_loc.dwo", ELF::SHT_PROGBITS, 0,
586 SectionKind::getMetadata());
528 Ctx->getELFSection(".debug_loc.dwo", ELF::SHT_PROGBITS, 0);
587529 DwarfStrOffDWOSection =
588 Ctx->getELFSection(".debug_str_offsets.dwo", ELF::SHT_PROGBITS, 0,
589 SectionKind::getMetadata());
590 DwarfAddrSection =
591 Ctx->getELFSection(".debug_addr", ELF::SHT_PROGBITS, 0,
592 SectionKind::getMetadata());
530 Ctx->getELFSection(".debug_str_offsets.dwo", ELF::SHT_PROGBITS, 0);
531 DwarfAddrSection = Ctx->getELFSection(".debug_addr", ELF::SHT_PROGBITS, 0);
593532
594533 StackMapSection =
595 Ctx->getELFSection(".llvm_stackmaps", ELF::SHT_PROGBITS,
596 ELF::SHF_ALLOC,
597 SectionKind::getMetadata());
598
534 Ctx->getELFSection(".llvm_stackmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
599535 }
600536
601537
883819
884820 const MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
885821 return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
886 SectionKind::getMetadata(), 0, utostr(Hash));
822 0, utostr(Hash));
887823 }
888824
889825 void MCObjectFileInfo::InitEHFrameSection() {
897833 SectionKind::getReadOnly());
898834 else if (Env == IsELF)
899835 EHFrameSection =
900 Ctx->getELFSection(".eh_frame", EHSectionType,
901 EHSectionFlags,
902 SectionKind::getDataRel());
836 Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
903837 else
904838 EHFrameSection =
905839 Ctx->getCOFFSection(".eh_frame",
198198 return true;
199199 }
200200
201 getStreamer().SwitchSection(getContext().getELFSection(
202 Section, Type, Flags, Kind),
201 getStreamer().SwitchSection(getContext().getELFSection(Section, Type, Flags),
203202 Subsection);
204203
205204 return false;
266265 return true;
267266
268267 return false;
269 }
270
271 static SectionKind computeSectionKind(unsigned Flags, unsigned ElemSize) {
272 if (Flags & ELF::SHF_EXECINSTR)
273 return SectionKind::getText();
274 if (Flags & ELF::SHF_TLS)
275 return SectionKind::getThreadData();
276 if (Flags & ELF::SHF_MERGE) {
277 if (Flags & ELF::SHF_STRINGS) {
278 switch (ElemSize) {
279 default:
280 break;
281 case 1:
282 return SectionKind::getMergeable1ByteCString();
283 case 2:
284 return SectionKind::getMergeable2ByteCString();
285 case 4:
286 return SectionKind::getMergeable4ByteCString();
287 }
288 } else {
289 switch (ElemSize) {
290 default:
291 break;
292 case 4:
293 return SectionKind::getMergeableConst4();
294 case 8:
295 return SectionKind::getMergeableConst8();
296 case 16:
297 return SectionKind::getMergeableConst16();
298 }
299 }
300 }
301
302 return SectionKind::getDataRel();
303268 }
304269
305270 static unsigned parseSectionFlags(StringRef flagsStr, bool *UseLastGroup) {
543508 }
544509 }
545510
546 SectionKind Kind = computeSectionKind(Flags, Size);
547 const MCSection *ELFSection = getContext().getELFSection(
548 SectionName, Type, Flags, Kind, Size, GroupName);
511 const MCSection *ELFSection =
512 getContext().getELFSection(SectionName, Type, Flags, Size, GroupName);
549513 getStreamer().SwitchSection(ELFSection, Subsection);
550514
551515 if (getContext().getGenDwarfForAssembly()) {
696660
697661 Lex();
698662
699 const MCSection *Note =
700 getContext().getELFSection(".note", ELF::SHT_NOTE, 0,
701 SectionKind::getReadOnly());
663 const MCSection *Note = getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
702664
703665 getStreamer().PushSection();
704666 getStreamer().SwitchSection(Note);
156156 bool MCSectionELF::isVirtualSection() const {
157157 return getType() == ELF::SHT_NOBITS;
158158 }
159
160 unsigned MCSectionELF::DetermineEntrySize(SectionKind Kind) {
161 if (Kind.isMergeable1ByteCString()) return 1;
162 if (Kind.isMergeable2ByteCString()) return 2;
163 if (Kind.isMergeable4ByteCString()) return 4;
164 if (Kind.isMergeableConst4()) return 4;
165 if (Kind.isMergeableConst8()) return 8;
166 if (Kind.isMergeableConst16()) return 16;
167 return 0;
168 }
3535 }
3636
3737 AttributesSection =
38 getContext().getELFSection(".ARM.attributes",
39 ELF::SHT_ARM_ATTRIBUTES,
40 0,
41 SectionKind::getMetadata());
38 getContext().getELFSection(".ARM.attributes", ELF::SHT_ARM_ATTRIBUTES, 0);
4239 }
4340
4441 const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
957957 if (AttributeSection) {
958958 Streamer.SwitchSection(AttributeSection);
959959 } else {
960 AttributeSection =
961 Streamer.getContext().getELFSection(".ARM.attributes",
962 ELF::SHT_ARM_ATTRIBUTES,
963 0,
964 SectionKind::getMetadata());
960 AttributeSection = Streamer.getContext().getELFSection(
961 ".ARM.attributes", ELF::SHT_ARM_ATTRIBUTES, 0);
965962 Streamer.SwitchSection(AttributeSection);
966963
967964 // Format version
10681065 // Get .ARM.extab or .ARM.exidx section
10691066 const MCSectionELF *EHSection = nullptr;
10701067 if (const MCSymbol *Group = FnSection.getGroup()) {
1071 EHSection = getContext().getELFSection(
1072 EHSecName, Type, Flags | ELF::SHF_GROUP, Kind,
1073 FnSection.getEntrySize(), Group->getName());
1068 EHSection =
1069 getContext().getELFSection(EHSecName, Type, Flags | ELF::SHF_GROUP,
1070 FnSection.getEntrySize(), Group->getName());
10741071 } else {
1075 EHSection = getContext().getELFSection(EHSecName, Type, Flags, Kind);
1072 EHSection = getContext().getELFSection(EHSecName, Type, Flags);
10761073 }
10771074 assert(EHSection && "Failed to get the required EH section");
10781075
3232 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
3333 InitializeELF(TM.Options.UseInitArray);
3434
35 SmallDataSection =
36 getContext().getELFSection(".sdata", ELF::SHT_PROGBITS,
37 ELF::SHF_WRITE | ELF::SHF_ALLOC,
38 SectionKind::getDataRel());
39 SmallBSSSection =
40 getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
41 ELF::SHF_WRITE | ELF::SHF_ALLOC,
42 SectionKind::getBSS());
35 SmallDataSection = getContext().getELFSection(
36 ".sdata", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
37 SmallBSSSection = getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
38 ELF::SHF_WRITE | ELF::SHF_ALLOC);
4339 }
4440
4541 // sdata/sbss support taken largely from the MIPS Backend.
2929 // 1-byte long nor fixed length but it matches the value GAS emits.
3030 const MCSectionELF *Sec =
3131 Context.getELFSection(".MIPS.options", ELF::SHT_MIPS_OPTIONS,
32 ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP,
33 SectionKind::getMetadata(), 1, "");
32 ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1, "");
3433 MCA.getOrCreateSectionData(*Sec).setAlignment(8);
3534 Streamer->SwitchSection(Sec);
3635
4645 Streamer->EmitIntValue(ri_cprmask[3], 4);
4746 Streamer->EmitIntValue(ri_gp_value, 8);
4847 } else {
49 const MCSectionELF *Sec =
50 Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO, ELF::SHF_ALLOC,
51 SectionKind::getMetadata(), 24, "");
48 const MCSectionELF *Sec = Context.getELFSection(
49 ".reginfo", ELF::SHT_MIPS_REGINFO, ELF::SHF_ALLOC, 24, "");
5250 MCA.getOrCreateSectionData(*Sec)
5351 .setAlignment(MTS->getABI().IsN32() ? 8 : 4);
5452 Streamer->SwitchSection(Sec);
514514 MCContext &Context = MCA.getContext();
515515 MCStreamer &OS = getStreamer();
516516
517 const MCSectionELF *Sec = Context.getELFSection(".pdr", ELF::SHT_PROGBITS,
518 ELF::SHF_ALLOC | ELF::SHT_REL,
519 SectionKind::getMetadata());
517 const MCSectionELF *Sec = Context.getELFSection(
518 ".pdr", ELF::SHT_PROGBITS, ELF::SHF_ALLOC | ELF::SHT_REL);
520519
521520 const MCSymbolRefExpr *ExprRef =
522521 MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context);
730729 MCAssembler &MCA = getStreamer().getAssembler();
731730 MCContext &Context = MCA.getContext();
732731 MCStreamer &OS = getStreamer();
733 const MCSectionELF *Sec =
734 Context.getELFSection(".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS,
735 ELF::SHF_ALLOC, SectionKind::getMetadata(), 24, "");
732 const MCSectionELF *Sec = Context.getELFSection(
733 ".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24, "");
736734 MCSectionData &ABIShndxSD = MCA.getOrCreateSectionData(*Sec);
737735 ABIShndxSD.setAlignment(8);
738736 OS.SwitchSection(Sec);
703703
704704 // Tell the assembler which ABI we are using
705705 std::string SectionName = std::string(".mdebug.") + getCurrentABIString();
706 OutStreamer.SwitchSection(OutContext.getELFSection(
707 SectionName, ELF::SHT_PROGBITS, 0, SectionKind::getDataRel()));
706 OutStreamer.SwitchSection(
707 OutContext.getELFSection(SectionName, ELF::SHT_PROGBITS, 0));
708708
709709 // NaN: At the moment we only support:
710710 // 1. .nan legacy (default)
716716
717717 if (Subtarget->isABI_EABI()) {
718718 if (Subtarget->isGP32bit())
719 OutStreamer.SwitchSection(
720 OutContext.getELFSection(".gcc_compiled_long32", ELF::SHT_PROGBITS, 0,
721 SectionKind::getDataRel()));
719 OutStreamer.SwitchSection(OutContext.getELFSection(".gcc_compiled_long32",
720 ELF::SHT_PROGBITS, 0));
722721 else
723 OutStreamer.SwitchSection(
724 OutContext.getELFSection(".gcc_compiled_long64", ELF::SHT_PROGBITS, 0,
725 SectionKind::getDataRel()));
722 OutStreamer.SwitchSection(OutContext.getELFSection(".gcc_compiled_long64",
723 ELF::SHT_PROGBITS, 0));
726724 }
727725
728726 getTargetStreamer().updateABIInfo(*Subtarget);
944942 //
945943 const MCSectionELF *M = OutContext.getELFSection(
946944 ".mips16.call.fp." + std::string(Symbol), ELF::SHT_PROGBITS,
947 ELF::SHF_ALLOC | ELF::SHF_EXECINSTR, SectionKind::getText());
945 ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
948946 OutStreamer.SwitchSection(M, nullptr);
949947 //
950948 // .align 2
3838 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
3939 InitializeELF(TM.Options.UseInitArray);
4040
41 SmallDataSection =
42 getContext().getELFSection(".sdata", ELF::SHT_PROGBITS,
43 ELF::SHF_WRITE |ELF::SHF_ALLOC,
44 SectionKind::getDataRel());
41 SmallDataSection = getContext().getELFSection(
42 ".sdata", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
4543
46 SmallBSSSection =
47 getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
48 ELF::SHF_WRITE |ELF::SHF_ALLOC,
49 SectionKind::getBSS());
44 SmallBSSSection = getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
45 ELF::SHF_WRITE | ELF::SHF_ALLOC);
5046 this->TM = &TM;
5147 }
5248
952952 if (M.getPICLevel() == PICLevel::Small)
953953 return AsmPrinter::EmitStartOfAsmFile(M);
954954
955 OutStreamer.SwitchSection(OutContext.getELFSection(".got2",
956 ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC,
957 SectionKind::getReadOnly()));
955 OutStreamer.SwitchSection(OutContext.getELFSection(
956 ".got2", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC));
958957
959958 MCSymbol *TOCSym = OutContext.GetOrCreateSymbol(Twine(".LTOC"));
960959 MCSymbol *CurrentPos = OutContext.CreateTempSymbol();
10061005
10071006 // Emit an official procedure descriptor.
10081007 MCSectionSubPair Current = OutStreamer.getCurrentSection();
1009 const MCSectionELF *Section = OutStreamer.getContext().getELFSection(".opd",
1010 ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC,
1011 SectionKind::getReadOnly());
1008 const MCSectionELF *Section = OutStreamer.getContext().getELFSection(
1009 ".opd", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
10121010 OutStreamer.SwitchSection(Section);
10131011 OutStreamer.EmitLabel(CurrentFnSym);
10141012 OutStreamer.EmitValueToAlignment(8);
10461044 const MCSectionELF *Section;
10471045
10481046 if (isPPC64)
1049 Section = OutStreamer.getContext().getELFSection(".toc",
1050 ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC,
1051 SectionKind::getReadOnly());
1052 else
1053 Section = OutStreamer.getContext().getELFSection(".got2",
1054 ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC,
1055 SectionKind::getReadOnly());
1047 Section = OutStreamer.getContext().getELFSection(
1048 ".toc", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
1049 else
1050 Section = OutStreamer.getContext().getELFSection(
1051 ".got2", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
10561052 OutStreamer.SwitchSection(Section);
10571053
10581054 for (MapVector::iterator I = TOC.begin(),
109109 EmitFunctionHeader();
110110
111111 MCContext &Context = getObjFileLowering().getContext();
112 const MCSectionELF *ConfigSection = Context.getELFSection(".AMDGPU.config",
113 ELF::SHT_PROGBITS, 0,
114 SectionKind::getReadOnly());
112 const MCSectionELF *ConfigSection =
113 Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
115114 OutStreamer.SwitchSection(ConfigSection);
116115
117116 const AMDGPUSubtarget &STM = TM.getSubtarget();
135134 EmitFunctionBody();
136135
137136 if (isVerbose()) {
138 const MCSectionELF *CommentSection
139 = Context.getELFSection(".AMDGPU.csdata",
140 ELF::SHT_PROGBITS, 0,
141 SectionKind::getReadOnly());
137 const MCSectionELF *CommentSection =
138 Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
142139 OutStreamer.SwitchSection(CommentSection);
143140
144141 if (STM.getGeneration() >= AMDGPUSubtarget::SOUTHERN_ISLANDS) {
164161
165162 if (STM.dumpCode() && DisasmEnabled) {
166163
167 OutStreamer.SwitchSection(Context.getELFSection(".AMDGPU.disasm",
168 ELF::SHT_NOTE, 0,
169 SectionKind::getReadOnly()));
164 OutStreamer.SwitchSection(
165 Context.getELFSection(".AMDGPU.disasm", ELF::SHT_NOTE, 0));
170166
171167 for (size_t i = 0; i < DisasmLines.size(); ++i) {
172168 std::string Comment(DisasmLineMaxLen - DisasmLines[i].size(), ' ');
509505
510506 header.wavefront_size = STM.getWavefrontSize();
511507
512 const MCSectionELF *VersionSection = OutContext.getELFSection(".hsa.version",
513 ELF::SHT_PROGBITS, 0, SectionKind::getReadOnly());
508 const MCSectionELF *VersionSection =
509 OutContext.getELFSection(".hsa.version", ELF::SHT_PROGBITS, 0);
514510 OutStreamer.SwitchSection(VersionSection);
515511 OutStreamer.EmitBytes(Twine("HSA Code Unit:" +
516512 Twine(header.hsail_version_major) + "." +
2020 void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
2121 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
2222
23 BSSSection =
24 Ctx.getELFSection(".dp.bss", ELF::SHT_NOBITS,
25 ELF::SHF_ALLOC | ELF::SHF_WRITE |
26 ELF::XCORE_SHF_DP_SECTION,
27 SectionKind::getBSS());
28 BSSSectionLarge =
29 Ctx.getELFSection(".dp.bss.large", ELF::SHT_NOBITS,
30 ELF::SHF_ALLOC | ELF::SHF_WRITE |
31 ELF::XCORE_SHF_DP_SECTION,
32 SectionKind::getBSS());
33 DataSection =
34 Ctx.getELFSection(".dp.data", ELF::SHT_PROGBITS,
35 ELF::SHF_ALLOC | ELF::SHF_WRITE |
36 ELF::XCORE_SHF_DP_SECTION,
37 SectionKind::getDataRel());
38 DataSectionLarge =
39 Ctx.getELFSection(".dp.data.large", ELF::SHT_PROGBITS,
40 ELF::SHF_ALLOC | ELF::SHF_WRITE |
41 ELF::XCORE_SHF_DP_SECTION,
42 SectionKind::getDataRel());
43 DataRelROSection =
44 Ctx.getELFSection(".dp.rodata", ELF::SHT_PROGBITS,
45 ELF::SHF_ALLOC | ELF::SHF_WRITE |
46 ELF::XCORE_SHF_DP_SECTION,
47 SectionKind::getReadOnlyWithRel());
48 DataRelROSectionLarge =
49 Ctx.getELFSection(".dp.rodata.large", ELF::SHT_PROGBITS,
50 ELF::SHF_ALLOC | ELF::SHF_WRITE |
51 ELF::XCORE_SHF_DP_SECTION,
52 SectionKind::getReadOnlyWithRel());
23 BSSSection = Ctx.getELFSection(".dp.bss", ELF::SHT_NOBITS,
24 ELF::SHF_ALLOC | ELF::SHF_WRITE |
25 ELF::XCORE_SHF_DP_SECTION);
26 BSSSectionLarge = Ctx.getELFSection(".dp.bss.large", ELF::SHT_NOBITS,
27 ELF::SHF_ALLOC | ELF::SHF_WRITE |
28 ELF::XCORE_SHF_DP_SECTION);
29 DataSection = Ctx.getELFSection(".dp.data", ELF::SHT_PROGBITS,
30 ELF::SHF_ALLOC | ELF::SHF_WRITE |
31 ELF::XCORE_SHF_DP_SECTION);
32 DataSectionLarge = Ctx.getELFSection(".dp.data.large", ELF::SHT_PROGBITS,
33 ELF::SHF_ALLOC | ELF::SHF_WRITE |
34 ELF::XCORE_SHF_DP_SECTION);
35 DataRelROSection = Ctx.getELFSection(".dp.rodata", ELF::SHT_PROGBITS,
36 ELF::SHF_ALLOC | ELF::SHF_WRITE |
37 ELF::XCORE_SHF_DP_SECTION);
38 DataRelROSectionLarge = Ctx.getELFSection(
39 ".dp.rodata.large", ELF::SHT_PROGBITS,
40 ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::XCORE_SHF_DP_SECTION);
5341 ReadOnlySection =
54 Ctx.getELFSection(".cp.rodata", ELF::SHT_PROGBITS,
55 ELF::SHF_ALLOC |
56 ELF::XCORE_SHF_CP_SECTION,
57 SectionKind::getReadOnlyWithRel());
42 Ctx.getELFSection(".cp.rodata", ELF::SHT_PROGBITS,
43 ELF::SHF_ALLOC | ELF::XCORE_SHF_CP_SECTION);
5844 ReadOnlySectionLarge =
59 Ctx.getELFSection(".cp.rodata.large", ELF::SHT_PROGBITS,
60 ELF::SHF_ALLOC |
61 ELF::XCORE_SHF_CP_SECTION,
62 SectionKind::getReadOnlyWithRel());
63 MergeableConst4Section =
64 Ctx.getELFSection(".cp.rodata.cst4", ELF::SHT_PROGBITS,
65 ELF::SHF_ALLOC | ELF::SHF_MERGE |
66 ELF::XCORE_SHF_CP_SECTION,
67 SectionKind::getMergeableConst4());
68 MergeableConst8Section =
69 Ctx.getELFSection(".cp.rodata.cst8", ELF::SHT_PROGBITS,
70 ELF::SHF_ALLOC | ELF::SHF_MERGE |
71 ELF::XCORE_SHF_CP_SECTION,
72 SectionKind::getMergeableConst8());
73 MergeableConst16Section =
74 Ctx.getELFSection(".cp.rodata.cst16", ELF::SHT_PROGBITS,
75 ELF::SHF_ALLOC | ELF::SHF_MERGE |
76 ELF::XCORE_SHF_CP_SECTION,
77 SectionKind::getMergeableConst16());
45 Ctx.getELFSection(".cp.rodata.large", ELF::SHT_PROGBITS,
46 ELF::SHF_ALLOC | ELF::XCORE_SHF_CP_SECTION);
47 MergeableConst4Section = Ctx.getELFSection(
48 ".cp.rodata.cst4", ELF::SHT_PROGBITS,
49 ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::XCORE_SHF_CP_SECTION, 4, "");
50 MergeableConst8Section = Ctx.getELFSection(
51 ".cp.rodata.cst8", ELF::SHT_PROGBITS,
52 ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::XCORE_SHF_CP_SECTION, 8, "");
53 MergeableConst16Section = Ctx.getELFSection(
54 ".cp.rodata.cst16", ELF::SHT_PROGBITS,
55 ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::XCORE_SHF_CP_SECTION, 16, "");
7856 CStringSection =
79 Ctx.getELFSection(".cp.rodata.string", ELF::SHT_PROGBITS,
80 ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::SHF_STRINGS |
81 ELF::XCORE_SHF_CP_SECTION,
82 SectionKind::getReadOnlyWithRel());
57 Ctx.getELFSection(".cp.rodata.string", ELF::SHT_PROGBITS,
58 ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::SHF_STRINGS |
59 ELF::XCORE_SHF_CP_SECTION);
8360 // TextSection - see MObjectFileInfo.cpp
8461 // StaticCtorSection - see MObjectFileInfo.cpp
8562 // StaticDtorSection - see MObjectFileInfo.cpp
127104 if (IsCPRel && !Kind.isReadOnly())
128105 report_fatal_error("Using .cp. section for writeable object.");
129106 return getContext().getELFSection(SectionName, getXCoreSectionType(Kind),
130 getXCoreSectionFlags(Kind, IsCPRel), Kind);
107 getXCoreSectionFlags(Kind, IsCPRel));
131108 }
132109
133110 const MCSection *XCoreTargetObjectFile::