[MC] Fix an assert in MCAssembler::writeSectionData to be aware of errors
authorFangrui Song <i@maskray.me>
Fri, 30 Oct 2020 06:09:57 +0000 (23:09 -0700)
committerFangrui Song <i@maskray.me>
Fri, 30 Oct 2020 06:11:18 +0000 (23:11 -0700)
commit35be65cb1ceeb1f509ee4696871ddb86a8d16d8f
tree113811e9ad481ed926031712e49606353240a16e
parent61f11f807cfc359b38b9e22d005456f924464c30
[MC] Fix an assert in MCAssembler::writeSectionData to be aware of errors

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"
llvm/lib/MC/MCAssembler.cpp