diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2020-04-06 23:38:46 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2020-04-06 23:38:46 +0000 |
commit | f382bac49b1378da3c2dd66bf721beaa16b5d471 (patch) | |
tree | 1dbcfb23427ded4022c141f77c3bd5ee08b35d8a /share/mk/bsd.compiler.mk | |
parent | a86ddfe8c760be83b1322fe8ba3a3568421adb1f (diff) | |
download | src-f382bac49b1378da3c2dd66bf721beaa16b5d471.tar.gz src-f382bac49b1378da3c2dd66bf721beaa16b5d471.zip |
Fix compilation with upstream clang builtin headers.
By using -nobuiltininc and adding the clang builtin headers resource dir
to the end of the compiler header search path, we can still find headers
such as immintrin.h but find the FreeBSD version of stddef.h/stdarg.h/..
first.
This is a workaround until we are able to settle on and complete a plan
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.
Submitted by: arichardson
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17002
Notes
Notes:
svn path=/head/; revision=359681
Diffstat (limited to 'share/mk/bsd.compiler.mk')
-rw-r--r-- | share/mk/bsd.compiler.mk | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 9e43d3617768..2902e8b01f29 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -143,7 +143,7 @@ _cc_vars+=XCC X_ # The value is only used/exported for the same environment that impacts # CC and COMPILER_* settings here. _exported_vars= ${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \ - ${X_}COMPILER_FREEBSD_VERSION + ${X_}COMPILER_FREEBSD_VERSION ${X_}COMPILER_RESOURCE_DIR ${X_}_cc_hash= ${${cc}}${MACHINE}${PATH} ${X_}_cc_hash:= ${${X_}_cc_hash:hash} # Only import if none of the vars are set somehow else. @@ -201,6 +201,10 @@ ${X_}COMPILER_FREEBSD_VERSION= unknown .endif .endif +.if !defined(${X_}COMPILER_RESOURCE_DIR) +${X_}COMPILER_RESOURCE_DIR!= ${${cc}:N${CCACHE_BIN}} -print-resource-dir 2>/dev/null || echo unknown +.endif + ${X_}COMPILER_FEATURES= .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 30300) || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800) @@ -224,6 +228,7 @@ X_COMPILER_TYPE= ${COMPILER_TYPE} X_COMPILER_VERSION= ${COMPILER_VERSION} X_COMPILER_FREEBSD_VERSION= ${COMPILER_FREEBSD_VERSION} X_COMPILER_FEATURES= ${COMPILER_FEATURES} +X_COMPILER_RESOURCE_DIR= ${COMPILER_RESOURCE_DIR} .endif # ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC}) # Export the values so sub-makes don't have to look them up again, using the |