<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [arm assembler]: Incorrect ARM alignment NOPs in mixed ARM and Thumb assembly"
   href="https://bugs.llvm.org/show_bug.cgi?id=48512">48512</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[arm assembler]: Incorrect ARM alignment NOPs in mixed ARM and Thumb assembly
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: ARM
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>husseydevin@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Seems to be related to <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - ARM integrated assembler generates incorrect nop opcode when switching from arm to thumb mode"
   href="show_bug.cgi?id=18019">bug 18019</a>.

In a mixed ARM and Thumb file, two Thumb NOPs will be emitted in a manual
alignment, even in ARM mode.

This rarely causes an issue in practice, as most uses of 8-byte alignment are
for constant pools which will be branched over anyways, but it is an issue
nonetheless.

    .syntax unified
    .text
    .globl arm
    .type arm, %function
    .p2align 3, 0 @ 8-byte align
arm:
    nop     @ normal nop, now we are not 8-byte aligned
    .p2align 3, 0 @ align again
    bx      lr

    .thumb @ we just need this directive in the file to trigger the bug, no
Thumb code is required


$ clang --target=arm-none-eabi -march=armv4t -c test.s -o test.o
$ arm-none-eabi-objdump -d test.o

test.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <arm>:
   0:   e1a00000        nop                     ; (mov r0, r0)
   4:   46c046c0        strbmi  r4, [r0], r0, asr #13
   8:   e12fff1e        bx      lr

While the manual nop is correct, the implicit alignment nop is two Thumb nops.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>