Page MenuHomeFreeBSD

D17002.id48933.diff
No OneTemporary

D17002.id48933.diff

Index: Makefile.inc1
===================================================================
--- Makefile.inc1
+++ Makefile.inc1
@@ -357,6 +357,7 @@
COMPILER_TYPE \
COMPILER_FEATURES \
COMPILER_FREEBSD_VERSION \
+ COMPILER_RESOURCE_DIR \
LINKER_VERSION \
LINKER_FEATURES \
LINKER_TYPE \
Index: share/mk/bsd.compiler.mk
===================================================================
--- share/mk/bsd.compiler.mk
+++ share/mk/bsd.compiler.mk
@@ -122,7 +122,7 @@
# 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.
@@ -180,6 +180,10 @@
.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_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800)
@@ -195,6 +199,7 @@
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
Index: share/mk/bsd.sys.mk
===================================================================
--- share/mk/bsd.sys.mk
+++ share/mk/bsd.sys.mk
@@ -183,6 +183,16 @@
# mechanism.
.if ${COMPILER_TYPE} == "clang"
CLANG_NO_IAS= -no-integrated-as
+
+# The headers provided by clang are incompatible with the FreeBSD headers.
+# 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 headers such as
+# immintrin.h are still found but stddef.h, etc. are picked up from FreeBSD.
+.if ${MK_CLANG_BOOTSTRAP} == "no" && ${COMPILER_RESOURCE_DIR} != "unknown" && \
+ !defined(BOOTSTRAPPING)
+CFLAGS+=-nobuiltininc -idirafter ${COMPILER_RESOURCE_DIR}/include
+.endif
.endif
CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\
-mllvm -simplifycfg-dup-ret

File Metadata

Mime Type
text/plain
Expires
Tue, May 19, 4:16 PM (5 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33320109
Default Alt Text
D17002.id48933.diff (2 KB)

Event Timeline