[LLVMdev] error: instruction requires: thumb2

Lei Zhao leizhao833 at gmail.com
Thu Aug 16 14:36:39 PDT 2012


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





More information about the llvm-dev mailing list