[llvm-bugs] [Bug 34519] New: No easy way to assemble a .s file as thumb (no .arm or .thumb directives in file)
llvm-bugs at lists.llvm.org
Thu Sep 7 09:54:52 PDT 2017
Bug ID: 34519
Summary: No easy way to assemble a .s file as thumb (no .arm or
.thumb directives in file)
Component: Backend: ARM
Assignee: unassignedbugs at nondot.org
Reporter: peter.smith at linaro.org
CC: llvm-bugs at lists.llvm.org
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
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
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-bugs