qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/8] convert libqemuutil to meson


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 4/8] convert libqemuutil to meson
Date: Mon, 29 Jul 2019 09:09:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Peter Maydell <address@hidden> writes:

> On Sat, 27 Jul 2019 at 13:24, Paolo Bonzini <address@hidden> wrote:
>>
>> On 27/07/19 09:16, Markus Armbruster wrote:
>> > We started with a single trace-events.  That wasn't good, so we split it
>> > up into one per directory.  That isn't good, so what about splitting it
>> > up into one per source file?  Pass -DTRACE_HEADER='"trace-DIR-FOO.h"
>> > instead of -DTRACE_HEADER='"trace-DIR.h"' when compiling DIR/FOO.c.
>>
>> For Make this would all work great, however not for Meson because it
>> doesn't allow per-file compile flags.
>
> Apologies for randomly parachuting into this email thread, but if
> Meson doesn't support per-file compile flags then what's the plan
> for handling the cases where we currently need per-file compile flags ?
> (This is one of the things that I thought was quite a nice move
> forward in our make infrastructure -- we now have clean syntax
> for saying "these files need to be built with these warnings disabled
> or these extra include paths or whatever" and also "these files
> imply we're going to need to link against library X".)

I vaguely remember from my review that Meson lets us express "these
files imply we're going to need to link against library X" even more
clearly.  I can't point you to an example, though.

Aside: I can't apply this series anymore.  I tried master, failed, tried
a merge commit shortly before its posting date, failed, gave up.  Can I
git-pull it from somewhere?

Losing the ability to add compiler flags per file with minimal fuss
would be regrettable.  How regrettable?  I append results of a quick
grep.

>> Meson maintainers suggest building a static library for each special set
>> of compile flags; we could do that automatically per-directory(*) but it
>> would be harder to scale that to per-file.

This is clearly not "minimal fuss", not even per directory, let alone
per file.

It's pretty lame even for the large sets we have (per target,
target-independent): I guess we'd either throw away the .a unused, or
link with --wholearchive.

The grep below shows multiple instances of per-file.

We should explore how to handle typical instances before we commit to
the conversion project.

>> (*) Still, I'd rather go on with the forwarding headers and look into
>> that later, to ease review.

For me, forwarding headers are just fine for a PoC, quite tolerable
while a conversion is in progress, and perhaps even tolerable as a
permanent work-around.  My *actual* question is how we could do per-file
rather than per-directory trace.h with Meson.  Quoting myself:

    We have trace-events with hundreds of tracepoints for tens of source
    files.  The generated trace.h clock in at hundreds of KiB for me.
    Messing with tracepoints in one source file recompiles most of the
    directory.  This is so much better than it used to be, but clearly not
    as good as it could be.

    The worst of the lot is trace-root.h, which gets included for >1300 .o
    in my "build everything" tree, mostly because it contains tracepoints
    for static inline functions in widely included headers.  See also
    "[PATCH 07/28] trace: Do not include qom/cpu.h into generated trace.h",
    Message-Id: <address@hidden>.

    We started with a single trace-events.  That wasn't good, so we split it
    up into one per directory.  That isn't good, so what about splitting it
    up into one per source file?

Any ideas?


$ git-grep -F o-cflags
Makefile.objs:bt-host.o-cflags := $(BLUEZ_CFLAGS)
Makefile.objs:vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS)
Makefile.objs:qemu-seccomp.o-cflags := $(SECCOMP_CFLAGS)
Makefile.objs:vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS)
audio/Makefile.objs:sdl.mo-cflags := $(SDL_CFLAGS)
block/Makefile.objs:iscsi.o-cflags     := $(LIBISCSI_CFLAGS)
block/Makefile.objs:curl.o-cflags      := $(CURL_CFLAGS)
block/Makefile.objs:rbd.o-cflags       := $(RBD_CFLAGS)
block/Makefile.objs:gluster.o-cflags   := $(GLUSTERFS_CFLAGS)
block/Makefile.objs:ssh.o-cflags       := $(LIBSSH_CFLAGS)
block/Makefile.objs:parallels.o-cflags := $(LIBXML2_CFLAGS)
chardev/Makefile.objs:baum.o-cflags := $(SDL_CFLAGS)
contrib/vhost-user-gpu/Makefile.objs:main.o-cflags := $(PIXMAN_CFLAGS) 
$(GBM_CFLAGS)
contrib/vhost-user-gpu/Makefile.objs:virgl.o-cflags := $(VIRGL_CFLAGS) 
$(GBM_CFLAGS)
contrib/vhost-user-gpu/Makefile.objs:vugbm.o-cflags := $(GBM_CFLAGS)
disas/Makefile.objs:arm-a64.o-cflags := -I$(libvixldir) -Wno-sign-compare
docs/devel/build-system.txt:  curl.o-cflags      := $(CURL_CFLAGS)
docs/devel/build-system.txt:  iscsi.o-cflags     := $(LIBISCSI_CFLAGS)
docs/devel/build-system.txt:  curl.o-cflags      := $(CURL_CFLAGS)
hw/display/Makefile.objs:milkymist-tmu2.o-cflags := $(X11_CFLAGS) 
$(OPENGL_CFLAGS)
hw/display/Makefile.objs:virtio-gpu.o-cflags := $(VIRGL_CFLAGS)
hw/display/Makefile.objs:virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS)
hw/usb/Makefile.objs:smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
hw/usb/Makefile.objs:redirect.o-cflags = $(USB_REDIR_CFLAGS)
hw/usb/Makefile.objs:host-libusb.o-cflags := $(LIBUSB_CFLAGS)
hw/usb/Makefile.objs:xen-usb.o-cflags := $(LIBUSB_CFLAGS)
net/Makefile.objs:slirp.o-cflags := $(SLIRP_CFLAGS)
rules.mak:            $(if $($o-cflags), $o-cflags $(eval save-vars-$o-cflags 
:= $($o-cflags))$(eval $o-cflags := )) \
rules.mak:            $(if $($o-cflags),
rules.mak:                $(eval $1$o-cflags := $($o-cflags)))
rules.mak:        # Pass the .mo-cflags and .mo-libs along to its member objects
rules.mak:                $(if $($o-cflags), $(eval $p-cflags += $($o-cflags)))
target/unicore32/Makefile.objs:helper.o-cflags := $(CURSES_CFLAGS)
tests/Makefile.include:tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
tests/Makefile.include:tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
tests/Makefile.include:tests/test-crypto-tlscredsx509.o-cflags := 
$(TASN1_CFLAGS)
tests/Makefile.include:tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
ui/Makefile.objs:sdl.mo-cflags := $(SDL_CFLAGS)
ui/Makefile.objs:gtk.mo-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
ui/Makefile.objs:x_keymap.o-cflags := $(X11_CFLAGS)
ui/Makefile.objs:curses.mo-cflags := $(CURSES_CFLAGS) $(ICONV_CFLAGS)
ui/Makefile.objs:spice-app.mo-cflags := $(GIO_CFLAGS)
$ git-grep ':[^=].*CFLAGS'
Makefile:qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
Makefile:qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
configure:# Note: the prototype is needed since QEMU_CFLAGS
pc-bios/s390-ccw/netboot.mak:$(NETOBJS): QEMU_CFLAGS += $(LIBC_INC) 
$(LIBNET_INC)
rules.mak:module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS)
rules.mak:# Usage: CFLAGS+=$(call cc-option, -falign-functions=0, 
-malign-functions=0)
rules.mak:                   $(eval $($o-objs): CFLAGS += $(DSO_OBJ_CFLAGS))
target/nios2/Makefile.objs:$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
tests/tcg/aarch64/Makefile.softmmu-target:memory: CFLAGS+=-DCHECK_UNALIGNED=1
tests/tcg/alpha/Makefile.softmmu-target:memory: CFLAGS+=-DCHECK_UNALIGNED=0
tests/tcg/alpha/Makefile.target:test-cmov: EXTRA_CFLAGS=-DTEST_CMOV
tests/tcg/arm/Makefile.softmmu-target:test-armv6m-undef: 
EXTRA_CFLAGS+=-mcpu=cortex-m0
tests/tcg/arm/Makefile.target:hello-arm: CFLAGS+=-marm -ffreestanding
tests/tcg/arm/Makefile.target:test-arm-iwmmxt: CFLAGS+=-marm -march=iwmmxt 
-mabi=aapcs -mfpu=fpv4-sp-d16
tests/tcg/arm/Makefile.target:# fcvt: CFLAGS+=-march=armv8.2-a+fp16 
-mfpu=neon-fp-armv8
tests/tcg/i386/Makefile.softmmu-target:memory: CFLAGS+=-DCHECK_UNALIGNED=1
tests/tcg/i386/Makefile.target:hello-i386: CFLAGS+=-ffreestanding
tests/tcg/mips/Makefile.target:hello-mips: CFLAGS+=-mno-abicalls -fno-PIC 
-mabi=32



reply via email to

[Prev in Thread] Current Thread [Next in Thread]