From 38f4880a4eeac23a31c403eb10971a9e87a34326 Mon Sep 17 00:00:00 2001 From: Greg Tucker Date: Tue, 16 Jul 2019 15:47:20 -0700 Subject: [PATCH] build: Set nasm as the default when using std makefile Also test the assembler for modern instruction support and set appropriate defines. Change-Id: I1628abd50b3babeeb7e010b86bda7ea97de0e6fb Signed-off-by: Greg Tucker --- make.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/make.inc b/make.inc index 2a71099..5d1dff6 100644 --- a/make.inc +++ b/make.inc @@ -44,7 +44,7 @@ host_cpu ?= $(shell uname -m | sed -e 's/amd/x86_/') arch ?= $(shell uname | grep -v -e Linux -e BSD ) CC = gcc -AS = yasm +AS = nasm AWK = awk DEBUG = -g @@ -76,6 +76,7 @@ LDFLAGS_so = -Wl,-soname,$(soname) ifeq ($(arch),mingw) CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar + AS=yasm LDFLAGS += -Wl,--force-exe-suffix SIM=wine EXT=.exe @@ -145,6 +146,13 @@ $(all_llvm_fuzz_tests): CXXFLAGS += -fsanitize-coverage=trace-pc-guard -fsanitiz $(all_llvm_fuzz_tests): % : %.o $(lib_name) $(CXX) $(CXXFLAGS) $^ $(LDLIBS) $(FUZZLINK) -o $@ +# Check for modern as +tmpfile := $(shell mktemp) +have_as_w_avx512 ?= $(shell printf "vinserti32x8 zmm0, ymm1, 1;" > ${tmpfile} && $(AS) $(ASFLAGS) ${tmpfile} -o /dev/null 2> /dev/null && echo y; rm ${tmpfile}) +D_HAVE_AS_KNOWS_AVX512_$(have_as_w_avx512) := -DHAVE_AS_KNOWS_AVX512 +CFLAGS += $(D_HAVE_AS_KNOWS_AVX512_y) +ASFLAGS += $(D_HAVE_AS_KNOWS_AVX512_y) + # Check for pthreads have_threads ?= $(shell printf "\#include \nint main(void){return 0;}\n" | $(CC) -x c - -o /dev/null -lpthread && echo y ) THREAD_LD_$(have_threads) := -lpthread