Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Apr 2011 09:13:55 +0200
From:      Damjan Marion <damjan.marion@gmail.com>
To:        Mark Tinguely <marktinguely@gmail.com>
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: LLVM/Clang cross-compiling for ARM
Message-ID:  <714C855E-0EC8-4129-A1A4-C9C978D1B349@gmail.com>
In-Reply-To: <4DA65B0F.1040807@gmail.com>
References:  <794721.93419.qm@web112111.mail.gq1.yahoo.com> <574B5BB8-3BD6-4C87-9FC7-9549C02A2FCD@gmail.com> <4DA65B0F.1040807@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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

# clang -march=3Darmv7-a -mfloat-abi=3Dsoft -ccc-host-triple arm-elf =
-integrated-as hello.c -o hello.o -c                                     =
                                        =20
# file hello.o                                                           =
                                                                         =
                =20
hello.o: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped

# clang -march=3Darmv7-a -mfloat-abi=3Dsoft -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


Regards,

Damjan


On Apr 14, 2011, at 4:25 AM, Mark Tinguely wrote:

> =46rom distant memory, Clang was looking up the current processor and =
compiled in the assembly options for that architecture (i386). I can't =
remember if it was still kicking out i386 assembly as well. One idea I =
had was short-circuit the answer to those architecture queries and =
return "arm".
>=20
> Has anyone tried to compile Clang on an ARM arch and then build world =
with that? I suppose that would be a slow development environment.
>=20
> --Mark.
>=20
> On 4/13/2011 5:35 PM, Damjan Marion wrote:
>> Hi Vassilis,
>>=20
>> On Apr 14, 2011, at 12:02 AM, Vassilis Laganakos wrote:
>>=20
>>> Hello Damjan,
>>>=20
>>> ----- Original Message -----
>>>> From:Damjan Marion<damjan.marion@gmail.com>
>>>> To:freebsd-arm@freebsd.org
>>>> Cc:
>>>> Sent:Sunday, April 10, 2011 5:10 PM
>>>> Subject:Re: LLVM/Clang cross-compiling for ARM
>>>>=20
>>>>=20
>>>> Hi,
>>>>=20
>>>> What is the current status of LLVM/Clang cross-compiling for ARM =
targets?
>>>> Is anybody working actively on this?
>>>>=20
>>> I started taking a look into building llvm as cross-compiler
>>> for ARM and trying to build -CURRENT for an existing port,
>>> so see how far we get :)
>>>=20
>>> I'm currently stuck a bit in the first step :) As Mark T. pointed
>>> out in a recent email, llvm in -CURRENT does not cross-build,
>>> so we have to use an external compiler for now.
>> What exactly is missing in current version of llvm in -CURRENT?
>>=20
>> After reading some high level overview of llvm i was under impression
>> that llvm natively supports multiple targets, but seems that I was =
wrong.
>>=20
>>> I'll hopefully get back soon with some useful info about this...
>> Cool, please keep us updated.
>>=20
>> Thanks,
>>=20
>> Damjan
>> _______________________________________________
>> freebsd-arm@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-arm
>> To unsubscribe, send any mail to =
"freebsd-arm-unsubscribe@freebsd.org"
>>=20
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?714C855E-0EC8-4129-A1A4-C9C978D1B349>