[llvm] [windows][x86][asm] fix nullptr deref in WinCOFFWriter::recordRelocation (PR #181459)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 15 17:35:22 PST 2026
meowette wrote:
Thank you for the reply!
Someone already pointed out that requiring `[]` here is arguably wrong (when I was discussing this on the rust discord) compared to what gas does, considering the only supported addressing for JCC on x86 is a relative offset, but since this was already accepted behavior on Linux I assumed it is intentional and that changing this would cause breakage. It seems that for labels llvm supports both `jcc label` and `jcc [label]`, but only allows `jcc [<rel offset>]` for relative offsets (which does not crash on Linux because of the unrelated nullptr check in `recordRelocation`?) and not `jcc <rel offset>` (correct according to GAS). GAS only supports `jcc label` and `jcc <rel offset>`.
So how I understand this, is that this is a bug in llvm's `X86AsmParser` that leads to accepting wrong syntax, creating fixups where there shouldn't be and that `jcc <rel>`/`jcc label` should be required (or at least supported if the intention is to avoid breakage?), while `jcc [<rel>]` (and `jcc [label]`?) should have failed both on Linux and Windows way before it got to `recordRelocation`. Do I understand this correctly? If so, should I make an issue about this since this PR is now closed?
https://github.com/llvm/llvm-project/pull/181459
More information about the llvm-commits
mailing list