[llvm-bugs] [Bug 43382] New: [ARMv7] ldrb.w syntax issue
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 20 07:55:47 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43382
Bug ID: 43382
Summary: [ARMv7] ldrb.w syntax issue
Product: clang
Version: 9.0
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Tooling
Assignee: unassignedclangbugs at nondot.org
Reporter: eblot.ml at gmail.com
CC: llvm-bugs at lists.llvm.org
[foreword: I did not find the proper component for clang's integrated-as
component. I picked up "C" which is likely not the right sub-component, please
reassign to the proper component]
Using clang/llvm 9.0.0 final with an ARMv7-M (ELF) target, the following syntax
is not accepted by clang assembler:
ldrb.w r2, [r3], #1
Full example:
.text
.arch armv7
.thumb
.thumb_func
.align 1
.syntax unified
mov r3, r0
1: ldrb.w r2, [r3], #1
cmp r2, #0
bne 1b
subs r0, r3, r0
subs r0, #1
bx lr
Using "clang -target armv7em-none-eabi -mcpu=cortex-m4 -mfloat-abi=hard
-mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs -c strlen.S":
strlen.S:7:21: error: too many operands for instruction
1: ldrb.w r2, [r3], #1
>From ARMĀ®v7-M Architecture Reference Manual [ARM DDI 0403E.b], Section A7.7.45
LDRB (immediate), Encoding T2 ARMv7-M,
LDRB<c>.W <Rt>,[<Rn>{,#<imm12>}]
seems to be a valid syntax for the selected architecture.
If the opcode is changed to
ldrb r2, [r3], #1
clang does not complain anymore, and generate the .o output file
Now reading back this generated object file with llvm's objdump:
$ arm-none-eabi-objdump -S strlen.o
strlen.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <.text>:
0: 4603 mov r3, r0
2: f813 2b01 ldrb.w r2, [r3], #1
6: 2a00 cmp r2, #0
8: d1fb bne.n 2 <.text+0x2>
a: 1a18 subs r0, r3, r0
c: 3801 subs r0, #1
e: 4770 bx lr
objdump decodes the ldrb instruction as ldrb.w, which is the syntax clang
rejects.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190920/9a908270/attachment.html>
More information about the llvm-bugs
mailing list