From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- llvm/lib/MC/MachObjectWriter.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'llvm/lib/MC/MachObjectWriter.cpp') 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(FileOffset); - assert(isPowerOf2_32(Section.getAlignment()) && "Invalid alignment!"); - W.write(Log2_32(Section.getAlignment())); + W.write(Log2(Section.getAlign())); W.write(NumRelocations ? RelocationsStart : 0); W.write(NumRelocations); W.write(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); -- cgit v1.2.3