From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPxIi-000301-Fv for qemu-devel@nongnu.org; Wed, 20 Jul 2016 15:37:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPxIc-0005X2-Fv for qemu-devel@nongnu.org; Wed, 20 Jul 2016 15:36:59 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPxIc-0005Wi-9G for qemu-devel@nongnu.org; Wed, 20 Jul 2016 15:36:54 -0400 Received: by mail-wm0-x242.google.com with SMTP id q128so8452847wma.1 for ; Wed, 20 Jul 2016 12:36:53 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 20 Jul 2016 21:36:49 +0200 Message-Id: <1469043409-14033-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] optionrom: fix detection of -Wa,-32 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: stefanha@gmail.com The cc-option macro runs $(CC) in -S mode (generate assembly) to avoid a pointless run of the assembler. However, this does not work when you want to detect support for cc->as option passthrough. clang ignores -Wa unless -c is provided, and exits successfully even if the -Wa,-32 option is not supported. Reported-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- pc-bios/optionrom/Makefile | 2 +- rules.mak | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index d88ce11..72abb3c 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -30,7 +30,7 @@ QEMU_INCLUDES += -I$(SRC_PATH) Wa = -Wa, ASFLAGS += -32 -QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), $(Wa)-32) +QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32) build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin diff --git a/rules.mak b/rules.mak index ed8e482..99cd0b3 100644 --- a/rules.mak +++ b/rules.mak @@ -113,6 +113,8 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \ >/dev/null 2>&1 && echo OK), $2, $3) +cc-c-option = $(if $(shell $(CC) $1 $2 -c -o /dev/null -xc /dev/null \ + >/dev/null 2>&1 && echo OK), $2, $3) VPATH_SUFFIXES = %.c %.h %.S %.cc %.cpp %.m %.mak %.texi %.sh %.rc set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1))) -- 2.7.4