Skip to content

Commit 777dddc

Browse files
committed
tests/plugins: don't unconditionally add -Wpsabi
Not all compilers support the -Wpsabi (clang-9 in my case). To handle this gracefully we pare back the shared build machinery so the Makefile is relatively "standalone". We still take advantage of config-host.mak as configure has done a bunch of probing for us but that is it. Fixes: bac8d22 Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Message-Id: <[email protected]>
1 parent 8cdf912 commit 777dddc

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

configure

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7115,6 +7115,9 @@ echo "GIT_UPDATE=$git_update" >> $config_host_mak
71157115

71167116
echo "ARCH=$ARCH" >> $config_host_mak
71177117

7118+
echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
7119+
echo "GLIB_LDFLAGS=$glib_ldflags" >> $config_host_mak
7120+
71187121
if test "$default_devices" = "yes" ; then
71197122
echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak
71207123
else

tests/plugin/Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
# -*- Mode: makefile -*-
2+
#
3+
# This Makefile example is fairly independent from the main makefile
4+
# so users can take and adapt it for their build. We only really
5+
# include config-host.mak so we don't have to repeat probing for
6+
# cflags that the main configure has already done for us.
7+
#
8+
19
BUILD_DIR := $(CURDIR)/../..
210

311
include $(BUILD_DIR)/config-host.mak
4-
include $(SRC_PATH)/rules.mak
512

6-
$(call set-vpath, $(SRC_PATH)/tests/plugin)
13+
VPATH += $(SRC_PATH)/tests/plugin
714

815
NAMES :=
916
NAMES += bb
@@ -17,11 +24,18 @@ NAMES += lockstep
1724

1825
SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES)))
1926

20-
QEMU_CFLAGS += -fPIC -Wpsabi
21-
QEMU_CFLAGS += -I$(SRC_PATH)/include/qemu
27+
# The main QEMU uses Glib extensively so it's perfectly fine to use it
28+
# in plugins (which many example do).
29+
CFLAGS = $(GLIB_CFLAGS)
30+
CFLAGS += -fPIC
31+
CFLAGS += $(if $(findstring no-psabi,$(QEMU_CFLAGS)),-Wpsabi)
32+
CFLAGS += -I$(SRC_PATH)/include/qemu
2233

2334
all: $(SONAMES)
2435

36+
%.o: %.c
37+
$(CC) $(CFLAGS) -c -o $@ $<
38+
2539
lib%.so: %.o
2640
$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDLIBS)
2741

0 commit comments

Comments
 (0)