[LLVMdev] [compiler-rt] CMake bug in building ARM builtins library
sgundapa
sgundapa at codeaurora.org
Mon Jul 21 17:02:27 PDT 2014
I have filed the 2 bugs
ARM MC assembler allows backward branching on CBNZ instruction
http://llvm.org/bugs/show_bug.cgi?id=20359
ARM builtins library has incompatible assembly
http://llvm.org/bugs/show_bug.cgi?id=20360
I have fixed PR20360 in http://reviews.llvm.org/D4610 (My first patch to
llvm :) )
This also addressed the .S source file inclusion issue during bultins
library compilation.
--Sumanth G
-----Original Message-----
From: sgundapa [mailto:sgundapa at codeaurora.org]
Sent: Thursday, July 17, 2014 6:41 PM
To: 'Jonathan Roelofs'; 'Alexey Samsonov'; 'tnorthover at apple.com';
't.p.northover at gmail.com'
Cc: 'LLVM Dev'; 'Ana Pazos'; 'mcrosier at codeaurora.org'
Subject: RE: [LLVMdev] [compiler-rt] CMake bug in building ARM builtins
library
I can file a bug :)
2 bugs here:
1. We need to update the sync_fetch_* files to generate proper assembly
2. Clang ARM MC should emit an error on seeing a backward branch for CBNZ.
--Sumanth G
-----Original Message-----
From: Jonathan Roelofs [mailto:jonathan at codesourcery.com]
Sent: Thursday, July 17, 2014 3:17 PM
To: sgundapa; 'Alexey Samsonov'; tnorthover at apple.com;
t.p.northover at gmail.com
Cc: 'LLVM Dev'; Ana Pazos; mcrosier at codeaurora.org
Subject: Re: [LLVMdev] [compiler-rt] CMake bug in building ARM builtins
library
Oh yeah, Tim and I discussed this exact issue on irc the other day...
I should have filed a PR. Oops.
Jon
On 7/17/14, 1:11 PM, sgundapa wrote:
> +Tim Northover
>
> I added ".syntax unified" to the sync_fetch_* .S files and the
> "-no-integrated-as" path moved ahead and failed with
> Error: branch out of range
>
> No Integrated asm path:
>
> .p2align 2 ;
> .thumb ;
> .syntax unified ;
> ;
> .globl __sync_fetch_and_add_8 ;
> .type __sync_fetch_and_add_8,%function ;
> __sync_fetch_and_add_8: push {r4, r5, r6, lr} ;
> dmb ;
> mov r12, r0 ;
> .L_tryatomic_add_8: ldrexd r0, r1, [r12] ;
> adds r4, r0, r2 ;
> adc r5, r1, r3 ;
> strexd r6, r4, r5, [r12] ;
> cbnz r6, .L_tryatomic_add_8 ;
> dmb ;
> pop {r4, r5, r6, pc}
>
> The ARM manual on CBNZ says backward branching is not possible.
> Refer to
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/C
> jaghef
> c.html
>
>
>
> Integrated asm path:
> Surprisingly, integrated-as compiles the file and the objdump looks
> invalid
>
> Disassembly of section .text:
> 00000000 <__sync_fetch_and_add_8>:
> 0: b570 push {r4, r5, r6, lr}
> 2: f3bf 8f5f dmb sy
> 6: 4684 mov ip, r0
> 8: e8dc 017f ldrexd r0, r1, [ip]
> c: 1884 adds r4, r0, r2
> e: eb41 0503 adc.w r5, r1, r3
> 12: e8cc 4576 strexd r6, r4, r5, [ip]
> 16: bbbe cbnz r6, 88 <__sync_fetch_and_add_8+0x88>
> 18: f3bf 8f5f dmb sy
> 1c: bd70 pop {r4, r5, r6, pc}
>
> There is no <__sync_fetch_and_add_8+0x88> at least as I could tell
>
> There are two issues here:
> 1. We need to update the sync_fetch_* files to generate proper
> assembly 2. How clang ARM MC is accepting the above assembly to compile.
>
> --Sumanth G
>
> -----Original Message-----
> From: Jonathan Roelofs [mailto:jonathan at codesourcery.com]
> Sent: Wednesday, July 16, 2014 7:37 PM
> To: sgundapa; 'Alexey Samsonov'
> Cc: 'LLVM Dev'
> Subject: Re: [LLVMdev] [compiler-rt] CMake bug in building ARM
> builtins library
>
>
>
> On 7/16/14, 6:09 PM, sgundapa wrote:
>> I see a couple of issues here.
>>
>> If I include .S files for ARM, the -no-integrated-as path complains
>> about Assembler errors.
>>
>> The integrated-as path works fine though.
>>
>
> These are very likely just differences between the old ARM assembler
> syntax and the new 'Unified' syntax. Can you use an assembler that
> accepts UAL syntax?
>
> Regards,
> Jon
>
>
> --
> Jon Roelofs
> jonathan at codesourcery.com
> CodeSourcery / Mentor Embedded
>
--
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded
More information about the llvm-dev
mailing list