diff options
author | Fangrui Song <i@maskray.me> | 2024-06-23 21:14:34 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2024-06-23 21:14:34 -0700 |
commit | fec1b6f9d3cf5347b67ffb2078c995eb496acf47 (patch) | |
tree | c0a47db0714e0b29b6bf8a2afb56f4b9bf6b0dc5 /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | ffec31566c0acc341a3953ffc9b015f702c138ec (diff) | |
download | llvm-fec1b6f9d3cf5347b67ffb2078c995eb496acf47.zip llvm-fec1b6f9d3cf5347b67ffb2078c995eb496acf47.tar.gz llvm-fec1b6f9d3cf5347b67ffb2078c995eb496acf47.tar.bz2 |
[MC] Move ELFWriter::createMemtagRelocs to AArch64TargetELFStreamer::finish
Follow-up to https://reviews.llvm.org/D128958
* Move target-specific code away from the generic ELFWriter.
* All sections should have been created before MCAssembler::layout.
* Remove one `registerSection` use, which should be considered private to MCAssembler.
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index b8ef265..5724c5c 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -193,8 +193,6 @@ public: MCSectionELF *createRelocationSection(MCContext &Ctx, const MCSectionELF &Sec); - void createMemtagRelocs(MCAssembler &Asm); - void writeSectionHeader(const MCAsmLayout &Layout, const SectionIndexMapTy &SectionIndexMap, const SectionOffsetsTy &SectionOffsets); @@ -616,23 +614,6 @@ bool ELFWriter::isInSymtab(const MCAsmLayout &Layout, const MCSymbolELF &Symbol, return true; } -void ELFWriter::createMemtagRelocs(MCAssembler &Asm) { - MCSectionELF *MemtagRelocs = nullptr; - for (const MCSymbol &Sym : Asm.symbols()) { - const auto &SymE = cast<MCSymbolELF>(Sym); - if (!SymE.isMemtag()) - continue; - if (MemtagRelocs == nullptr) { - MemtagRelocs = OWriter.TargetObjectWriter->getMemtagRelocsSection(Asm.getContext()); - if (MemtagRelocs == nullptr) - report_fatal_error("Tagged globals are not available on this architecture."); - Asm.registerSection(*MemtagRelocs); - } - ELFRelocationEntry Rec(0, &SymE, ELF::R_AARCH64_NONE, 0, nullptr, 0); - OWriter.Relocations[MemtagRelocs].push_back(Rec); - } -} - void ELFWriter::computeSymbolTable( MCAssembler &Asm, const MCAsmLayout &Layout, const SectionIndexMapTy &SectionIndexMap, const RevGroupMapTy &RevGroupMap, @@ -1094,8 +1075,6 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) { Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0); StringTableIndex = addToSectionTable(StrtabSection); - createMemtagRelocs(Asm); - RevGroupMapTy RevGroupMap; SectionIndexMapTy SectionIndexMap; |