[LLVMdev] error: instruction requires: thumb2

Jim Grosbach grosbach at apple.com
Thu Aug 16 15:02:09 PDT 2012


Sure. Use legal ARM mode syntax for the instruction.

Specifically, there is no offset immediate for the ARM mode LDREX instruction. It's illegal syntax to supply one, even if it's zero.

-Jim

On Aug 16, 2012, at 2:36 PM, Lei Zhao <leizhao833 at gmail.com> wrote:

> It works. But a follow-up question: why do I have to compile it to thumb mode in order to pass the compilation? Is there a way to make it compile to regular arm mode? Thanks.
> 
> - Lei
> 
> On Aug 16, 2012, at 4:00 PM, Eli Friedman wrote:
> 
>> On Thu, Aug 16, 2012 at 12:55 PM, Lei Zhao <leizhao833 at gmail.com> wrote:
>>> Hi Everybody,
>>> 
>>> I recently did a cross-compiling using clang (built with host=x86, target=arm) with the following command:
>>> 
>>>> clang -march=armv7-a -mfloat-abi=soft -ccc-host-triple arm-none-linux-gnueabi -integrated-as main.c -o main.o -c
>>> 
>>> and get error message:
>>> 
>>> -------------------------------------------------------
>>> main.c:9:9: error: instruction requires: thumb2
>>>       "ldrex %[oldValue], [%[ptr], #0]\n" // oldValue = *ptr
>>>       ^
>>> <inline asm>:1:2: note: instantiated into assembly here
>>>       ldrex r6, [r4, #0]
>>>       ^
>>> main.c:11:3: error: instruction requires: thumb2
>>>       "strexeq %[failed], %[newValue], [%[ptr], #0]\n"
>>>        ^
>>> <inline asm>:3:1: note: instantiated into assembly here
>>> strexeq r5, lr, [r4, #0]
>>> ^
>>> 2 errors generated.
>>> -------------------------------------------------------
>>> 
>>> In the main.c, some ARM assembly are embedded which contains instructions ldrex, strexeq. I don't know what the message suggests since the cpu specified does support thumb2. Could someone help? Thanks.
>> 
>> Try "-mthumb".
>> 
>> -Eli
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list