Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2011 11:29:18 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Damjan Marion <damjan.marion@gmail.com>
Cc:        toolchain@freebsd.org
Subject:   Re: cross-compiling for arm with clang
Message-ID:  <C29B8240-9D19-46CC-A1FC-1B9150547B1D@bsdimp.com>
In-Reply-To: <D0F647ED-4AB2-4A61-AD37-423F0AF9805D@gmail.com>
References:  <D0F647ED-4AB2-4A61-AD37-423F0AF9805D@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Shouldn't you be modifying the CFLAGS and CXXFLAGS instead of CC and =
CXX?

Warner

On Jun 17, 2011, at 10:50 AM, Damjan Marion wrote:

>=20
> Hi,=20
>=20
> Im trying to fix cross-compiling for arm architecture using clang. I =
added following patch:
>=20
>=20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- Makefile.inc1       (revision 223085)
> +++ Makefile.inc1       (working copy)
> @@ -226,6 +226,11 @@
>                GROFF_TMAC_PATH=3D${WORLDTMP}/legacy/usr/share/tmac
> .endif
>=20
> +.if ${TARGET_ARCH} !=3D ${MACHINE_ARCH} && ${CC:T:Mclang} =3D=3D =
"clang"
> +CROSSENV+=3D     CC=3D"${CC} -ccc-host-triple =
${TARGET_ARCH}-elf-freebsd" \
> +               CXX=3D"${CXX} -ccc-host-triple =
${TARGET_ARCH}-elf-freebsd"
> +.endif
> +
> # bootstrap-tools stage
> BMAKEENV=3D      INSTALL=3D"sh ${.CURDIR}/tools/install.sh" \
>                PATH=3D${BPATH}:${PATH} \
>=20
>=20
> Now it compiles up to stage 4.2 where it fails  (). For some reason =
-ccc-host-triple is not passed to compiler, but it is defined in CC.=20
>=20
> Is CROSSENV right place to add -ccc-host-triple ?
>=20
> Any hints?
>=20
> Thanks,
>=20
> Damjan
>=20
>=20
> # make CC=3Dclang CXX=3Dclang++ TARGET=3Darm TARGET_CPUTYPE=3Dcortex-a9 =
-DNO_CLEAN _libraries
>=20
> --------------------------------------------------------------
>>>> stage 4.2: building libraries
> --------------------------------------------------------------
> cd /usr/src-svn;  MAKEOBJDIRPREFIX=3D/zfs/data2/src/obj/arm.arm  =
MACHINE_ARCH=3Darm  MACHINE=3Darm  CPUTYPE=3Dcortex-a9 =
GROFF_BIN_PATH=3D/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/legacy/usr/bin=
  =
GROFF_FONT_PATH=3D/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/legacy/usr/sh=
are/groff_font  =
GROFF_TMAC_PATH=3D/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/legacy/usr/sh=
are/tmac CC=3D"clang -ccc-host-triple arm-elf-freebsd"  CXX=3D"clang++ =
-ccc-host-triple arm-elf-freebsd"  =
_SHLIBDIRPREFIX=3D/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp  =
VERSION=3D"FreeBSD 9.0-CURRENT i386 900036"  INSTALL=3D"sh =
/usr/src-svn/tools/install.sh"  =
PATH=3D/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/legacy/usr/sbin:/zfs/dat=
a2/src/obj/arm.arm/usr/src-svn/tmp/legacy/usr/bin:/zfs/data2/src/obj/arm.a=
rm/usr/src-svn/tmp/legacy/usr/games:/zfs/data2/src/obj/arm.arm/usr/src-svn=
/tmp/usr/sbin:/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/bin:/zfs/data=
2/src/obj/arm.arm/usr/src-svn/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin =
make -f Makefile.inc1 DESTDIR=3D/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp=
 -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT  -DWITHOUT_MAN =
-DWITHOUT_PROFILE libraries
> cd /usr/src-svn;  make -f Makefile.inc1 _prereq_libs;  make -f =
Makefile.inc1 _startup_libs;  make -f Makefile.inc1 _prebuild_libs;  =
make -f Makefile.inc1 _generic_libs;
> =3D=3D=3D> gnu/lib/libssp/libssp_nonshared (obj,depend,all,install)
> sh /usr/src-svn/tools/install.sh -C -o root -g wheel -m 444   =
libssp_nonshared.a /zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib
> =3D=3D=3D> gnu/lib/libgcc (obj,depend,all,install)
> sh /usr/src-svn/tools/install.sh -C -o root -g wheel -m 444   =
libgcc_eh.a /zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib
> =3D=3D=3D> lib/libcompiler_rt (obj,depend,all,install)
> sh /usr/src-svn/tools/install.sh -C -o root -g wheel -m 444   =
libcompiler_rt.a /zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib
> /zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib/libgcc.a -> =
libcompiler_rt.a
> =3D=3D=3D> gnu/lib/csu (obj,depend,all,install)
> sh /usr/src-svn/tools/install.sh -o root -g wheel -m 444  crtbegin.o =
/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib/crtbegin.o
> sh /usr/src-svn/tools/install.sh -o root -g wheel -m 444  crtend.o =
/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib/crtend.o
> sh /usr/src-svn/tools/install.sh -o root -g wheel -m 444  crtbeginT.o =
/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib/crtbeginT.o
> sh /usr/src-svn/tools/install.sh -o root -g wheel -m 444  crtbegin.So =
/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib/crtbeginS.o
> sh /usr/src-svn/tools/install.sh -o root -g wheel -m 444  crtend.So =
/zfs/data2/src/obj/arm.arm/usr/src-svn/tmp/usr/lib/crtendS.o
> =3D=3D=3D> lib/csu/arm (obj,depend,all,install)
> clang -O -pipe -mcpu=3Dcortex-a9 -I/usr/src-svn/lib/csu/arm/../common  =
-I/usr/src-svn/lib/csu/arm/../../libc/include -std=3Dgnu99 =
-Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter =
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type =
-Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter =
-Wcast-align -Wchar-subscripts -Winline -Wnested-externs =
-Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c -o crt1.o =
crt1.s
> clang: warning: argument unused during compilation: '-mcpu=3Dcortex-a9'
> clang: warning: argument unused during compilation: '-I =
/usr/src-svn/lib/csu/arm/../common'
> clang: warning: argument unused during compilation: '-I =
/usr/src-svn/lib/csu/arm/../../libc/include'
> clang: warning: argument unused during compilation: '-std=3Dgnu99'
> clang: warning: argument unused during compilation: '-Wsystem-headers'
> clang: warning: argument unused during compilation: '-Wall'
> clang: warning: argument unused during compilation: '-Wno-format-y2k'
> clang: warning: argument unused during compilation: '-W'
> clang: warning: argument unused during compilation: =
'-Wno-unused-parameter'
> clang: warning: argument unused during compilation: =
'-Wstrict-prototypes'
> clang: warning: argument unused during compilation: =
'-Wmissing-prototypes'
> clang: warning: argument unused during compilation: '-Wpointer-arith'
> clang: warning: argument unused during compilation: '-Wreturn-type'
> clang: warning: argument unused during compilation: '-Wcast-qual'
> clang: warning: argument unused during compilation: '-Wwrite-strings'
> clang: warning: argument unused during compilation: '-Wswitch'
> clang: warning: argument unused during compilation: '-Wshadow'
> clang: warning: argument unused during compilation: =
'-Wunused-parameter'
> clang: warning: argument unused during compilation: '-Wcast-align'
> clang: warning: argument unused during compilation: =
'-Wchar-subscripts'
> clang: warning: argument unused during compilation: '-Winline'
> clang: warning: argument unused during compilation: '-Wnested-externs'
> clang: warning: argument unused during compilation: =
'-Wredundant-decls'
> clang: warning: argument unused during compilation: =
'-Wold-style-definition'
> clang: warning: argument unused during compilation: =
'-Wno-pointer-sign'
> crt1.s:11:2: error: unknown use of instruction mnemonic without a size =
suffix
>        mov     r5, r2          /* cleanup */  =20
>        ^
> crt1.s:12:2: error: unknown use of instruction mnemonic without a size =
suffix
>        mov     r4, r1          /* obj_main */ =20
>        ^
> crt1.s:13:2: error: unknown use of instruction mnemonic without a size =
suffix
>        mov     r3, r0          /* ps_strings */
>        ^
> crt1.s:15:13: error: expected ']' in brackets expression
>        ldr     r0, [sp, #0x0000]
>                       ^
> crt1.s:16:14: error: unknown token in expression
>        add     r1, sp, #0x0004=20
>                        ^
> crt1.s:17:2: error: unknown use of instruction mnemonic without a size =
suffix
>        add     r2, r1, r0, lsl #2
>        ^
> crt1.s:18:14: error: unknown token in expression
>        add     r2, r2, #0x0004=20
>                        ^
> crt1.s:20:14: error: unknown token in expression
>        bic     sp, sp, #7
>                        ^
> crt1.s:21:14: error: unknown token in expression
>        sub     sp, sp, #8
>                        ^
> crt1.s:22:13: error: expected ']' in brackets expression
>        str     r5, [sp, #4]
>                       ^
> crt1.s:23:13: error: expected ']' in brackets expression
>        str     r4, [sp, #0]
>                       ^
> crt1.s:25:2: error: invalid instruction mnemonic 'b'
>        b        __start =20
>        ^
> *** Error code 1
>=20
> Stop in /usr/src-svn/lib/csu/arm.
> *** Error code 1
>=20
> Stop in /usr/src-svn.
> *** Error code 1
>=20
> Stop in /usr/src-svn.
> *** Error code 1
>=20
> Stop in /usr/src-svn.
> *** Error code 1
>=20
> Stop in /usr/src-svn.
>=20
>=20
> _______________________________________________
> freebsd-toolchain@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
> To unsubscribe, send any mail to =
"freebsd-toolchain-unsubscribe@freebsd.org"
>=20
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C29B8240-9D19-46CC-A1FC-1B9150547B1D>