[llvm] [MC] getSymbolOffsetImpl - only use report_fatal_error if ReportError is true, else just return false (PR #96493)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 00:11:43 PDT 2024


MaskRay wrote:

I think this `report_fatal_error` use should be considered as `llvm_unreachable`. The code path is reachable for Mach-O due to its assembler weakness that should be fixed.
We should not make the error/unreachable more difficult to expose.

Only one test file exposes the diagnostic: `llvm/test/MC/MachO/variable-errors.s`.
When `evaluateFixup` is called for Mach-O, due to the hack around llvm/lib/MC/MCExpr.cpp:882, a `MCValue::get(SRE, nullptr, 0);` is returned, which eventually cause the crash in `getLabelOffset`.
We should fix Mach-O so that the crash is really unreachable.


https://github.com/llvm/llvm-project/pull/96493


More information about the llvm-commits mailing list