Skip to contentSkip to conversation

system/meson: Restrict libSDL/libpmem/libdaxctl CPPFLAGS to vl/physmem

PATCH In review Philippe Mathieu-Daudé 4 participants 10 messages Dec 12, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover system/meson: Restrict libSDL/libpmem/libdaxctl CPPFLAGS to vl/physmem

Extracted from a huge branch where files are moved from specific_ss[] to system_ss[] after exec/ headers are reworked.

Philippe Mathieu-Daudé (2):
system: Restrict libSDL CPPFLAGS to vl.c
system: Restrict libpmem and libdaxctl CPPFLAGS to physmem.c

 system/meson.build | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH 1/2 system: Restrict libSDL CPPFLAGS to vl.c

Only vl.c includes libSDL headers.
No need to pass them to all system_ss[] files.

---
 system/meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
system/meson.build +4 -1
index 4952f4b2c7d..f7e2c8b826f 100644
@@ -23,8 +23,11 @@ system_ss.add(files(
   'runstate-hmp-cmds.c',
   'runstate.c',
   'tpm-hmp-cmds.c',
+), libpmem, libdaxctl)
+
+system_ss.add(files(
   'vl.c',
-), sdl, libpmem, libdaxctl)
+), sdl)
 
 if have_tpm
   system_ss.add(files('tpm.c'))
Signature · 1 line
2.45.2
#2 lore raw

Re: [PATCH 1/2] system: Restrict libSDL CPPFLAGS to vl.c

Quoted 15 lines · Philippe Mathieu-Daudé

Only vl.c includes libSDL headers.
No need to pass them to all system_ss[] files.

---
  system/meson.build | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
system/meson.build +0 -0
index 4952f4b2c7d..f7e2c8b826f 100644
@@ -23,8 +23,11 @@ system_ss.add(files(
    'runstate-hmp-cmds.c',
    'runstate.c',

system/meson.build system_ss.add(files( · line 33

Quoted 10 lines
system/meson.build +4 -1
    'tpm-hmp-cmds.c',
+), libpmem, libdaxctl)
+
+system_ss.add(files(
    'vl.c',
-), sdl, libpmem, libdaxctl)
+), sdl)
 
  if have_tpm
    system_ss.add(files('tpm.c'))

I'm sure Paolo will correct me, but I don't think this does what you think it does. I believe this has no change at all.

The presence of sdl within a *particular* source_set.add() call is immaterial. If the condition is true (and here, because the condition is missing it is true), all of the files and dependencies get lumped together. In the end, everything gets copied into common_ss.

Both of these patches only alters the order of the items in the link ordering.

r~

#3 lore raw

Re: [PATCH 1/2] system: Restrict libSDL CPPFLAGS to vl.c

Quoted 19 lines · Richard Henderson
Quoted 18 lines · Philippe Mathieu-Daudé

Only vl.c includes libSDL headers.
No need to pass them to all system_ss[] files.

---
  system/meson.build | 5 ++++-

  1 file changed, 4 insertions(+), 1 deletion(-)
system/meson.build +2 -0
index 4952f4b2c7d..f7e2c8b826f 100644
@@ -23,8 +23,11 @@ system_ss.add(files(
     'runstate-hmp-cmds.c',
     'runstate.c',
     'tpm-hmp-cmds.c',
+), libpmem, libdaxctl)
+
Quoted 8 lines
Quoted 6 lines
system/meson.build +2 -1
+system_ss.add(files(
     'vl.c',
-), sdl, libpmem, libdaxctl)
+), sdl)

  if have_tpm
    system_ss.add(files('tpm.c'))

I'm sure Paolo will correct me, but I don't think this does what you think it does.  I believe this has no change at all.

No need to correct anything! :)

Quoted 1 line

The presence of sdl within a *particular* source_set.add() call is immaterial.  If the condition is true (and here, because the condition is missing it is true), all of the files and dependencies get lumped together.  In the end, everything gets copied into common_ss.

Yep. You can have different flags, including library CFLAGS/CPPFLAGS, for specific vs system (the former ends up in the libqemu-*.a.p directory, vs libcommon.a.p for system), or for those sourcesets that are used also by user-mode emulation (IIRC libhwcore.a.p) or by tests (the various directories libio.a.p, libmigration.a.p). However, here there is no effect at all.

If you want to do this as a cleanup to keep the libraries close to their users, I have no objection, but please adjust the commit message and squash the two patches together.

Paolo

Quoted 7 lines

Both of these patches only alters the order of the items in the link ordering.

r~

#4 lore raw

PATCH 2/2 system: Restrict libpmem and libdaxctl CPPFLAGS to physmem.c

In reply to Philippe Mathieu-Daudé

Only physmem.c includes libpmem and libdaxctl headers. No need to pass them to all system_ss[] files.

---
 system/meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
system/meson.build +5 -2
index f7e2c8b826f..50d915bd80c 100644
@@ -2,10 +2,13 @@ specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
   'arch_init.c',
   'ioport.c',
   'memory.c',
-  'physmem.c',
   'watchpoint.c',
 )])
 
+specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
+  'physmem.c',
+), libpmem, libdaxctl])
+
 system_ss.add(files(
   'balloon.c',
   'bootdevice.c',
@@ -23,7 +26,7 @@ system_ss.add(files(
   'runstate-hmp-cmds.c',
   'runstate.c',
   'tpm-hmp-cmds.c',
-), libpmem, libdaxctl)
+))
 
 system_ss.add(files(
   'vl.c',
Signature · 1 line
2.45.2
#5 lore raw

Re: [PATCH 2/2] system: Restrict libpmem and libdaxctl CPPFLAGS to physmem.c

Quoted 2 lines · Philippe Mathieu-Daudé

Only physmem.c includes libpmem and libdaxctl headers. No need to pass them to all system_ss[] files.

I think doing this patch first would leave the other one unnecessary so you could do both in one patch with less churn and maybe reduce this series to a single patch.

Regards,
BALATON Zoltan

Quoted 34 lines

---
system/meson.build | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
system/meson.build +4 -1
index f7e2c8b826f..50d915bd80c 100644
@@ -2,10 +2,13 @@ specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
  'arch_init.c',
  'ioport.c',
  'memory.c',
-  'physmem.c',
  'watchpoint.c',
 )])
 
+specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
+  'physmem.c',
+), libpmem, libdaxctl])
+

system_ss.add(files(
'balloon.c',
'bootdevice.c',

system/meson.build +1 -1
@@ -23,7 +26,7 @@ system_ss.add(files(
  'runstate-hmp-cmds.c',
  'runstate.c',
  'tpm-hmp-cmds.c',
-), libpmem, libdaxctl)
+))
 

system_ss.add(files(
'vl.c',

#6 lore raw

Re: [PATCH 2/2] system: Restrict libpmem and libdaxctl CPPFLAGS to physmem.c

Quoted 5 lines · BALATON Zoltan
Quoted 2 lines · Philippe Mathieu-Daudé

Only physmem.c includes libpmem and libdaxctl headers. No need to pass them to all system_ss[] files.

I think doing this patch first would leave the other one unnecessary so

This one is about libpmem / libdaxctl in physmem.c, the previous one is about libsdl in vl.c. I'm missing what inverting the order would change.

Besides in 2 patches it is simpler to check what CPPFLAGS are applied.

Anyhow if you insist, I can squash. I don't care much as long as we reduce the flags applied to system_ss[].

Quoted 40 lines

you could do both in one patch with less churn and maybe reduce this series to a single patch.

Regards,
BALATON Zoltan

Quoted 35 lines

---
system/meson.build | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
system/meson.build +0 -0
index f7e2c8b826f..50d915bd80c 100644
@@ -2,10 +2,13 @@ specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: 

[files(
  'arch_init.c',
  'ioport.c',
  'memory.c',
-  'physmem.c',
  'watchpoint.c',
)])

system/meson.build +4 -0
+specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
+  'physmem.c',
+), libpmem, libdaxctl])
+

system_ss.add(files(
  'balloon.c',
  'bootdevice.c',

system/meson.build +1 -1
@@ -23,7 +26,7 @@ system_ss.add(files(
   'runstate-hmp-cmds.c',
   'runstate.c',
   'tpm-hmp-cmds.c',
-), libpmem, libdaxctl)
+))
 

system_ss.add(files(
  'vl.c',

#7 lore raw

Re: [PATCH 2/2] system: Restrict libpmem and libdaxctl CPPFLAGS to physmem.c

Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 5 lines · BALATON Zoltan
Quoted 2 lines · Philippe Mathieu-Daudé

Only physmem.c includes libpmem and libdaxctl headers. No need to pass them to all system_ss[] files.

I think doing this patch first would leave the other one unnecessary so

Quoted 7 lines

This one is about libpmem / libdaxctl in physmem.c, the previous one is about libsdl in vl.c. I'm missing what inverting the order would change.

Besides in 2 patches it is simpler to check what CPPFLAGS are applied.

Anyhow if you insist, I can squash. I don't care much as long as

s/care/mind/ ;)

Quoted 43 lines

we reduce the flags applied to system_ss[].

Quoted 40 lines

you could do both in one patch with less churn and maybe reduce this series to a single patch.

Regards,
BALATON Zoltan

Quoted 35 lines

---
system/meson.build | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
system/meson.build +0 -0
index f7e2c8b826f..50d915bd80c 100644
@@ -2,10 +2,13 @@ specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', 

if_true: [files(
  'arch_init.c',
  'ioport.c',
  'memory.c',
-  'physmem.c',
  'watchpoint.c',
)])

system/meson.build +4 -0
+specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
+  'physmem.c',
+), libpmem, libdaxctl])
+

system_ss.add(files(
  'balloon.c',
  'bootdevice.c',

system/meson.build +1 -1
@@ -23,7 +26,7 @@ system_ss.add(files(
   'runstate-hmp-cmds.c',
   'runstate.c',
   'tpm-hmp-cmds.c',
-), libpmem, libdaxctl)
+))
 

system_ss.add(files(
  'vl.c',

#8 lore raw

Re: [PATCH 2/2] system: Restrict libpmem and libdaxctl CPPFLAGS to physmem.c

In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 5 lines · BALATON Zoltan
Quoted 2 lines · Philippe Mathieu-Daudé

Only physmem.c includes libpmem and libdaxctl headers. No need to pass them to all system_ss[] files.

I think doing this patch first would leave the other one unnecessary so

This one is about libpmem / libdaxctl in physmem.c, the previous one is about libsdl in vl.c. I'm missing what inverting the order would change.

It seems odd to add the libpmem, libdaxctl libs to one set in the first patch then remove it right away in the next patch. Swapping patches would avoid that and move these to the final place without churn then the sdl change is simpler.

Quoted 4 lines

Besides in 2 patches it is simpler to check what CPPFLAGS are applied.

Anyhow if you insist, I can squash. I don't care much as long as we reduce the flags applied to system_ss[].

I don't insist and don't mind much either but I see others also suggested squashing patches so this will be resolved by that.

Regards,
BALATON Zoltan

Quoted 42 lines
Quoted 40 lines

you could do both in one patch with less churn and maybe reduce this series to a single patch.

Regards,
BALATON Zoltan

Quoted 35 lines

---
system/meson.build | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
system/meson.build +0 -0
index f7e2c8b826f..50d915bd80c 100644
@@ -2,10 +2,13 @@ specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: 

[files(
  'arch_init.c',
  'ioport.c',
  'memory.c',
-  'physmem.c',
  'watchpoint.c',
)])

system/meson.build +4 -0
+specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
+  'physmem.c',
+), libpmem, libdaxctl])
+

system_ss.add(files(
  'balloon.c',
  'bootdevice.c',

system/meson.build +1 -1
@@ -23,7 +26,7 @@ system_ss.add(files(
   'runstate-hmp-cmds.c',
   'runstate.c',
   'tpm-hmp-cmds.c',
-), libpmem, libdaxctl)
+))
 

system_ss.add(files(
  'vl.c',

#9 lore raw

Re: [PATCH 2/2] system: Restrict libpmem and libdaxctl CPPFLAGS to physmem.c

Quoted 12 lines · BALATON Zoltan
Quoted 10 lines · Philippe Mathieu-Daudé
Quoted 5 lines · BALATON Zoltan
Quoted 2 lines · Philippe Mathieu-Daudé

Only physmem.c includes libpmem and libdaxctl headers. No need to pass them to all system_ss[] files.

I think doing this patch first would leave the other one unnecessary so

This one is about libpmem / libdaxctl in physmem.c, the previous one is about libsdl in vl.c. I'm missing what inverting the order would change.

Quoted 8 lines

It seems odd to add the libpmem, libdaxctl libs to one set in the first patch then remove it right away in the next patch. Swapping patches would avoid that and move these to the final place without churn then the sdl change is simpler.

Quoted 4 lines

Besides in 2 patches it is simpler to check what CPPFLAGS are applied.

Anyhow if you insist, I can squash. I don't care much as long as we reduce the flags applied to system_ss[].

I don't insist and don't mind much either but I see others also suggested squashing patches so this will be resolved by that.

Nah, you are right, I didn't notice. Besides, Paolo and Richard showed me I don't understand clearly meson dependencies. My bad.

Quoted 46 lines

Regards,
BALATON Zoltan

Quoted 42 lines
Quoted 40 lines

you could do both in one patch with less churn and maybe reduce this series to a single patch.

Regards,
BALATON Zoltan

Quoted 35 lines

---
system/meson.build | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
system/meson.build +0 -0
index f7e2c8b826f..50d915bd80c 100644
@@ -2,10 +2,13 @@ specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', 

if_true: [files(
  'arch_init.c',
  'ioport.c',
  'memory.c',
-  'physmem.c',
  'watchpoint.c',
)])

system/meson.build +4 -0
+specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files(
+  'physmem.c',
+), libpmem, libdaxctl])
+

system_ss.add(files(
  'balloon.c',
  'bootdevice.c',

system/meson.build +1 -1
@@ -23,7 +26,7 @@ system_ss.add(files(
   'runstate-hmp-cmds.c',
   'runstate.c',
   'tpm-hmp-cmds.c',
-), libpmem, libdaxctl)
+))
 

system_ss.add(files(
  'vl.c',