Resurrecting clang external toolchain support in Makefile.inc

Warner Losh imp at bsdimp.com
Wed Feb 11 02:51:08 UTC 2015


> On Feb 10, 2015, at 7:32 PM, Peter Grehan <grehan at FreeBSD.org> wrote:
> 
> Hi toolchain folk,
> 
> I've recently tried using the base system clang as an external toolchain i.e.
> 
>   make CROSS_COMPILER_PREFIX=/usr/bin/ buildworld
> 
> .. and found that this no longer works after r273755 which split XFLAGS into XC/XCXXFLAGS. This appears to be because the XFLAGS definitions that define --sysroot and -B options aren't being passed through to clang, resulting in using header files from the host system.
> 
> My quick hack was
> 
> --- Makefile.inc1	(revision 278542)
> +++ Makefile.inc1	(working copy)
> @@ -374,6 +374,8 @@
> TARGET_ABI?=	unknown
> TARGET_TRIPLE?=	${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
> XCFLAGS+=	-target ${TARGET_TRIPLE}
> +XCFLAGS+=	${XFLAGS}
> +XCXXFLAGS+=	${XFLAGS}
> .endif
> .endif
> 
> However, this doesn't look to be the right way to fix this.
> 
> Any opinions on a proper fix ?

I have a similar “fix” in my tree as well, but hadn’t pushed it because I wasn’t quite sure the right way either.

Warner


More information about the freebsd-toolchain mailing list