[LLVMdev] ARM thumb-2 instruction used for non-thumb2 CPUs

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Thu Jun 23 00:19:51 PDT 2011


On Wednesday, June 22, 2011, Damjan Marion <damjan.marion at gmail.com> wrote:
>
> On Jun 23, 2011, at 1:13 AM, Jim Grosbach wrote:
>
>> On Jun 22, 2011, at 4:02 PM, Damjan Marion wrote:
>>>>
>>>> To get -integrated-as working so that we don't need to go through the assembler at all should be mostly a matter of bug fixing, modulo inline assembly support. For non-trivial inline assembly, and to get a system assembler replacement based on the MC assembler, it'll be a bigger task. The ARM asm parser is currently in need of some tender loving care. That's coming soon, but it's a non-trivial task.
>>>>
>>>> For -integrated-as, I would suggest giving it a try. I'm not completely sure how complete the support is for ELF, but I think it's in somewhat OK shape, at least. Worth trying. That would neatly avoid the problem if it works. If it doesn't, we should fix the bugs so it does. ;)
>>>
>>> I tried with FreeBSD kernel. Outcome is 2 different crashes. Output is here:
>>>
>>> http://web.me.com/dmarion/FreeBSD/integrated-as_crash.txt
>>>
>>> I can provide more details if needed.
>>
>>
>> Thanks, Damjan. That's good information.
>>
>> Crash #1 is an assembly source file. It's running into something it doesn't understand on the line indicated. The assertion failure is a secondary problem, and definitely shouldn't happen. As mentioned, though, the asm parser isn't ready for prime time yet, so I suspect this may be just the tip of the iceberg as far as the problems that (and similar) files would encounter.
>>
>> Crash #2 is a C file, but is also asserting in the assembly parser, which indicates that there's inline assembly in the file somewhere that the parser doesn't know how to handle yet.
>
> Seems that it fails even on simply inline asm. Here is test function:
>
> void case2(unsigned int x)
> {
>  __asm volatile( "mov    %0, %0, ror #8\n" : "+r" (x));
> }

IIRC, this fails because the support for optional args isn't yet
supported for every instruction, only for the cases that people cared!
Please file bugs!

>
>>
>> Some Makefile magic should be able to take care of issues of the sort encountered in #1 (don't pass -integrated-as when compiling .S files).
>>
>> Inline assembly is a bit trickier. Temporarily, if those files compile/assemble OK with the system assembler (i.e., don't have the rrx instruction mnemonic in them), we could work around by not using -integrated-as for them. That's pretty fugly, though, and would just be a quick workaround to allow you to keep making progress while the real issues get fixed.
>>
>> How much inline asm is there in that file that's causing issues? if it's not too much, it might not be too bad to get at least that much of the asm parsing working. That would be general goodness and would help move you forward.
>>
>
> I tried to compile FreeBSD kernel using -integrated-asm and except ~30 files containing inline asm everything else went smoothly in compiling phase.
> I removed -integrated-as for files with inline assembly and now linker fails:
>
> error: Source object ata_all.o has EABI version 0, but target kernel.debug has EABI version 5
>
> Seems that -integrated-as is producing EABI v5 files, while my binutils is producing EABI v0.
>
> Is there any way to force EABI version 0?
>
> Thanks,
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc




More information about the llvm-dev mailing list