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/internal/obj/arm: Wrongly Assembled ARM Branch Instructions #19419
Comments
Did you add them to the end of the file? Then 8(PC) will be out of range. Maybe try something like 0(PC)? |
The out of range warning is eliminated, but it seems wrong code is assembled. With I get error like
|
It seems B* instructions will be mis-assembled when jumping forward, but correct jumping backward. Here is my test case in cmd/src/asm/internal/asm/testdata/arm.s
jmp_label_0: I got All failures are related to forward jump in both "B off(PC)" and "B label" forms. |
But what's more strange, I find many forward jumps in src/runtime/vlop_arm.s, especially divu which is used widely as the division implementation of ARM. Where is wrong in my test or understand? |
It is my mistake, I am not familiar with the assembler's features. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?the newest master branch
What operating system and processor architecture are you using (
go env
)?ARM//Raspberry Pi 2/Debian
What did you do?
Add 2 test for BEQ in cmd/asm/internal/asm/testdata/arm.s
jmp_label:
BEQ jmp_label
BEQ 8(PC)
What did you expect to see?
The test pass when running src/all.bash
What did you see instead?
02024 (testdata/arm.s:749) BEQ
02024 (testdata/arm.s:749) BEQ
02024 (testdata/arm.s:749) BEQ
02024 (testdata/arm.s:749) BEQ
02024 (testdata/arm.s:749) BEQ
02024 (testdata/arm.s:749) BEQ
02024 (testdata/arm.s:749) BEQ
02024 (testdata/arm.s:749) BEQ
02024 (testdata/arm.s:749) BEQ
--- FAIL: TestARMEndToEnd (0.04s)
endtoend_test.go:363: GOARM=5
endtoend_test.go:149: mismatched output:
have 00498 (testdata/arm.s:748) BEQ
want 00498 (testdata/arm.s:748) BEQ jmp_label
endtoend_test.go:179: branch out of range (0x1fb)
00499 (testdata/arm.s:749) BEQ 507(PC) []
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
endtoend_test.go:363: GOARM=6
endtoend_test.go:149: mismatched output:
have 00498 (testdata/arm.s:748) BEQ
want 00498 (testdata/arm.s:748) BEQ jmp_label
endtoend_test.go:179: branch out of range (0x1fb)
00499 (testdata/arm.s:749) BEQ 507(PC) []
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
endtoend_test.go:363: GOARM=7
endtoend_test.go:149: mismatched output:
have 00498 (testdata/arm.s:748) BEQ
want 00498 (testdata/arm.s:748) BEQ jmp_label
endtoend_test.go:179: branch out of range (0x1fb)
00499 (testdata/arm.s:749) BEQ 507(PC) []
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
endtoend_test.go:179: illegal combination 02024 (testdata/arm.s:749) BEQ; NONE NONE NONE, 0 0
endtoend_test.go:179: from 0 0 to 0 0
FAIL
FAIL cmd/asm/internal/asm 0.233s
The text was updated successfully, but these errors were encountered: