-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Immediates that need shifts are misassembled for ARM #23374
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
Comments
assigned to @rengolin |
Adjusting the example slightly to: Then assembling with clang and disassembling with llvm-dis I see $d.2: It's only the sub with an immediate that's a label difference that's been misassembled. |
Yes, that makes sense. Ive not had enough time to fully isolate the issue. The adjustment is being evaluated correctly. It seems that the issue comes in really late (near the the of the fragment layout phase). |
The core of the issue is that add and sub take a 12bit immediate with optional shifting, but we use a 16bit fix up when we can't evaluate the immediate. A new ARM-specific fix up is needed for this, |
Blocking Chromium meta, since this seems to be the last of the Chromium bugs with IAS. |
(It looks like the last needed for boringssl in chromium, but not the last for all of chromium I think) |
Oh, sorry. I stand corrected. :-) |
This seems fixed on trunk: ... AES_encrypt: $d: Saleem, did you fix this? I can't find the commit... This could also have been "accidentally" fixed by another commit... Peter was working around add/sub fixups and making some refactoring around it. |
No, I hadn't had a chance to work on it. I would assume that it was Peter's work. However, I think that we should at least check in some tests for the future. |
Good point. I can do that. |
Tests in r276858. |
This isn't fixed for boringssl in a chromium bug (which is probably the same source that the openssl bit is reduced from). Maybe it's due to thumb:
|
(that was a somewhat reduced repro, not the original file, of course) |
Hi Nico, Thanks for the new snippet, I can now reproduce it on ARM and Thumb. The old snippet still doesn't fail, so I'll abandon that investigation and look at the new reduced case. cheers, |
This is still an issue, even though the diagnostic changed slightly. With the same repro as above:
|
The new message is due to a change by Oliver to clean up the asm messages. It shouldn't change the initial bug. |
I think that I managed to fix this as part of pr28647 Support of thumb2's modified immediate assembly syntax is incomplete (committed Mon Jun 5 2017) With trunk llvm-mc or clang I can assemble the latest reproducer without error and produce a file that disassembles to: 00000000 <_bsaes_decrypt8>: 00000040 <_bsaes_const>: Can you take another look to see if there is still a problem? If not we should be able to resolve this pr. |
Marking this as resolved, since it was fixed months ago. |
Extended Description
Try to assemble:
AES_Te:
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
.word 1,2,3,4,5,6
AES_encrypt:
sub r10,r3,#(AES_encrypt-AES_Te) @ Te
and disassemble. The immediate for the sub is misencoded. This is observed in the OpenSSL assembly.
The text was updated successfully, but these errors were encountered: