Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/virtio: fix build break for aarch64

"-mfunction-return=thunk -mindirect-branch-register" are only valid
for x86. So introduce compiler operation check to avoid such issues

Fixes: 0d0ed4006127 ("tools/virtio: enable to build with retpoline")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Message-Id: <20230323040024.3809108-1-peng.fan@oss.nxp.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Peng Fan and committed by
Michael S. Tsirkin
77b894f2 fe37efba

+12 -1
+12 -1
tools/virtio/Makefile
··· 4 4 virtio_test: virtio_ring.o virtio_test.o 5 5 vringh_test: vringh_test.o vringh.o virtio_ring.o 6 6 7 - CFLAGS += -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h -mfunction-return=thunk -fcf-protection=none -mindirect-branch-register 7 + try-run = $(shell set -e; \ 8 + if ($(1)) >/dev/null 2>&1; \ 9 + then echo "$(2)"; \ 10 + else echo "$(3)"; \ 11 + fi) 12 + 13 + __cc-option = $(call try-run,\ 14 + $(1) -Werror $(2) -c -x c /dev/null -o /dev/null,$(2),) 15 + cc-option = $(call __cc-option, $(CC),$(1)) 16 + 17 + CFLAGS += -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h $(call cc-option,-mfunction-return=thunk) $(call cc-option,-fcf-protection=none) $(call cc-option,-mindirect-branch-register) 18 + 8 19 CFLAGS += -pthread 9 20 LDFLAGS += -pthread 10 21 vpath %.c ../../drivers/virtio ../../drivers/vhost