Skip to contentSkip to conversation

optionrom: fix detection of -Wa,-32

PATCH In review Paolo Bonzini 2 participants 2 messages Jul 20, 2016 – Jul 29, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 optionrom: fix detection of -Wa,-32

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.

---
 pc-bios/optionrom/Makefile | 2 +-
 rules.mak                  | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
pc-bios/optionrom/Makefile +1 -1
index d88ce11..72abb3c 100644
@@ -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
 
rules.mak +2 -0
index ed8e482..99cd0b3 100644
@@ -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)))
Signature · 1 line
2.7.4
#1 lore raw
Quoted 9 lines · Paolo Bonzini

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.

---

Applied to master, thanks (since it fixes BSD builds).

-- PMM