[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 --- Comment #8 from Nick Clifton nickc at redhat dot com 2011-07-20 09:49:38 UTC --- Created attachment 5852 -- http://sourceware.org/bugzilla/attachment.cgi?id=5852 Improved patch -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 --- Comment #9 from Nick Clifton nickc at redhat dot com 2011-07-20 09:50:22 UTC --- Created attachment 5853 -- http://sourceware.org/bugzilla/attachment.cgi?id=5853 Example of uncaught bad branch -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 Nick Clifton nickc at redhat dot com changed: What|Removed |Added Status|REOPENED|WAITING --- Comment #10 from Nick Clifton nickc at redhat dot com 2011-07-20 09:56:40 UTC --- Hi Dave, Thanks for the extended test case and revised patch. Unfortunately there are a couple of problems with this new patch which I hope you won't mind taking a look at: 1. The assembler can still miss a badly aligned BLX instruction. For example try assembling the uploaded fred.s file and then disassembling the result. You should see this: [...] 206: f400 f800 bl 1ca f-0x36 20a: f3ff bl 24c g+0x30 20e: f400 e801; UNDEFINED instruction: 0xf400e801 212: f000 e000 blx 2400014 g+0x38 [...] 2. The patch will reported mis-aligned branches as being out of range. 3. For some reason, with some of the out of range branches we also get an error message about trying to stuff a large value into a small bitfield. Ideally there should only be one error message per problem in the assembler source file. 4. There ought to be a proper set of test cases in the assembler testsuite to check this sort of thing. I have uploaded a revised version of your patch which is my attempt to address points 2 and 4. But points 1 and 3 still need investigating. Would you mind doing the honours ? Cheers Nick -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 Dave Martin dave.martin at linaro dot org changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #5 from Dave Martin dave.martin at linaro dot org 2011-07-04 15:54:35 UTC --- (In reply to comment #4) Hi Dave, I have checked in a patch which should address this problem. Please let me know if I have missed any of the checks though. Cheers Nick Some things are now fixed, but forward 32-bit conditional branches with ranges from . + 4 + 0x10 to . + 4 + 0x1e are still not handled correctly. Reverse branches with ranges of the same magnitude are correctly rejected though. It also occurred to me to check bl and blx instructions, since these have an encoding closely related to the 32-bit unconditional branch, and the same range. It turns out that these are wongly range-checked in the same way that the 32-bit unconditional branches were previously wrongly checked. I'll attach my extended testcase. I also have a patch which attempts to tidy up the branch range fixups, and reduce the amount of magic numbers floating around the code. I'm not sure whether it's appropriate/necessary to check alignment at the same time as checking the range, and it's possible that the macros I've added duplicate functionality already implemented somewhere else... Finally, should we get rid of all the variant branch-out-of-range messages? I think that BAD_RANGE is actually adequately descriptive for all these cases. Cheers ---Dave -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 --- Comment #6 from Dave Martin dave.martin at linaro dot org 2011-07-04 15:56:08 UTC --- Created attachment 5831 -- http://sourceware.org/bugzilla/attachment.cgi?id=5831 Extended testcase -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 --- Comment #7 from Dave Martin dave.martin at linaro dot org 2011-07-04 15:58:14 UTC --- Created attachment 5832 -- http://sourceware.org/bugzilla/attachment.cgi?id=5832 Patch which attempts to tidy up branch range checks, and fix the outstanding failures -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 --- Comment #2 from cvs-commit at gcc dot gnu.org cvs-commit at gcc dot gnu.org 2011-06-30 12:53:01 UTC --- CVSROOT:/cvs/src Module name:src Changes by:ni...@sourceware.org2011-06-30 12:52:58 Modified files: gas: ChangeLog gas/config : tc-arm.c Log message: PR gas/12848 * config/tc-arm.c (BAD_RANGE): New error message define. (md_apply_fix): Use it. Fix range check for thumb branch instructions. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=srcr1=1.4534r2=1.4535 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=srcr1=1.496r2=1.497 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 Nick Clifton nickc at redhat dot com changed: What|Removed |Added Status|NEW |RESOLVED CC||nickc at redhat dot com Resolution||FIXED --- Comment #4 from Nick Clifton nickc at redhat dot com 2011-06-30 13:09:58 UTC --- Hi Dave, I have checked in a patch which should address this problem. Please let me know if I have missed any of the checks though. Cheers Nick -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 --- Comment #1 from Dave Martin dave.martin at linaro dot org 2011-06-08 14:14:07 UTC --- On Mon, Jun 6, 2011 at 12:18 PM, dave.martin at linaro dot org sourceware-bugzi...@sourceware.org wrote: http://sourceware.org/bugzilla/show_bug.cgi?id=12848 Summary: ARM: Thumb-2: Range check on b.w is off by a factor of 2 Product: binutils Version: 2.22 (HEAD) Status: NEW Severity: normal Priority: P2 Component: gas AssignedTo: unassig...@sources.redhat.com ReportedBy: dave.mar...@linaro.org The 32-bit Thumb long branch encoding has a range of +/-16MiB, but gas checks +/-32MiB instead (which is, perhaps coincidentally, the range of the B instruction in ARM state). Having played with this a bit more, it appears that all the 32-bit Thumb branch encodings are affected. In each case, the range checked for is double what it should be: b.w, bl and blx seem to be range-checked as +/- 32 MiB (should be +/- 16 MiB) bcc.w seems to be range-checked as +/- 2 MiB (should be +/- 1 MiB) -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug gas/12848] ARM: Thumb-2: Range check on b.w is off by a factor of 2
http://sourceware.org/bugzilla/show_bug.cgi?id=12848 Dave Martin dave.martin at linaro dot org changed: What|Removed |Added CC||mgretton at sourceware dot ||org -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils