https://sourceware.org/bugzilla/show_bug.cgi?id=18314
Bug ID: 18314 Summary: On ARM, data gets confused for instructions after ".align" directive Product: binutils Version: 2.25 Status: NEW Severity: minor Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: solrabizna at gmail dot com Created attachment 8265 --> https://sourceware.org/bugzilla/attachment.cgi?id=8265&action=edit A simple test file, demonstrating some of the behavior detailed in the report. Compile with "as -EB" and disassemble to see the confusion at work. In my previous bug report, I noted that compiling with -EB and linking with --be8 lead to ".word" directives sometimes being swapped. I also asserted that this was correct behavior. I was wrong, on both counts. I'm now reasonably sure that ".word" directives are not supposed to be swapped. Not being swapped, in fact, is far more useful than the alternative. However, as already witnessed by my previous test, this behavior is not consistent. It turns out that something can get confused when ".align" directives are involved. I noticed that in situations where "ld --be8" (incorrectly) byte swaps data as if it were instructions, "objdump" (incorrectly) disassembles it as instructions. So subsequent testing involved only "as -EB" and "objdump -d". According to my tests, confusion ensues after a ".align" directive is encountered, but only if the location counter is not already aligned, and only if there has been at least one explicit instruction. When confusion occurs, it continues until the next explicit instruction. Labels, ".func" directives, and the character of the explicit instructions do not matter. I found that ".align", ".p2align", and ".balign" are interchangeable for purposes of this bug. I also found that confusion (seemingly) never occurs before the first explicit instruction is emitted, no matter how ".align" directives are used. I also found that confusion only results when the ".align" directive is not given a fill value (and therefore uses NOPs). I set the severity to "minor" because a trivial workaround exists: providing a fill value for every ".align" directive avoids all confusion. P.S. I must confess that I still do not fully understand the things that happen between my source code and the final linked executable that lead to everything being in the right byte order (most of the time). -- 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