[LLVMdev] ARM assembler's syntax in clang
Ashi
ashi08104 at gmail.com
Tue Feb 19 02:53:19 PST 2013
Hi,all,
I find clang's integrated-as changes fast, My code which can't be compiled
by llvm3.1 tool-chain can be compiled by llvm3.2 tool-chain now. However,
there are still existing link-errors.
My develop environment is:
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.1
Thread model: posix
the code is attached, I get this error (there is no such error under gcc
tool-chain):
Undefined symbols for architecture armv7:
"_add_gas", referenced from:
_main in main_ios_clang.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I find after add '_' to add_gas label in iosasm_clang.s(change all add_gas
to _add_gas) will get rid of this error, but this will raise error(can't
find symbol 'add_gas' when linking) in gcc tool chain. I don't know whether
it's llvm's feature or not. Thanks for any help!
=============file: main.c===========================================
#include <stdio.h>
extern void add_gas(int* dst,
int* src1,
int* src2);
int main(int argc, char **argv)
{
int a = 10;
int b = 10;
int c = 0;
add_gas(&c, &a, &b);
printf("\nafter call add_gas, c=%d\
(should be 20)\n", c);
return 0;
}
=============file: iosasm_clang.s=====================================
/* this code follows ios' as syntax
* comment test
*/
.text
.globl add_gas
.align 4
add_gas:
/* add src1 and src2, result is return to dst
* r0: *dst
* r1: *src1
* r2: *src2
*/
push {r4, r5}
ldr r3, [r1]
ldr r4, [r2]
add r5, r3, r4
str r5, [r0]
pop {r4, r5}
bx lr
===========end=============================================
Best regards,
ashi
On Thu, Feb 14, 2013 at 10:11 PM, ashi <ashi08104 at gmail.com> wrote:
> Thanks, Renato.
> I'm actually porting a project which is based on GAS to iOS platform. I'll
> report my result.
>
> Best regards!
> ashi
>
> On Feb 13, 2013, at 6:20 PM, Renato Golin <renato.golin at linaro.org> wrote:
>
> I don't think there is such a document...
>
> There isn't a 1:1 compatibility assurance with any syntax, including the
> UAL and GAS, but there is good compatibility with most of them, focusing
> more on GAS than any other, though recent changes are making it more in
> sync with the UAL (as is happening on GAS, too).
>
> I think the recommendation is to try it on, throw code that works on other
> (OSS) ARM assemblers and report any mismatch. We really need some more real
> world testing, as we're considering turning the integrated assembler by
> default on ARM, so your input is greatly appreciated.
>
> cheers,
> --renato
>
>
> On 13 February 2013 01:09, ashi <ashi08104 at gmail.com> wrote:
>
>> Hi,all. Since the recent clang(3.2) has an integrated assembler for ARM,
>> but I can't find document about this assembler's syntax, such assembler's
>> directive, pseudo-instruction, (I assumed it follows the ARM Unified
>> Assembly Language in instructions), where can I get such information?
>>
>> Thanks!
>> ashi
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130219/bc51b944/attachment.html>
More information about the llvm-dev
mailing list