Summary: | ARM: gas fails to set the proper alignment on code sections, causing broken output | ||
---|---|---|---|
Product: | binutils | Reporter: | Dave Martin <dave.martin> |
Component: | gas | Assignee: | unassigned |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | hp, mgretton, nickc |
Priority: | P2 | ||
Version: | 2.22 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | possible fix |
Description
Dave Martin
2011-06-24 19:29:40 UTC
For details of the Firefox/WebM bug, see: https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/789198 Created attachment 5824 [details]
possible fix
The attached patch hooks into mapping_state() to mark the alignment requirement on the current output section whenever we start emitting instructions.
It might be safer to make the alignment 4 for Thumb code as well as ARM code; the current patch gives Thumb code an alignment of 2 bytes, based on the principles that (a) this makes the current situation no worse, and (b) all realistic situations where a Thumb code section requires 4-byte alignment will involve an explicit .align or literal pool somewhere, so we don't need to worry.
CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2011-06-29 16:29:38 Modified files: gas : ChangeLog gas/config : tc-arm.c Log message: PR gas/12931 * config/tc-arm.c (mapping_state): When changing to ARM or THUMB state set the minimum required alignment of the section. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4527&r2=1.4528 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&r1=1.495&r2=1.496 Hi Dave, Thanks for reporting this problem and providing a patch to fix it too. I think that 2 byte alignment should be fine for thumb-code-containing sections, but if someone does come up with a scenario where this assumption does not work then we can always fix the assembler again. Cheers Nick On Wed, Jun 29, 2011 at 5:33 PM, nickc at redhat dot com <sourceware-bugzilla@sourceware.org> wrote: > http://sourceware.org/bugzilla/show_bug.cgi?id=12931 > > 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-29 16:33:44 UTC --- > Hi Dave, > > Thanks for reporting this problem and providing a patch to fix it too. I > think that 2 byte alignment should be fine for thumb-code-containing sections, > but if someone does come up with a scenario where this assumption does not work > then we can always fix the assembler again. That seems reasonable -- I think the proposed fix should be a useful interim step, since it's pretty simple and makes the situation no worse. Did the patch look sensible to you? I'm no gas hacker... Cheers ---Dave Hi Dave,
> Did the patch look sensible to you? I'm no gas hacker...
Are you sure ? ... The patch was fine. :-)
Cheers
Nick
CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2011-06-30 13:07:21 Modified files: gas/testsuite : ChangeLog gas/testsuite/gas/arm: blx-bad.d inst-po-be.d inst-po.d Log message: PR gas/12931 * gas/arm/blx-bad.d: Add exrta nop at end of disassembly. * gas/arm/inst-po-be.d: Add exrta nop at end of disassembly. * gas/arm/inst-po.d: Add exrta nop at end of disassembly. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1925&r2=1.1926 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/blx-bad.d.diff?cvsroot=src&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/inst-po-be.d.diff?cvsroot=src&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/inst-po.d.diff?cvsroot=src&r1=1.1&r2=1.2 Nick (being already CC:ed on the referred PR) or anyone else ARM-knowledgeable, pretty please have a quick look to see if the fix for this bug was the proper fix for PR sim/12737. Thanks. *** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla. |