<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 - No easy way to assemble a .s file as thumb (no .arm or .thumb directives in file)"
   href="https://bugs.llvm.org/show_bug.cgi?id=34519">34519</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>No easy way to assemble a .s file as thumb (no .arm or .thumb directives in file)
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

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

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>peter.smith@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The Unified Arm Assembler Language which is selected with the .syntax unified
directive is designed so that the majority of assembler files can be assembled
for both Arm and Thumb, with the choice made as a compilation option.

In the GNU toolchain the GNU assembler supports the same -mthumb option as gcc
to assemble the file as thumb. The llvm-mc tool can accept
-triple=thumb-...-... 

When it comes to the compiler drivers it is more complicated. The -mthumb
option when given to clang or gcc is not passed through to the assembler so
something like: gcc -c -mthumb file.s or clang -c -mthumb file.s will assemble
the file as Arm and not Thumb. With gcc we can pass the -mthumb flag to the
assembler with -Wa,-mthumb, but this is ignored with clang. Using thumb in the
target such as --target=thumb-...-... assembles the file as Arm as well.

In summary there isn't an easy way of assembling a file from the clang driver
as Thumb when Arm instructions are available, and there is no explicit .thumb
directive in the file.

I think that there should be a way from the clang driver to state a preference
to assemble for Thumb. Adding a .thumb directive isn't a good solution if the
intention is to assemble the file for both Arm and Thumb.

Possible clang options that could be used to select assembly for Thumb:
- If --target is thumb-...-... rather than arm-...-... (as with llvm-mc)
- If -mthumb is used
- If -Wa,-mthumb is used</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>