diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/MC/MachObjectWriter.cpp | |
parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) |
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/MachObjectWriter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index 038433cb24fa..446d1372fa66 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -129,7 +129,7 @@ uint64_t MachObjectWriter::getPaddingSize(const MCSection *Sec, const MCSection &NextSec = *Layout.getSectionOrder()[Next]; if (NextSec.isVirtualSection()) return 0; - return offsetToAlignment(EndAddr, Align(NextSec.getAlignment())); + return offsetToAlignment(EndAddr, NextSec.getAlign()); } void MachObjectWriter::writeHeader(MachO::HeaderFileType Type, @@ -244,8 +244,7 @@ void MachObjectWriter::writeSection(const MCAsmLayout &Layout, } W.write<uint32_t>(FileOffset); - assert(isPowerOf2_32(Section.getAlignment()) && "Invalid alignment!"); - W.write<uint32_t>(Log2_32(Section.getAlignment())); + W.write<uint32_t>(Log2(Section.getAlign())); W.write<uint32_t>(NumRelocations ? RelocationsStart : 0); W.write<uint32_t>(NumRelocations); W.write<uint32_t>(Flags); @@ -645,7 +644,7 @@ void MachObjectWriter::computeSectionAddresses(const MCAssembler &Asm, const MCAsmLayout &Layout) { uint64_t StartAddress = 0; for (const MCSection *Sec : Layout.getSectionOrder()) { - StartAddress = alignTo(StartAddress, Sec->getAlignment()); + StartAddress = alignTo(StartAddress, Sec->getAlign()); SectionAddress[Sec] = StartAddress; StartAddress += Layout.getSectionAddressSize(Sec); @@ -758,6 +757,8 @@ void MachObjectWriter::populateAddrSigSection(MCAssembler &Asm) { Asm.getContext().getObjectFileInfo()->getAddrSigSection(); unsigned Log2Size = is64Bit() ? 3 : 2; for (const MCSymbol *S : getAddrsigSyms()) { + if (!S->isRegistered()) + continue; MachO::any_relocation_info MRE; MRE.r_word0 = 0; MRE.r_word1 = (Log2Size << 25) | (MachO::GENERIC_RELOC_VANILLA << 28); |