LLVM/Clang cross-compiling for ARM
Vassilis Laganakos
vassilis.laganakos at yahoo.com
Thu Apr 14 11:06:57 UTC 2011
Hi Damjan, Mark,
----- Original Message -----
> From:Damjan Marion <damjan.marion at gmail.com>
> To:Mark Tinguely <marktinguely at gmail.com>
> Cc:Vassilis Laganakos <vassilis.laganakos at yahoo.com>; "freebsd-arm at freebsd.org" <freebsd-arm at freebsd.org>
> Sent:Thursday, April 14, 2011 8:13 AM
> Subject:Re: LLVM/Clang cross-compiling for ARM
>
>
> Hi Mark,
>
> Seems that clang from current (made by i386 buildworld) is able to build ARM
> code:
>
> # clang -v
>
> FreeBSD clang version 2.9 (trunk 126547) 20110226
> Target: i386-undermydesk-freebsd9.0
> Thread model: posix
>
That's the same I get when I build llvm/clang as a cross-compiler, and I thought that
something was wrong. I'd expect that to be: "arm-unknown-freebsd9.0", but it
seems from your test bellow that it does generate ARM code.
> # clang -march=armv7-a -mfloat-abi=soft -ccc-host-triple arm-elf -integrated-as
> hello.c -o hello.o -c
>
> # file hello.o
>
>
> hello.o: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped
>
> # clang -march=armv7-a -mfloat-abi=soft -ccc-host-triple arm-elf hello.c -o
> hello.S -S
>
> # cat hello.S
>
> .syntax unified
> .cpu cortex-a8
> .eabi_attribute 6, 10
> .eabi_attribute 7, 65
> .eabi_attribute 8, 1
> .eabi_attribute 9, 2
> .eabi_attribute 10, 2
> .eabi_attribute 20, 1
> .eabi_attribute 21, 1
> .eabi_attribute 23, 3
> .eabi_attribute 24, 1
> .eabi_attribute 25, 1
> .file "hello.c"
> .text
> .globl main
> .align 2
> .type main,%function
> main:
> push {r11, lr}
> mov r11, sp
> sub sp, sp, #12
> mov r0, #0
> str r0, [r11, #-4]
> str r0, [sp, #4]
> movw r0, :lower16:.L.str
> movt r0, :upper16:.L.str
> bl printf
> str r0, [sp]
> ldr r0, [sp, #4]
> mov sp, r11
> ldmia sp!, {r11, pc}
> .Ltmp0:
> .size main, .Ltmp0-main
>
> .type .L.str,%object
> .section .rodata.str1.1,"aMS",%progbits,1
> .L.str:
> .asciz "Hello World!\n"
> .size .L.str, 14
>
Well you proved the opposite from what we assumed, since this looks like ARM assembly to me :)
Anyone knows if something has changed in http://wiki.freebsd.org/BuildingFreeBSDWithClang
since it was last edited?
Damjan, if you find some more info about this with llvm/clang, could you please post
the links here? :)
Thanks,
Vassilis
More information about the freebsd-arm
mailing list