-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/asm: wrong error message when assembling incorrect program #12470
Comments
There are two problems here, first, the operand is encoded incorrectly, which makes The second problem is that the printing of the Addr is wrong as well. |
And cmd/asm seems to abort after the first call to I'm also hit by this problem (I added another call to ctxt.Diag |
This one is tricky. I was thrown by the R520, but that's being parsed as a symbol, so in amd64 terms, the error is caused by The issue is that this is a syntax error, but is not caught as one because the operand parser has no context, and it is illegal to have a bare symbol like that except as a jump label. I made a tiny change to catch that case, and it failed on arm64 because of this obscure syntax: CSINV CS, R1, R2, R3 here the CS is a magic word, not a register, that is parsing as TYPE_MEM. It really shouldn't be. We should fix that somehow or special-case it more precisely in the assembler - it works only by accident. If that's fixed, the fix can be made so that xxx is allowed only as a label and you get this nice error: x.s:2: illegal addressing mode for symbol xxx |
This has been fixed by other changes. x.s:2: unrecognized instruction "ADD" |
I'm sorry, but this is not fixed, in fact, for many instruction the form is silently accepted creating hard to debug defects.
|
The problem is about the syntax P.S. Read the longer message from me above. |
I'll fix the arm64 problem. |
CL https://golang.org/cl/14680 mentions this issue. |
Add CS as an alias for HS, and CC as an alias for LO, otherwise CSINV CS, R1, R2, R3 was interpreted as CSINV 0, R1, R2, R3 Also fix the corresponding faulty test. Fixes #12632 Updates #12470 Change-Id: I974cfc7e5ced682d4754ba09b0b102cb08a46567 Reviewed-on: https://go-review.googlesource.com/14680 Reviewed-by: Rob Pike <r@golang.org>
CL https://golang.org/cl/14691 mentions this issue. |
The text was updated successfully, but these errors were encountered: