Date: Mon, 6 Apr 2020 18:14:00 -0700 From: Bryan Drewery <bdrewery@FreeBSD.org> To: Brooks Davis <brooks@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r359681 - in head: . share/mk Message-ID: <9f2a2e90-0bb5-29b0-8b2b-c79caf6df903@FreeBSD.org> In-Reply-To: <202004062338.036Nckt3022130@repo.freebsd.org> References: <202004062338.036Nckt3022130@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --QVVwWxdjjPGdAk0AOOIKjiFwdSmHC0h5H Content-Type: multipart/mixed; boundary="CVxL14w4N9c31uTFjTuURC86orHFPXaxq"; protected-headers="v1" From: Bryan Drewery <bdrewery@FreeBSD.org> To: Brooks Davis <brooks@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <9f2a2e90-0bb5-29b0-8b2b-c79caf6df903@FreeBSD.org> Subject: Re: svn commit: r359681 - in head: . share/mk References: <202004062338.036Nckt3022130@repo.freebsd.org> In-Reply-To: <202004062338.036Nckt3022130@repo.freebsd.org> --CVxL14w4N9c31uTFjTuURC86orHFPXaxq Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 4/6/2020 4:38 PM, Brooks Davis wrote: > Author: brooks > Date: Mon Apr 6 23:38:46 2020 > New Revision: 359681 > URL: https://svnweb.freebsd.org/changeset/base/359681 >=20 > Log: > Fix compilation with upstream clang builtin headers. > =20 > By using -nobuiltininc and adding the clang builtin headers resource = dir > to the end of the compiler header search path, we can still find head= ers > such as immintrin.h but find the FreeBSD version of stddef.h/stdarg.h= /.. > first. > =20 > This is a workaround until we are able to settle on and complete a pl= an > to harmonize guard macros with LLVM. We've mostly worked out this on= > FreeBSD systems by removing select headers from the installed set of > devel/llvm*, but that isn't a good solution for cross build. > =20 > Submitted by: arichardson > Obtained from: CheriBSD > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D17002 >=20 > Modified: > head/Makefile.inc1 > head/share/mk/bsd.compiler.mk > head/share/mk/bsd.sys.mk >=20 > Modified: head/Makefile.inc1 > =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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/Makefile.inc1 Mon Apr 6 23:28:24 2020 (r359680) > +++ head/Makefile.inc1 Mon Apr 6 23:38:46 2020 (r359681) > @@ -337,6 +337,7 @@ _TOOLCHAIN_METADATA_VARS=3D COMPILER_VERSION \ > COMPILER_TYPE \ > COMPILER_FEATURES \ > COMPILER_FREEBSD_VERSION \ > + COMPILER_RESOURCE_DIR \ > LINKER_VERSION \ > LINKER_FEATURES \ > LINKER_TYPE \ >=20 > Modified: head/share/mk/bsd.compiler.mk > =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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/bsd.compiler.mk Mon Apr 6 23:28:24 2020 (r359680) > +++ head/share/mk/bsd.compiler.mk Mon Apr 6 23:38:46 2020 (r359681) > @@ -143,7 +143,7 @@ _cc_vars+=3DXCC X_ > # The value is only used/exported for the same environment that impact= s > # CC and COMPILER_* settings here. > _exported_vars=3D ${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \ > - ${X_}COMPILER_FREEBSD_VERSION > + ${X_}COMPILER_FREEBSD_VERSION ${X_}COMPILER_RESOURCE_DIR > ${X_}_cc_hash=3D ${${cc}}${MACHINE}${PATH} > ${X_}_cc_hash:=3D ${${X_}_cc_hash:hash} > # Only import if none of the vars are set somehow else. > @@ -201,6 +201,10 @@ ${X_}COMPILER_FREEBSD_VERSION=3D unknown > .endif > .endif > =20 > +.if !defined(${X_}COMPILER_RESOURCE_DIR) > +${X_}COMPILER_RESOURCE_DIR!=3D ${${cc}:N${CCACHE_BIN}} -print-resource= -dir 2>/dev/null || echo unknown > +.endif > + > ${X_}COMPILER_FEATURES=3D > .if (${${X_}COMPILER_TYPE} =3D=3D "clang" && ${${X_}COMPILER_VERSION} = >=3D 30300) || \ > (${${X_}COMPILER_TYPE} =3D=3D "gcc" && ${${X_}COMPILER_VERSION} >=3D = 40800) > @@ -224,6 +228,7 @@ X_COMPILER_TYPE=3D ${COMPILER_TYPE} > X_COMPILER_VERSION=3D ${COMPILER_VERSION} > X_COMPILER_FREEBSD_VERSION=3D ${COMPILER_FREEBSD_VERSION} > X_COMPILER_FEATURES=3D ${COMPILER_FEATURES} > +X_COMPILER_RESOURCE_DIR=3D ${COMPILER_RESOURCE_DIR} > .endif # ${cc} =3D=3D "CC" || (${cc} =3D=3D "XCC" && ${XCC} !=3D ${CC}= ) > =20 > # Export the values so sub-makes don't have to look them up again, usi= ng the >=20 > Modified: head/share/mk/bsd.sys.mk > =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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/bsd.sys.mk Mon Apr 6 23:28:24 2020 (r359680) > +++ head/share/mk/bsd.sys.mk Mon Apr 6 23:38:46 2020 (r359681) > @@ -206,6 +206,21 @@ CWARNFLAGS+=3D -Wno-unknown-pragmas > # This warning is utter nonsense > CFLAGS+=3D -Wno-format-zero-length > =20 > +.if ${COMPILER_TYPE} =3D=3D "clang" > +# The headers provided by clang are incompatible with the FreeBSD head= ers. > +# If the version of clang is not one that has been patched to omit the= > +# incompatible headers, we need to compile with -nobuiltininc and add = the > +# resource dir to the end of the search paths. This ensures that heade= rs such as > +# immintrin.h are still found but stddef.h, etc. are picked up from Fr= eeBSD. > +# > +# XXX: This is a hack to support complete external installs of clang w= hile > +# we work to synchronize our decleration guards with those in the clan= g tree. > +.if ${MK_CLANG_BOOTSTRAP} =3D=3D "no" && ${COMPILER_RESOURCE_DIR} !=3D= "unknown" && \ > + !defined(BOOTSTRAPPING) I just realized MK_CLANG_BOOTSTRAP is not going to be defined here outside of the tree. Adding :Uno will fix it. Keep in mind this current change and the next will affect ports. It looks like by default clang will always get these flags added on. > +CFLAGS+=3D-nobuiltininc -idirafter ${COMPILER_RESOURCE_DIR}/include > +.endif > +.endif > + > CLANG_OPT_SMALL=3D -mstack-alignment=3D8 -mllvm -inline-threshold=3D3\= > -mllvm -simplifycfg-dup-ret > .if ${COMPILER_VERSION} >=3D 30500 && ${COMPILER_VERSION} < 30700 >=20 --=20 Regards, Bryan Drewery --CVxL14w4N9c31uTFjTuURC86orHFPXaxq-- --QVVwWxdjjPGdAk0AOOIKjiFwdSmHC0h5H Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl6L09hfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY5 MTczQ0IyQzNBQUVBN0E1QzhBMUYwOTM1RDc3MUJCNkU0Njk3Q0YACgkQNddxu25G l89KSQf+PCZPPRH7nlDHMpn+uG8Bq1GAtuj1ngWvRNS4/KSOs+Wz4wQGPKjDfihO oeHJ1mykOcRJr1u2Cmpd4NLqa3m4y+xA4mvexw1A2vsK6HkWQnCS6tb16Q0fwllE ajGVmyTDOWhai3Hzc2UOQzAByT0Ap2q9rBuTWuupnHVJCBDtlDQsffLD4gv0hkXL UFyUViKn3M4vb1b2pSegzZkVt/acHAGCgx1/Gp5qDZpgBMqEo1EaQzmVTrM7lTk7 KEHFY6hd7JNKaOjK0j2BM0Xu/ToSWFcQoCz/bZW3C/kO6Kv33ttwi4Gph+NnRUGS QeUa0vX17stImYyA+xs5B2v3DabUsg== =6LRB -----END PGP SIGNATURE----- --QVVwWxdjjPGdAk0AOOIKjiFwdSmHC0h5H--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9f2a2e90-0bb5-29b0-8b2b-c79caf6df903>