From f272627fcd3720f6f5fd3deb4ffb8f978516688a Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Wed, 27 Jun 2018 16:56:46 +0000 Subject: [PATCH] Rework check for libclang_rt to see if the needed library exists. Currently libclang_rt is not provided for cross-building and as such is not connected to cross-tools. For building clang once in universe it is likely that libclang_rt won't exist for the universe toolchain but even if it did it would not support anything but the native arch. So explicitly check for support before enabling h_raw. MFC after: 1 week Reviewed by: dim Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D16012 --- lib/libc/tests/ssp/Makefile | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile index 5e0cca1fadf5..54dceb0eceb7 100644 --- a/lib/libc/tests/ssp/Makefile +++ b/lib/libc/tests/ssp/Makefile @@ -1,9 +1,5 @@ # $FreeBSD$ -# XXX This is a workaround to allow i386 to cross-compile on an amd64 host. -.include -# XXX --- - .include NO_WERROR= @@ -35,21 +31,16 @@ PROGS+= h_memset # probably needs to be fixed as it's currently hardcoded. # # sanitizer is not tested or supported for ARM right now. sbruno -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -.if ${COMPILER_TYPE} == "clang" && ${MK_TOOLCHAIN} == "yes" -.if ${COMPILER_VERSION} < 30500 || 30700 <= ${COMPILER_VERSION} - -# XXX This is a workaround to allow i386 to cross-compile on an amd64 host. -.if ${MACHINE_CPUARCH} == ${_HOST_ARCH} -# XXX --- - +.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \ + (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw") +.if !defined(_CLANG_RESOURCE_DIR) +_CLANG_RESOURCE_DIR!= ${CC:N${CCACHE_BIN}} -print-resource-dir +.export _CLANG_RESOURCE_DIR +.endif +_libclang_rt_arch= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/} +_libclang_rt_ubsan= ${_CLANG_RESOURCE_DIR}/lib/freebsd/libclang_rt.ubsan_standalone-${_libclang_rt_arch}.a +.if exists(${_libclang_rt_ubsan}) PROGS+= h_raw - -# XXX This is a workaround to allow i386 to cross-compile on an amd64 host. -.endif -# XXX --- - -.endif .endif .endif PROGS+= h_read