diff options
author | Fangrui Song <i@maskray.me> | 2024-03-06 23:19:59 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2024-03-06 23:19:59 -0800 |
commit | a3319371970b599ef65ef1567c440fbdc3a330f4 (patch) | |
tree | d63abccdc3bddef6511079dc71585ca5485fa789 /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | 886ecb3078e5f3a5cffc70408a637242c223c363 (diff) | |
download | llvm-a3319371970b599ef65ef1567c440fbdc3a330f4.zip llvm-a3319371970b599ef65ef1567c440fbdc3a330f4.tar.gz llvm-a3319371970b599ef65ef1567c440fbdc3a330f4.tar.bz2 |
[MC] Move CompressDebugSections/RelaxELFRelocations from TargetOptions/MCAsmInfo to MCTargetOptions
The convention is for such MC-specific options to reside in
MCTargetOptions. However, CompressDebugSections/RelaxELFRelocations do
not follow the convention: `CompressDebugSections` is defined in both
TargetOptions and MCAsmInfo and there is forwarding complexity.
Move the option to MCTargetOptions and hereby simplify the code. Rename
the misleading RelaxELFRelocations to X86RelaxRelocations. llvm-mc
-relax-relocations and llc -x86-relax-relocations can now be unified.
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 531d299..3c4d3ab 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -875,11 +875,10 @@ void ELFWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec, const MCAsmLayout &Layout) { MCSectionELF &Section = static_cast<MCSectionELF &>(Sec); StringRef SectionName = Section.getName(); - - auto &MC = Asm.getContext(); - const auto &MAI = MC.getAsmInfo(); - - const DebugCompressionType CompressionType = MAI->compressDebugSections(); + auto &Ctx = Asm.getContext(); + const DebugCompressionType CompressionType = + Ctx.getTargetOptions() ? Ctx.getTargetOptions()->CompressDebugSections + : DebugCompressionType::None; if (CompressionType == DebugCompressionType::None || !SectionName.starts_with(".debug_")) { Asm.writeSectionData(W.OS, &Section, Layout); |