Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Mar 2015 10:01:28 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Warner Losh <imp@bsdimp.com>
Cc:        freebsd-toolchain@freebsd.org, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   Re: powerpc/powerpc64 11.0-CURRENT not building clang by default: src.opt.mk not equivalent to 10.1-STABLE bsd.own.mk on the issue
Message-ID:  <7A17FBA1-9499-4862-83DF-1C4010D96003@dsl-only.net>
In-Reply-To: <B5B7E302-09E0-4E94-8251-ED08EB75D38E@bsdimp.com>
References:  <DBD1D803-FD36-490E-9661-5347CBD55D94@dsl-only.net> <B5B7E302-09E0-4E94-8251-ED08EB75D38E@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Well there is an entry but when I read it I did not find it clear about =
the 10.x status.

I think the implication is that the 9.x paragraph also applies to 10.x:

        On 9.x [and 10.x] installations where clang is enabled by =
default, e.g. on x86 and
        powerpc, libc++ will not be enabled by default, so libc++ should =
be
        built (with clang) and installed first.  If both clang and =
libc++ are
        missing, build clang first, then use it to build libc++.

=3D=3D=3D
Mark Millard
markmi@dsl-only.net

On 2015-Mar-12, at 05:00 AM, Warner Losh <imp@bsdimp.com> wrote:


> On Mar 12, 2015, at 6:36 PM, Mark Millard <markmi@dsl-only.net> wrote:
>=20
> Basic context for the observation (powerpc64 example):
>=20
> # freebsd-version -ku; uname -a
> 11.0-CURRENT
> 11.0-CURRENT
> FreeBSD FBSDG5C0 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r279514M: Wed =
Mar 11 19:23:14 PDT 2015     =
root@FBSDG4C0:/usr/obj/powerpc.powerpc64/usr/srcC/sys/GENERIC64vtsc-NODEBU=
G  powerpc
>=20
>=20
> As COMPILER_FEATURES context first I note that bsd.compiler.mk uses =
the rule...
>=20
> .if ${COMPILER_TYPE} =3D=3D "clang" || \
>       (${COMPILER_TYPE} =3D=3D "gcc" && ${COMPILER_VERSION} >=3D =
40800)
> COMPILER_FEATURES=3D      c++11
> .else
> COMPILER_FEATURES=3D
> .endif
>=20
> So powerpc/powerpc64 ends up with COMPILER_FEATURES being empty unless =
COMPILER_TYPE has been forced to be "clang" or ${CC} already is clang =
based.
>=20
> But src.opts.mk will never indicate to build clang when =
!${COMPILER_FEATURES:Mc++11} : that logic has priority over things like =
${__T:Mpowerpc*} tests=E2=80=A6

Clang can only be built by a new gcc or clang. Old gcc can=E2=80=99t =
build it, so if you don=E2=80=99t have a new gcc, you can=E2=80=99t =
build clang. The default compiler was gcc on 10.1. There likely should =
be an UPDATING entry to make this clear.

Warner


> .include <bsd.compiler.mk>
> .if !${COMPILER_FEATURES:Mc++11}
> # If the compiler is not C++11 capable, disable clang and use gcc =
instead.
> __DEFAULT_YES_OPTIONS+=3DGCC GCC_BOOTSTRAP GNUCXX
> __DEFAULT_NO_OPTIONS+=3DCLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
> .elif ${__T} =3D=3D "amd64" || ${__T} =3D=3D "i386"
> # On x86, clang is enabled, and will be installed as the default cc.
> __DEFAULT_YES_OPTIONS+=3DCLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
> __DEFAULT_NO_OPTIONS+=3DGCC GCC_BOOTSTRAP GNUCXX
> .elif ${__TT} =3D=3D "arm" && ${__T:Marm*eb*} =3D=3D ""
> # On little-endian arm, clang is enabled, and it is installed as the =
default
> # cc, but since gcc is unable to build the full clang, disable it by =
default.
> __DEFAULT_YES_OPTIONS+=3DCLANG CLANG_BOOTSTRAP CLANG_IS_CC
> __DEFAULT_NO_OPTIONS+=3DCLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
> .elif ${__T:Mpowerpc*}
> # On powerpc, clang is enabled, but gcc is installed as the default =
cc.
> __DEFAULT_YES_OPTIONS+=3DCLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
> __DEFAULT_NO_OPTIONS+=3DCLANG_BOOTSTRAP CLANG_IS_CC
> .else
> # Everything else disables clang, and uses gcc instead.
> __DEFAULT_YES_OPTIONS+=3DGCC GCC_BOOTSTRAP GNUCXX
> __DEFAULT_NO_OPTIONS+=3DCLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
> .endif
>=20
>=20
>=20
> By contrast the old bsd.own.mk logic from 10.1-STABLE did not depend =
on testing !${COMPILER_FEATURES:Mc++11} (or analogous) before deciding =
for powerpc/powerpc64...
>=20
> # Clang is only for x86, powerpc and little-endian arm right now, by =
default.
> .if ${__T} =3D=3D "amd64" || ${__T} =3D=3D "i386" || ${__T:Mpowerpc*}
> __DEFAULT_YES_OPTIONS+=3DCLANG CLANG_FULL
> .elif ${__T} =3D=3D "arm" || ${__T} =3D=3D "armv6"
> __DEFAULT_YES_OPTIONS+=3DCLANG
> # GCC is unable to build the full clang on arm, disable it by default.
> __DEFAULT_NO_OPTIONS+=3DCLANG_FULL
> .else
> __DEFAULT_NO_OPTIONS+=3DCLANG CLANG_FULL
> .endif
> # Clang the default system compiler only on little-endian arm and x86.
> .if ${__T} =3D=3D "amd64" || ${__T} =3D=3D "arm" || ${__T} =3D=3D =
"armv6" || \
>   ${__T} =3D=3D "i386"
> __DEFAULT_YES_OPTIONS+=3DCLANG_IS_CC
> # The pc98 bootloader requires gcc to build and so we must leave gcc =
enabled
> # for pc98 for now.
> .if ${__TT} =3D=3D "pc98"
> __DEFAULT_NO_OPTIONS+=3DGNUCXX
> __DEFAULT_YES_OPTIONS+=3DGCC
> .else
> __DEFAULT_NO_OPTIONS+=3DGCC GNUCXX
> .endif
> .else
> # If clang is not cc, then build gcc by default
> __DEFAULT_NO_OPTIONS+=3DCLANG_IS_CC
> __DEFAULT_YES_OPTIONS+=3DGCC
> # And if g++ is c++, build the rest of the GNU C++ stack
> .if defined(WITHOUT_CXX)
> __DEFAULT_NO_OPTIONS+=3DGNUCXX
> .else
> __DEFAULT_YES_OPTIONS+=3DGNUCXX
> .endif
> .endif
>=20
>=20
> =3D=3D=3D
> Mark Millard
> markmi at dsl-only.net
>=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"





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7A17FBA1-9499-4862-83DF-1C4010D96003>