gas should, but doesn't, treat pc-relative stores of form "str <Rt>, <label>" as an error in Thumb-2
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro Binutils |
Fix Released
|
Low
|
Unassigned | ||
Linaro GCC |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Environment:
* Linaro/Ubuntu binutils-
* also Upstream CVS 20110211 (--build=x86_64 --host=x86_64 --target=
In my case, the resulting code fell over with alignment faults at runtime (I suspect the A8 implementation may do the store but doesn't align the PC as would happen for PC-relative loads).
ARMv7 specifies the generated instruction encoding to be UNDEFINED, so we certainly shouldn't generate it in assembly output.
In the following example, note how the first store (to label "d") on line 5 is erroneously allowed, but the explicit pc-relative store on line 6 is correctly rejected.
$ arm-elf-eabi-as -ahlms -o strpc.o strpc.s
strpc.s: Assembler messages:
strpc.s:6: Error: cannot use register index with PC-relative addressing – `str r0,[pc,4]'
ARM GAS strpc.s page 1
1 .syntax unified
2 .arch armv7-a
3
4 .thumb_func
5 ???? 4FF8000C f: str r0, d
6 str r0, [pc, 4]
7
8 ???? 00000000 .space 4
9 .align
10 ???? 00000000 d: .long 0
11
ARM GAS strpc.s page 2
DEFINED SYMBOLS
strpc.s:5 .text:000000000
strpc.s:10 .text:000000000
.text:000000000
strpc.s:5 .text:000000000
strpc.s:8 .text:000000000
strpc.s:9 .text:000000000
strpc.s:10 .text:000000000
strpc.s:11 .text:000000000
.data:000000000
.bss:0000000000
.ARM.attributes
NO UNDEFINED SYMBOLS
$ cat strpc.s
.syntax unified
.arch armv7-a
.thumb_func
f: str r0, d
str r0, [pc, 4]
.space 4
.align
d: .long 0
Changed in gcc-linaro: | |
status: | New → Invalid |
Changed in binutils-linaro: | |
status: | New → Triaged |
Changed in binutils-linaro: | |
importance: | Undecided → Low |
Changed in binutils-linaro: | |
status: | Triaged → Fix Committed |
Changed in binutils-linaro: | |
status: | Fix Committed → Fix Released |