xref: /linux/tools/testing/selftests/nolibc/Makefile.include (revision b1c21075d30c40762750be0cded9822791df422b)
1*a09db6afSThomas Weißschuh# SPDX-License-Identifier: GPL-2.0
2*a09db6afSThomas Weißschuh
3*a09db6afSThomas Weißschuh__CFLAGS_STACKPROTECTOR = $(call cc-option,-fstack-protector-all) $(call cc-option,-mstack-protector-guard=global)
4*a09db6afSThomas Weißschuh_CFLAGS_STACKPROTECTOR ?= $(call try-run, \
5*a09db6afSThomas Weißschuh	echo 'void foo(void) {}' | $(CC) -x c - -o - -S $(CLANG_CROSS_FLAGS) $(__CFLAGS_STACKPROTECTOR) | grep -q __stack_chk_guard, \
6*a09db6afSThomas Weißschuh	$(__CFLAGS_STACKPROTECTOR))
7*a09db6afSThomas Weißschuh_CFLAGS_SANITIZER ?= $(call cc-option,-fsanitize=undefined -fsanitize-trap=all)
8*a09db6afSThomas WeißschuhCFLAGS_NOLIBC_TEST  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \
9*a09db6afSThomas Weißschuh		$(call cc-option,-fno-stack-protector) $(call cc-option,-Wmissing-prototypes) \
10*a09db6afSThomas Weißschuh		$(_CFLAGS_STACKPROTECTOR) $(_CFLAGS_SANITIZER)
11