[PATCH v2 01/15] meson: *-user: only descend into *-user when configured

Warner Losh posted 15 patches 4 years, 4 months ago
[PATCH v2 01/15] meson: *-user: only descend into *-user when configured
Posted by Warner Losh 4 years, 4 months ago
To increase flexibility, only descend into *-user when that is
configured. This allows *-user to selectively include directories based
on the host OS which may not exist on all hosts. Adopt Paolo's
suggestion of checking the configuration in the directories that know
about the configuration.

Message-Id: <20210926220103.1721355-2-f4bug@amsat.org>
Message-Id: <20210926220103.1721355-3-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Warner Losh <wlosh@bsdimp.com>
Acked-by: Paolo Bonzini <pbonzinni@redhat.com>

Sponsored by:		Netflix
---
 bsd-user/meson.build   | 4 ++++
 linux-user/meson.build | 4 ++++
 meson.build            | 3 +--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/bsd-user/meson.build b/bsd-user/meson.build
index 0369549340..243fb78930 100644
--- a/bsd-user/meson.build
+++ b/bsd-user/meson.build
@@ -1,3 +1,7 @@
+if not config_target.has_key('CONFIG_BSD_USER')
+   subdir_done()
+endif
+
 bsd_user_ss.add(files(
   'bsdload.c',
   'elfload.c',
diff --git a/linux-user/meson.build b/linux-user/meson.build
index 9549f81682..602255a3d6 100644
--- a/linux-user/meson.build
+++ b/linux-user/meson.build
@@ -1,3 +1,7 @@
+if not config_target.has_key('CONFIG_LINUX_USER')
+   subdir_done()
+endif
+
 linux_user_ss.add(files(
   'elfload.c',
   'exit.c',
diff --git a/meson.build b/meson.build
index 99a0a3e689..1f2da5f7d9 100644
--- a/meson.build
+++ b/meson.build
@@ -2303,10 +2303,9 @@ subdir('ebpf')
 
 common_ss.add(libbpf)
 
-bsd_user_ss.add(files('gdbstub.c'))
 specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
 
-linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
+linux_user_ss.add(files('thunk.c'))
 specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
 
 # needed for fuzzing binaries
-- 
2.32.0


Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured
Posted by Kyle Evans 4 years, 3 months ago
On Fri, Oct 8, 2021 at 6:15 PM Warner Losh <imp@bsdimp.com> wrote:
>
> To increase flexibility, only descend into *-user when that is
> configured. This allows *-user to selectively include directories based
> on the host OS which may not exist on all hosts. Adopt Paolo's
> suggestion of checking the configuration in the directories that know
> about the configuration.
>
> Message-Id: <20210926220103.1721355-2-f4bug@amsat.org>
> Message-Id: <20210926220103.1721355-3-f4bug@amsat.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Signed-off-by: Warner Losh <wlosh@bsdimp.com>
> Acked-by: Paolo Bonzini <pbonzinni@redhat.com>
>
> Sponsored by:           Netflix
> ---
>  bsd-user/meson.build   | 4 ++++
>  linux-user/meson.build | 4 ++++
>  meson.build            | 3 +--
>  3 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/bsd-user/meson.build b/bsd-user/meson.build
> index 0369549340..243fb78930 100644
> --- a/bsd-user/meson.build
> +++ b/bsd-user/meson.build
> @@ -1,3 +1,7 @@
> +if not config_target.has_key('CONFIG_BSD_USER')
> +   subdir_done()
> +endif
> +
>  bsd_user_ss.add(files(
>    'bsdload.c',
>    'elfload.c',
> diff --git a/linux-user/meson.build b/linux-user/meson.build
> index 9549f81682..602255a3d6 100644
> --- a/linux-user/meson.build
> +++ b/linux-user/meson.build
> @@ -1,3 +1,7 @@
> +if not config_target.has_key('CONFIG_LINUX_USER')
> +   subdir_done()
> +endif
> +
>  linux_user_ss.add(files(
>    'elfload.c',
>    'exit.c',
> diff --git a/meson.build b/meson.build
> index 99a0a3e689..1f2da5f7d9 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2303,10 +2303,9 @@ subdir('ebpf')
>
>  common_ss.add(libbpf)
>
> -bsd_user_ss.add(files('gdbstub.c'))
>  specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
>
> -linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
> +linux_user_ss.add(files('thunk.c'))
>  specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
>
>  # needed for fuzzing binaries
> --
> 2.32.0
>

I don't understand the gdbstub.c removal  here; don't we still want to
be compiling it in, just only if the appropriate
CONFIG_{BSD,LINUX}_USER knob is set? I note that it doesn't appear to
be added in individual *-user/meson.build, I assume it's uncommon to
add in ../foo.c in meson-land...

Thanks,

Kyle Evans

Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured
Posted by Warner Losh 4 years, 3 months ago
On Sun, Oct 17, 2021 at 9:43 PM Kyle Evans <kevans@freebsd.org> wrote:

> On Fri, Oct 8, 2021 at 6:15 PM Warner Losh <imp@bsdimp.com> wrote:
> >
> > To increase flexibility, only descend into *-user when that is
> > configured. This allows *-user to selectively include directories based
> > on the host OS which may not exist on all hosts. Adopt Paolo's
> > suggestion of checking the configuration in the directories that know
> > about the configuration.
> >
> > Message-Id: <20210926220103.1721355-2-f4bug@amsat.org>
> > Message-Id: <20210926220103.1721355-3-f4bug@amsat.org>
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > Signed-off-by: Warner Losh <wlosh@bsdimp.com>
> > Acked-by: Paolo Bonzini <pbonzinni@redhat.com>
> >
> > Sponsored by:           Netflix
> > ---
> >  bsd-user/meson.build   | 4 ++++
> >  linux-user/meson.build | 4 ++++
> >  meson.build            | 3 +--
> >  3 files changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/bsd-user/meson.build b/bsd-user/meson.build
> > index 0369549340..243fb78930 100644
> > --- a/bsd-user/meson.build
> > +++ b/bsd-user/meson.build
> > @@ -1,3 +1,7 @@
> > +if not config_target.has_key('CONFIG_BSD_USER')
> > +   subdir_done()
> > +endif
> > +
> >  bsd_user_ss.add(files(
> >    'bsdload.c',
> >    'elfload.c',
> > diff --git a/linux-user/meson.build b/linux-user/meson.build
> > index 9549f81682..602255a3d6 100644
> > --- a/linux-user/meson.build
> > +++ b/linux-user/meson.build
> > @@ -1,3 +1,7 @@
> > +if not config_target.has_key('CONFIG_LINUX_USER')
> > +   subdir_done()
> > +endif
> > +
> >  linux_user_ss.add(files(
> >    'elfload.c',
> >    'exit.c',
> > diff --git a/meson.build b/meson.build
> > index 99a0a3e689..1f2da5f7d9 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -2303,10 +2303,9 @@ subdir('ebpf')
> >
> >  common_ss.add(libbpf)
> >
> > -bsd_user_ss.add(files('gdbstub.c'))
> >  specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
> >
> > -linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
> > +linux_user_ss.add(files('thunk.c'))
> >  specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
> >
> >  # needed for fuzzing binaries
> > --
> > 2.32.0
> >
>
> I don't understand the gdbstub.c removal  here; don't we still want to
> be compiling it in, just only if the appropriate
> CONFIG_{BSD,LINUX}_USER knob is set? I note that it doesn't appear to
> be added in individual *-user/meson.build, I assume it's uncommon to
> add in ../foo.c in meson-land...
>

It's added to specific_ss at line 2536
specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone)

so we don't need to add it again here.

Warner
Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured
Posted by Warner Losh 4 years, 3 months ago
On Sun, Oct 17, 2021 at 10:29 PM Warner Losh <imp@bsdimp.com> wrote:

>
>
> On Sun, Oct 17, 2021 at 9:43 PM Kyle Evans <kevans@freebsd.org> wrote:
>
>> On Fri, Oct 8, 2021 at 6:15 PM Warner Losh <imp@bsdimp.com> wrote:
>> >
>> > To increase flexibility, only descend into *-user when that is
>> > configured. This allows *-user to selectively include directories based
>> > on the host OS which may not exist on all hosts. Adopt Paolo's
>> > suggestion of checking the configuration in the directories that know
>> > about the configuration.
>> >
>> > Message-Id: <20210926220103.1721355-2-f4bug@amsat.org>
>> > Message-Id: <20210926220103.1721355-3-f4bug@amsat.org>
>> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> > Signed-off-by: Warner Losh <wlosh@bsdimp.com>
>> > Acked-by: Paolo Bonzini <pbonzinni@redhat.com>
>> >
>> > Sponsored by:           Netflix
>> > ---
>> >  bsd-user/meson.build   | 4 ++++
>> >  linux-user/meson.build | 4 ++++
>> >  meson.build            | 3 +--
>> >  3 files changed, 9 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/bsd-user/meson.build b/bsd-user/meson.build
>> > index 0369549340..243fb78930 100644
>> > --- a/bsd-user/meson.build
>> > +++ b/bsd-user/meson.build
>> > @@ -1,3 +1,7 @@
>> > +if not config_target.has_key('CONFIG_BSD_USER')
>> > +   subdir_done()
>> > +endif
>> > +
>> >  bsd_user_ss.add(files(
>> >    'bsdload.c',
>> >    'elfload.c',
>> > diff --git a/linux-user/meson.build b/linux-user/meson.build
>> > index 9549f81682..602255a3d6 100644
>> > --- a/linux-user/meson.build
>> > +++ b/linux-user/meson.build
>> > @@ -1,3 +1,7 @@
>> > +if not config_target.has_key('CONFIG_LINUX_USER')
>> > +   subdir_done()
>> > +endif
>> > +
>> >  linux_user_ss.add(files(
>> >    'elfload.c',
>> >    'exit.c',
>> > diff --git a/meson.build b/meson.build
>> > index 99a0a3e689..1f2da5f7d9 100644
>> > --- a/meson.build
>> > +++ b/meson.build
>> > @@ -2303,10 +2303,9 @@ subdir('ebpf')
>> >
>> >  common_ss.add(libbpf)
>> >
>> > -bsd_user_ss.add(files('gdbstub.c'))
>> >  specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
>> >
>> > -linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
>> > +linux_user_ss.add(files('thunk.c'))
>> >  specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
>> >
>> >  # needed for fuzzing binaries
>> > --
>> > 2.32.0
>> >
>>
>> I don't understand the gdbstub.c removal  here; don't we still want to
>> be compiling it in, just only if the appropriate
>> CONFIG_{BSD,LINUX}_USER knob is set? I note that it doesn't appear to
>> be added in individual *-user/meson.build, I assume it's uncommon to
>> add in ../foo.c in meson-land...
>>
>
> It's added to specific_ss at line 2536
> specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone)
>
> so we don't need to add it again here.
>

I've also confirmed that it's built as both
libqemu-i386-bsd-user.fa.p/gdbstub.c.o
and libqemu-x86_64-bsd-user.fa.p/gdbstub.c.o, which is what I'd expect given
the current upstream supported architectures are only i386 and x86_64.

Warner
Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured
Posted by Kyle Evans 4 years, 3 months ago
On Mon, Oct 18, 2021 at 12:02 AM Warner Losh <imp@bsdimp.com> wrote:
>
>
>
> On Sun, Oct 17, 2021 at 10:29 PM Warner Losh <imp@bsdimp.com> wrote:
>>
>>
>>
>> On Sun, Oct 17, 2021 at 9:43 PM Kyle Evans <kevans@freebsd.org> wrote:
>>>
>>> On Fri, Oct 8, 2021 at 6:15 PM Warner Losh <imp@bsdimp.com> wrote:
>>> >
>>> > To increase flexibility, only descend into *-user when that is
>>> > configured. This allows *-user to selectively include directories based
>>> > on the host OS which may not exist on all hosts. Adopt Paolo's
>>> > suggestion of checking the configuration in the directories that know
>>> > about the configuration.
>>> >
>>> > Message-Id: <20210926220103.1721355-2-f4bug@amsat.org>
>>> > Message-Id: <20210926220103.1721355-3-f4bug@amsat.org>
>>> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> > Signed-off-by: Warner Losh <wlosh@bsdimp.com>
>>> > Acked-by: Paolo Bonzini <pbonzinni@redhat.com>
>>> >
>>> > Sponsored by:           Netflix
>>> > ---
>>> >  bsd-user/meson.build   | 4 ++++
>>> >  linux-user/meson.build | 4 ++++
>>> >  meson.build            | 3 +--
>>> >  3 files changed, 9 insertions(+), 2 deletions(-)
>>> >
>>> > diff --git a/bsd-user/meson.build b/bsd-user/meson.build
>>> > index 0369549340..243fb78930 100644
>>> > --- a/bsd-user/meson.build
>>> > +++ b/bsd-user/meson.build
>>> > @@ -1,3 +1,7 @@
>>> > +if not config_target.has_key('CONFIG_BSD_USER')
>>> > +   subdir_done()
>>> > +endif
>>> > +
>>> >  bsd_user_ss.add(files(
>>> >    'bsdload.c',
>>> >    'elfload.c',
>>> > diff --git a/linux-user/meson.build b/linux-user/meson.build
>>> > index 9549f81682..602255a3d6 100644
>>> > --- a/linux-user/meson.build
>>> > +++ b/linux-user/meson.build
>>> > @@ -1,3 +1,7 @@
>>> > +if not config_target.has_key('CONFIG_LINUX_USER')
>>> > +   subdir_done()
>>> > +endif
>>> > +
>>> >  linux_user_ss.add(files(
>>> >    'elfload.c',
>>> >    'exit.c',
>>> > diff --git a/meson.build b/meson.build
>>> > index 99a0a3e689..1f2da5f7d9 100644
>>> > --- a/meson.build
>>> > +++ b/meson.build
>>> > @@ -2303,10 +2303,9 @@ subdir('ebpf')
>>> >
>>> >  common_ss.add(libbpf)
>>> >
>>> > -bsd_user_ss.add(files('gdbstub.c'))
>>> >  specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
>>> >
>>> > -linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
>>> > +linux_user_ss.add(files('thunk.c'))
>>> >  specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
>>> >
>>> >  # needed for fuzzing binaries
>>> > --
>>> > 2.32.0
>>> >
>>>
>>> I don't understand the gdbstub.c removal  here; don't we still want to
>>> be compiling it in, just only if the appropriate
>>> CONFIG_{BSD,LINUX}_USER knob is set? I note that it doesn't appear to
>>> be added in individual *-user/meson.build, I assume it's uncommon to
>>> add in ../foo.c in meson-land...
>>
>>
>> It's added to specific_ss at line 2536
>> specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone)
>>
>> so we don't need to add it again here.
>
>
> I've also confirmed that it's built as both libqemu-i386-bsd-user.fa.p/gdbstub.c.o
> and libqemu-x86_64-bsd-user.fa.p/gdbstub.c.o, which is what I'd expect given
> the current upstream supported architectures are only i386 and x86_64.
>
> Warner

Ah, ok, thanks! So that looks like a kind-of tangential cleanup, but
related enough that it makes sense.

Reviewed-by: Kyle Evans <kevans@FreeBSD.org>

Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured
Posted by Warner Losh 4 years, 3 months ago
On Sun, Oct 17, 2021 at 11:26 PM Kyle Evans <kevans@freebsd.org> wrote:

> On Mon, Oct 18, 2021 at 12:02 AM Warner Losh <imp@bsdimp.com> wrote:
> >
> >
> >
> > On Sun, Oct 17, 2021 at 10:29 PM Warner Losh <imp@bsdimp.com> wrote:
> >>
> >>
> >>
> >> On Sun, Oct 17, 2021 at 9:43 PM Kyle Evans <kevans@freebsd.org> wrote:
> >>>
> >>> On Fri, Oct 8, 2021 at 6:15 PM Warner Losh <imp@bsdimp.com> wrote:
> >>> >
> >>> > To increase flexibility, only descend into *-user when that is
> >>> > configured. This allows *-user to selectively include directories
> based
> >>> > on the host OS which may not exist on all hosts. Adopt Paolo's
> >>> > suggestion of checking the configuration in the directories that know
> >>> > about the configuration.
> >>> >
> >>> > Message-Id: <20210926220103.1721355-2-f4bug@amsat.org>
> >>> > Message-Id: <20210926220103.1721355-3-f4bug@amsat.org>
> >>> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> >>> > Signed-off-by: Warner Losh <wlosh@bsdimp.com>
> >>> > Acked-by: Paolo Bonzini <pbonzinni@redhat.com>
> >>> >
> >>> > Sponsored by:           Netflix
> >>> > ---
> >>> >  bsd-user/meson.build   | 4 ++++
> >>> >  linux-user/meson.build | 4 ++++
> >>> >  meson.build            | 3 +--
> >>> >  3 files changed, 9 insertions(+), 2 deletions(-)
> >>> >
> >>> > diff --git a/bsd-user/meson.build b/bsd-user/meson.build
> >>> > index 0369549340..243fb78930 100644
> >>> > --- a/bsd-user/meson.build
> >>> > +++ b/bsd-user/meson.build
> >>> > @@ -1,3 +1,7 @@
> >>> > +if not config_target.has_key('CONFIG_BSD_USER')
> >>> > +   subdir_done()
> >>> > +endif
> >>> > +
> >>> >  bsd_user_ss.add(files(
> >>> >    'bsdload.c',
> >>> >    'elfload.c',
> >>> > diff --git a/linux-user/meson.build b/linux-user/meson.build
> >>> > index 9549f81682..602255a3d6 100644
> >>> > --- a/linux-user/meson.build
> >>> > +++ b/linux-user/meson.build
> >>> > @@ -1,3 +1,7 @@
> >>> > +if not config_target.has_key('CONFIG_LINUX_USER')
> >>> > +   subdir_done()
> >>> > +endif
> >>> > +
> >>> >  linux_user_ss.add(files(
> >>> >    'elfload.c',
> >>> >    'exit.c',
> >>> > diff --git a/meson.build b/meson.build
> >>> > index 99a0a3e689..1f2da5f7d9 100644
> >>> > --- a/meson.build
> >>> > +++ b/meson.build
> >>> > @@ -2303,10 +2303,9 @@ subdir('ebpf')
> >>> >
> >>> >  common_ss.add(libbpf)
> >>> >
> >>> > -bsd_user_ss.add(files('gdbstub.c'))
> >>> >  specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
> >>> >
> >>> > -linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
> >>> > +linux_user_ss.add(files('thunk.c'))
> >>> >  specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true:
> linux_user_ss)
> >>> >
> >>> >  # needed for fuzzing binaries
> >>> > --
> >>> > 2.32.0
> >>> >
> >>>
> >>> I don't understand the gdbstub.c removal  here; don't we still want to
> >>> be compiling it in, just only if the appropriate
> >>> CONFIG_{BSD,LINUX}_USER knob is set? I note that it doesn't appear to
> >>> be added in individual *-user/meson.build, I assume it's uncommon to
> >>> add in ../foo.c in meson-land...
> >>
> >>
> >> It's added to specific_ss at line 2536
> >> specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone)
> >>
> >> so we don't need to add it again here.
> >
> >
> > I've also confirmed that it's built as both
> libqemu-i386-bsd-user.fa.p/gdbstub.c.o
> > and libqemu-x86_64-bsd-user.fa.p/gdbstub.c.o, which is what I'd expect
> given
> > the current upstream supported architectures are only i386 and x86_64.
> >
> > Warner
>
> Ah, ok, thanks! So that looks like a kind-of tangential cleanup, but
> related enough that it makes sense.
>

Yes. Paolo suggested it to further clean things up. Plus it had to be done
at the top level of meson.build rather than the subdirectories because
that's where gdbstub.c lived. I had to also introduce the have_bsd_user
and have_linux_user variables because we had to note that in one context
and use it in another context where the info was otherwise hard to get
at from Philippe's original patch.


> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
>

Thanks!

Warner
Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured
Posted by Philippe Mathieu-Daudé 4 years, 3 months ago
On 10/9/21 01:14, Warner Losh wrote:
> To increase flexibility, only descend into *-user when that is
> configured. This allows *-user to selectively include directories based
> on the host OS which may not exist on all hosts. Adopt Paolo's
> suggestion of checking the configuration in the directories that know
> about the configuration.
> 
> Message-Id: <20210926220103.1721355-2-f4bug@amsat.org>
> Message-Id: <20210926220103.1721355-3-f4bug@amsat.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Signed-off-by: Warner Losh <wlosh@bsdimp.com>
> Acked-by: Paolo Bonzini <pbonzinni@redhat.com>
> 
> Sponsored by:		Netflix
> ---
>  bsd-user/meson.build   | 4 ++++
>  linux-user/meson.build | 4 ++++
>  meson.build            | 3 +--
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/bsd-user/meson.build b/bsd-user/meson.build
> index 0369549340..243fb78930 100644
> --- a/bsd-user/meson.build
> +++ b/bsd-user/meson.build
> @@ -1,3 +1,7 @@
> +if not config_target.has_key('CONFIG_BSD_USER')
> +   subdir_done()
> +endif
> +
>  bsd_user_ss.add(files(
>    'bsdload.c',
>    'elfload.c',
> diff --git a/linux-user/meson.build b/linux-user/meson.build
> index 9549f81682..602255a3d6 100644
> --- a/linux-user/meson.build
> +++ b/linux-user/meson.build
> @@ -1,3 +1,7 @@
> +if not config_target.has_key('CONFIG_LINUX_USER')
> +   subdir_done()
> +endif
> +
>  linux_user_ss.add(files(
>    'elfload.c',
>    'exit.c',
> diff --git a/meson.build b/meson.build
> index 99a0a3e689..1f2da5f7d9 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2303,10 +2303,9 @@ subdir('ebpf')
>  
>  common_ss.add(libbpf)
>  
> -bsd_user_ss.add(files('gdbstub.c'))
>  specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
>  
> -linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
> +linux_user_ss.add(files('thunk.c'))
>  specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
>  
>  # needed for fuzzing binaries
> 

Thanks Warner for respining this! LGTM :)

Re: [PATCH v2 01/15] meson: *-user: only descend into *-user when configured
Posted by Warner Losh 4 years, 4 months ago
(looks like Paolo's email bounced, so try again with cut and paste)

On Fri, Oct 8, 2021 at 5:15 PM Warner Losh <imp@bsdimp.com> wrote:

> To increase flexibility, only descend into *-user when that is
> configured. This allows *-user to selectively include directories based
> on the host OS which may not exist on all hosts. Adopt Paolo's
> suggestion of checking the configuration in the directories that know
> about the configuration.
>
> Message-Id: <20210926220103.1721355-2-f4bug@amsat.org>
> Message-Id: <20210926220103.1721355-3-f4bug@amsat.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Signed-off-by: Warner Losh <wlosh@bsdimp.com>
> Acked-by: Paolo Bonzini <pbonzinni@redhat.com>
>
> Sponsored by:           Netflix
> ---
>  bsd-user/meson.build   | 4 ++++
>  linux-user/meson.build | 4 ++++
>  meson.build            | 3 +--
>  3 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/bsd-user/meson.build b/bsd-user/meson.build
> index 0369549340..243fb78930 100644
> --- a/bsd-user/meson.build
> +++ b/bsd-user/meson.build
> @@ -1,3 +1,7 @@
> +if not config_target.has_key('CONFIG_BSD_USER')
> +   subdir_done()
> +endif
> +
>  bsd_user_ss.add(files(
>    'bsdload.c',
>    'elfload.c',
> diff --git a/linux-user/meson.build b/linux-user/meson.build
> index 9549f81682..602255a3d6 100644
> --- a/linux-user/meson.build
> +++ b/linux-user/meson.build
> @@ -1,3 +1,7 @@
> +if not config_target.has_key('CONFIG_LINUX_USER')
> +   subdir_done()
> +endif
> +
>  linux_user_ss.add(files(
>    'elfload.c',
>    'exit.c',
> diff --git a/meson.build b/meson.build
> index 99a0a3e689..1f2da5f7d9 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2303,10 +2303,9 @@ subdir('ebpf')
>
>  common_ss.add(libbpf)
>
> -bsd_user_ss.add(files('gdbstub.c'))
>  specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
>
> -linux_user_ss.add(files('gdbstub.c', 'thunk.c'))
> +linux_user_ss.add(files('thunk.c'))
>  specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
>
>  # needed for fuzzing binaries
> --
> 2.32.0
>
>