If MCContext has an error, MCAssembler::layout may stop early
and some MCFragment's may not finalize.
In the Linux kernel, arch/x86/lib/memcpy_64.S could trigger the assert before
"x86_64: Change .weak to SYM_FUNC_START_WEAK for arch/x86/lib/mem*_64.S"
for (const MCFragment &F : *Sec)
writeFragment(OS, *this, Layout, F);
- assert(OS.tell() - Start == Layout.getSectionAddressSize(Sec));
+ assert(getContext().hadError() ||
+ OS.tell() - Start == Layout.getSectionAddressSize(Sec));
}
std::tuple<MCValue, uint64_t, bool>