From db5adeaa84d0d70dabd41500e72493fec04408ac Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 11 Dec 2019 15:34:27 +0100 Subject: build-sys: clean up flags included in the linker command line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the CFLAGS that are discovered during configure, for example compiler warnings, are being included on the linker command line because QEMU_CFLAGS is added to it. Other flags, such as the -m32, appear twice because they are included in both QEMU_CFLAGS and LDFLAGS. All this leads to confusion with respect to what goes in which Makefile variables (and we have plenty). So, introduce QEMU_LDFLAGS for flags discovered by configure, following the lead of QEMU_CFLAGS, and stop adding to it: 1) options that are already in CFLAGS, for example "-g" 2) duplicate options At the same time, options that _are_ needed by both compiler and linker must now be added to both QEMU_CFLAGS and QEMU_LDFLAGS, which is clearer. This is mostly -fsanitize options. For now, --extra-cflags has this behavior (but --extra-cxxflags does not). Meson will not include CFLAGS on the linker command line, do the same in our build system as well. Signed-off-by: Marc-André Lureau Signed-off-by: Paolo Bonzini --- qga/vss-win32/Makefile.objs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qga') diff --git a/qga/vss-win32/Makefile.objs b/qga/vss-win32/Makefile.objs index fd3ba18..c82676a 100644 --- a/qga/vss-win32/Makefile.objs +++ b/qga/vss-win32/Makefile.objs @@ -5,9 +5,9 @@ qga-vss-dll-obj-y += requester.o provider.o install.o obj-qga-vss-dll-obj-y = $(addprefix $(obj)/, $(qga-vss-dll-obj-y)) $(obj-qga-vss-dll-obj-y): QEMU_CXXFLAGS := $(filter-out -fstack-protector-all -fstack-protector-strong, $(QEMU_CXXFLAGS)) -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor -$(obj)/qga-vss.dll: LDFLAGS = -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup -lglib-2.0 -lole32 -loleaut32 -lshlwapi -luuid -lintl -lws2_32 -static +QGA_VSS_LDFLAGS = -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup -lglib-2.0 -lole32 -loleaut32 -lshlwapi -luuid -lintl -lws2_32 -static $(obj)/qga-vss.dll: $(obj-qga-vss-dll-obj-y) $(SRC_PATH)/$(obj)/qga-vss.def - $(call quiet-command,$(CXX) -o $@ $(qga-vss-dll-obj-y) $(SRC_PATH)/qga/vss-win32/qga-vss.def $(CXXFLAGS) $(LDFLAGS),"LINK","$(TARGET_DIR)$@") + $(call quiet-command,$(CXX) -o $@ $(qga-vss-dll-obj-y) $(SRC_PATH)/qga/vss-win32/qga-vss.def $(CXXFLAGS) $(QGA_VSS_LDFLAGS),"LINK","$(TARGET_DIR)$@") # rules to build qga-provider.tlb -- cgit v1.1