buildsys: Avoid building unused objects
cover buildsys: Avoid building unused objects
Hi,
I already sent these patches few times. I am refactoring the whole tree and building over and over various combinations, and still see unuseful objects being built, so posting these patches again (rebased).
Based-on: <[email protected]>
Philippe Mathieu-Daudé (4):
configure: Restrict TCG to emulation
tests/fp: Do not build softfloat3 tests if TCG is disabled
qom: Remove user-creatable objects from user emulation qapi/meson: Restrict machine-specific objects to sysemu
configure | 12 ++++++++++-- qapi/meson.build | 20 ++++++++++---------- qom/meson.build | 7 ++++++- qom/user_creatable-stub.c | 8 ++++++++ tests/fp/meson.build | 3 +++ tests/unit/meson.build | 2 +- 6 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 qom/user_creatable-stub.c
Signature · 1 line
2.34.1
PATCH 1/4 configure: Restrict TCG to emulation
If we don't need to emulate any target, we certainly don't need TCG.
--- configure | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
configure +10 -2
@@ -370,7 +370,7 @@ slirp="auto" default_devices="true" # 3. Automatically enable/disable other options -tcg="enabled" +tcg="auto" cfi="false" # 4. Detection partly done in configure
@@ -1777,7 +1777,7 @@ EOF fi fi -if test "$tcg" = "enabled"; then +if test "$tcg" != "disabled"; then git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" fi
@@ -1819,6 +1819,14 @@ case " $target_list " in ;; esac +if test "$tcg" = "auto"; then + if test -z "$target_list"; then + tcg="disabled" + else + tcg="enabled" + fi +fi + feature_not_found() { feature=$1 remedy=$2
Signature · 1 line
2.34.1
Re: [PATCH 1/4] configure: Restrict TCG to emulation
Quoted 34 lines · Philippe Mathieu-Daudé
If we don't need to emulate any target, we certainly don't need TCG.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- configure | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)configure +3
-2@@ -370,7 +370,7 @@ slirp="auto" default_devices="true" # 3. Automatically enable/disable other options -tcg="enabled" +tcg="auto" cfi="false" # 4. Detection partly done in configure@@ -1777,7 +1777,7 @@ EOF fi fi -if test "$tcg" = "enabled"; then +if test "$tcg" != "disabled"; then git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" fi@@ -1819,6 +1819,14 @@ case " $target_list " in ;; esac +if test "$tcg" = "auto"; then
configure case " $target_list " in · line 1832
Quoted 10 lines
configure +7
-0+ if test -z "$target_list"; then + tcg="disabled" + else + tcg="enabled" + fi +fi + feature_not_found() { feature=$1 remedy=$2
Re: [PATCH 1/4] configure: Restrict TCG to emulation
In reply to Philippe Mathieu-Daudé viaQuoted 21 lines · Philippe Mathieu-Daudé via
If we don't need to emulate any target, we certainly don't need TCG.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- configure | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)configure +1
-1@@ -370,7 +370,7 @@ slirp="auto" default_devices="true" # 3. Automatically enable/disable other options -tcg="enabled" +tcg="auto" cfi="false" # 4. Detection partly done in configure
configure EOF · line 1783
Quoted 8 lines
configure +1
-1@@ -1777,7 +1777,7 @@ EOF fi fi -if test "$tcg" = "enabled"; then +if test "$tcg" != "disabled"; then git_submodules="$git_submodules tests/fp/berkeley-testfloat-3" git_submodules="$git_submodules tests/fp/berkeley-softfloat-3" fi
This should be in patch 2, and it should at the same time move this "if" after auto is changed to "disabled/enabled" below.
Paolo
Quoted 15 lines
configure +7
-0@@ -1819,6 +1819,14 @@ case " $target_list " in ;; esac +if test "$tcg" = "auto"; then + if test -z "$target_list"; then + tcg="disabled" + else + tcg="enabled" + fi +fi feature_not_found() { feature=$1 remedy=$2
PATCH 2/4 tests/fp: Do not build softfloat3 tests if TCG is disabled
In reply to Philippe Mathieu-Daudé viaTechnically we don't need the TCG accelerator to run the softfloat3 tests. However it is unlikely an interesting build combination. Developers using softfloat3 likely use TCG too. Similarly, developers disabling TCG shouldn't mind much about softfloat3 tests.
This reduces a non-TCG build by 474 objects!
--- tests/fp/meson.build | 3 +++ 1 file changed, 3 insertions(+)
tests/fp/meson.build +3 -0
@@ -1,3 +1,6 @@ +if 'CONFIG_TCG' not in config_all + subdir_done() +endif # There are namespace pollution issues on Windows, due to osdep.h # bringing in Windows headers that define a FLOAT128 type. if targetos == 'windows'
Signature · 1 line
2.34.1
Re: [PATCH 2/4] tests/fp: Do not build softfloat3 tests if TCG is disabled
Quoted 18 lines · Philippe Mathieu-Daudé
Technically we don't need the TCG accelerator to run the softfloat3 tests. However it is unlikely an interesting build combination. Developers using softfloat3 likely use TCG too. Similarly, developers disabling TCG shouldn't mind much about softfloat3 tests.
This reduces a non-TCG build by 474 objects!
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/fp/meson.build | 3 +++ 1 file changed, 3 insertions(+)tests/fp/meson.build +0
-0
tests/fp/meson.build line 1
Quoted 1 line
tests/fp/meson.build +1
-0@@ -1,3 +1,6 @@ +if 'CONFIG_TCG' not in config_all
Alternatively "if not config_all.has_key('CONFIG_TCG')" ? ... not sure which one is better, though
tests/fp/meson.build line 6
Quoted 5 lines
tests/fp/meson.build +2
-0+ subdir_done() +endif # There are namespace pollution issues on Windows, due to osdep.h # bringing in Windows headers that define a FLOAT128 type. if targetos == 'windows'
PATCH 3/4 qom: Remove user-creatable objects from user emulation
In reply to Philippe Mathieu-Daudé viauser-mode don't use user-creatable objects. Restrict it to sysemu / tools.
Add a stub to avoid a link failure with the global callback:
/usr/bin/ld: libqom.fa(qom_object.c.o): in function `object_initialize_child_with_propsv':
../qom/object.c:578: undefined reference to user_creatable_complete' /usr/bin/ld: libqom.fa(qom_object.c.o): in function object_new_with_propv':
../qom/object.c:801: undefined reference to `user_creatable_complete'
collect2: error: ld returned 1 exit status
--- qom/meson.build | 7 ++++++- qom/user_creatable-stub.c | 8 ++++++++ tests/unit/meson.build | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 qom/user_creatable-stub.c
qom/meson.build +6 -1
@@ -2,9 +2,14 @@ qom_ss.add(genh) qom_ss.add(files( 'container.c', 'object.c', - 'object_interfaces.c', 'qom-qobject.c', )) +if have_system or have_tools + qom_ss.add(files('object_interfaces.c')) +else + qom_ss.add(files('user_creatable-stub.c')) +endif + qmp_ss.add(files('qom-qmp-cmds.c')) softmmu_ss.add(files('qom-hmp-cmds.c'))
qom/user_creatable-stub.c new file +8 -0
@@ -0,0 +1,8 @@ +#include "qemu/osdep.h" + +#include "qom/object_interfaces.h" + +bool user_creatable_complete (UserCreatable *uc,Error **errp) +{ +g_assert_not_reached (); +}
tests/unit/meson.build +1 -1
@@ -39,7 +39,6 @@ tests = { 'test-bitcnt': [], 'test-qgraph': ['../qtest/libqos/qgraph.c'], 'check-qom-interface': [qom], - 'check-qom-proplist': [qom], 'test-qemu-opts': [], 'test-keyval': [testqapi], 'test-logging': [],
@@ -51,6 +50,7 @@ tests = { if have_system or have_tools tests += { + 'check-qom-proplist': [qom], 'test-qmp-event': [testqapi], } endif
Signature · 1 line
2.34.1
Re: [PATCH 3/4] qom: Remove user-creatable objects from user emulation
Quoted 26 lines · Philippe Mathieu-Daudé
user-mode don't use user-creatable objects. Restrict it to sysemu / tools.
Add a stub to avoid a link failure with the global callback:
/usr/bin/ld:libqom.fa(qom_object.c.o): in function `object_initialize_child_with_propsv':
../qom/object.c:578: undefined reference touser_creatable_complete' /usr/bin/ld: libqom.fa(qom_object.c.o): in functionobject_new_with_propv':
../qom/object.c:801: undefined reference to `user_creatable_complete'
collect2: error: ld returned 1 exit statusSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- qom/meson.build | 7 ++++++- qom/user_creatable-stub.c | 8 ++++++++ tests/unit/meson.build | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-)create mode 100644
qom/user_creatable-stub.cqom/meson.build +0
-0@@ -2,9 +2,14 @@ qom_ss.add(genh) qom_ss.add(files( 'container.c',
qom/meson.build qom_ss.add(genh) · line 12
Quoted 10 lines
qom/meson.build +5
-1'object.c', - 'object_interfaces.c', 'qom-qobject.c', )) +if have_system or have_tools + qom_ss.add(files('object_interfaces.c')) +else + qom_ss.add(files('user_creatable-stub.c')) +endif
Could you please name the new file object_interfaces_stub.c, so that it is clear that they belong together?
Thanks,
Thomas
Re: [PATCH 3/4] qom: Remove user-creatable objects from user emulation
Quoted 30 lines · Thomas Huth
Quoted 29 lines · Philippe Mathieu-Daudé
user-mode don't use user-creatable objects. Restrict it to sysemu / tools.
Add a stub to avoid a link failure with the global callback:
/usr/bin/ld:libqom.fa(qom_object.c.o): in function `object_initialize_child_with_propsv':
../qom/object.c:578: undefined reference touser_creatable_complete' /usr/bin/ld: libqom.fa(qom_object.c.o): in functionobject_new_with_propv':
../qom/object.c:801: undefined reference to `user_creatable_complete'
collect2: error: ld returned 1 exit statusSigned-off-by Philippe Mathieu-Daudé <[email protected]>---
qom/meson.build | 7 ++++++-
qom/user_creatable-stub.c| 8 ++++++++
tests/unit/meson.build | 2 +-3 files changed, 15 insertions(+), 2 deletions(-)create mode 100644
qom/user_creatable-stub.cqom/meson.build +0
-0@@ -2,9 +2,14 @@ qom_ss.add(genh)qom_ss.add(files(
'container.c',
'object.c',
- 'object_interfaces.c',
'qom-qobject.c',
Quoted 8 lines
qom/meson.build qom_ss.add(genh) · line 12
Quoted 6 lines
))
qom/meson.build +5
-0+if have_system or have_tools + qom_ss.add(files('object_interfaces.c')) +else + qom_ss.add(files('user_creatable-stub.c')) +endifCould you please name the new file
object_interfaces_stub.c, so that it is clear that they belong together?
Sure!
Re: [PATCH 3/4] qom: Remove user-creatable objects from user emulation
In reply to Philippe Mathieu-Daudé viaQuoted 10 lines · Philippe Mathieu-Daudé via
user-mode don't use user-creatable objects. Restrict it to sysemu / tools.
Add a stub to avoid a link failure with the global callback:
/usr/bin/ld:libqom.fa(qom_object.c.o): in function `object_initialize_child_with_propsv':
../qom/object.c:578: undefined reference touser_creatable_complete' /usr/bin/ld: libqom.fa(qom_object.c.o): in functionobject_new_with_propv':
../qom/object.c:801: undefined reference to `user_creatable_complete'
collect2: error: ld returned 1 exit status
Please instead move these two functions to qom/object_interfaces.c.
Paolo
PATCH 4/4 qapi/meson: Restrict machine-specific objects to sysemu
In reply to Philippe Mathieu-Daudé viamachine/ and net/ are only useful to machines;block/ and migration/ to machine or tools.
Note we need to keep building machine.json generated sources on all targets because some want to access X86CPUFeatureWordInfo from any architecture ¯\_(ツ)_/¯ Otherwise we get on all but x86 targets:
/usr/bin/ld: libqemu-i386-linux-user.fa.p/target_i386_cpu.c.o: in function `x86_cpu_get_feature_words':
../target/i386/cpu.c:4587: undefined reference to `visit_type_X86CPUFeatureWordInfoList'
collect2: error: ld returned 1 exit status
--- qapi/meson.build | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
qapi/meson.build +10 -10
@@ -23,10 +23,6 @@ endif qapi_all_modules = [ 'authz', - 'block', - 'block-core', - 'block-export', - 'char', 'common', 'compat', 'control',
@@ -35,26 +31,23 @@ qapi_all_modules = [ 'error', 'introspect', 'job', - 'machine', - 'machine-target', + 'machine', # x86 is considered multiarch by some 'migration', 'misc', 'misc-target', - 'net', 'pragma', - 'qom', 'replay', 'run-state', 'sockets', 'trace', - 'transaction', - 'yank', ] if have_system qapi_all_modules += [ 'acpi', 'audio', 'qdev', + 'machine-target', + 'net', 'pci', 'rdma', 'rocker',
@@ -63,7 +56,14 @@ if have_system endif if have_system or have_tools qapi_all_modules += [ + 'block', + 'block-core', + 'block-export', + 'char', + 'qom', 'ui', + 'transaction', + 'yank', ] endif
Signature · 1 line
2.34.1
Re: [PATCH 4/4] qapi/meson: Restrict machine-specific objects to sysemu
Quoted 11 lines · Philippe Mathieu-Daudé
machine/ and
net/are only useful to machines;block/and migration/ to machine or tools.Note we need to keep building machine.json generated sources on all targets because some want to access X86CPUFeatureWordInfo from any architecture ¯\_(ツ)_/¯ Otherwise we get on all but x86 targets:
/usr/bin/ld:libqemu-i386-linux-user.fa.p/target_i386_cpu.c.o: in function `x86_cpu_get_feature_words':
../target/i386/cpu.c:4587: undefined reference to `visit_type_X86CPUFeatureWordInfoList'
collect2: error: ld returned 1 exit status
Would it be possible to move the X86CPUFeatureWordInfo stuff into machine-target.json first, adding a proper 'if': 'TARGET_I386' there?
Thomas
Quoted 65 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- qapi/meson.build | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)qapi/meson.build +10
-10@@ -23,10 +23,6 @@ endif qapi_all_modules = [ 'authz', - 'block', - 'block-core', - 'block-export', - 'char', 'common', 'compat', 'control',@@ -35,26 +31,23 @@ qapi_all_modules = [ 'error', 'introspect', 'job', - 'machine', - 'machine-target', + 'machine', # x86 is considered multiarch by some 'migration', 'misc', 'misc-target', - 'net', 'pragma', - 'qom', 'replay', 'run-state', 'sockets', 'trace', - 'transaction', - 'yank', ] if have_system qapi_all_modules += [ 'acpi', 'audio', 'qdev', + 'machine-target', + 'net', 'pci', 'rdma', 'rocker',@@ -63,7 +56,14 @@ if have_system endif if have_system or have_tools qapi_all_modules += [ + 'block', + 'block-core', + 'block-export', + 'char', + 'qom', 'ui', + 'transaction', + 'yank', ] endif
Re: [PATCH 4/4] qapi/meson: Restrict machine-specific objects to sysemu
In reply to Philippe Mathieu-Daudé viaQuoted 11 lines · Philippe Mathieu-Daudé via
machine/ and
net/are only useful to machines;block/and migration/ to machine or tools.Note we need to keep building machine.json generated sources on all targets because some want to access X86CPUFeatureWordInfo from any architecture ¯\_(ツ)_/¯ Otherwise we get on all but x86 targets:
/usr/bin/ld:libqemu-i386-linux-user.fa.p/target_i386_cpu.c.o: in function `x86_cpu_get_feature_words':
../target/i386/cpu.c:4587: undefined reference to `visit_type_X86CPUFeatureWordInfoList'
collect2: error: ld returned 1 exit status
I suppose you mean "on all but x86 hosts", since it links libqemu-i386-linux-user.fa.p? But I don't understand how that happens.
Is it related to
{ 'struct': 'DummyForceArrays',
'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
and if so can DummyForceArrays be moved to machine-target.json together with X86CPUFeatureWordInfo, and under 'if': 'TARGET_I386'?
Thanks,
Paolo
Quoted 65 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- qapi/meson.build | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)qapi/meson.build +10
-10@@ -23,10 +23,6 @@ endif qapi_all_modules = [ 'authz', - 'block', - 'block-core', - 'block-export', - 'char', 'common', 'compat', 'control',@@ -35,26 +31,23 @@ qapi_all_modules = [ 'error', 'introspect', 'job', - 'machine', - 'machine-target', + 'machine', # x86 is considered multiarch by some 'migration', 'misc', 'misc-target', - 'net', 'pragma', - 'qom', 'replay', 'run-state', 'sockets', 'trace', - 'transaction', - 'yank', ] if have_system qapi_all_modules += [ 'acpi', 'audio', 'qdev', + 'machine-target', + 'net', 'pci', 'rdma', 'rocker',@@ -63,7 +56,14 @@ if have_system endif if have_system or have_tools qapi_all_modules += [ + 'block', + 'block-core', + 'block-export', + 'char', + 'qom', 'ui', + 'transaction', + 'yank', ] endif
Re: [PATCH 4/4] qapi/meson: Restrict machine-specific objects to sysemu
Quoted 13 lines · Paolo Bonzini
Quoted 11 lines · Philippe Mathieu-Daudé via
machine/ and
net/are only useful to machines;block/and migration/ to machine or tools.Note we need to keep building machine.json generated sources on all targets because some want to access X86CPUFeatureWordInfo from any architecture ¯\_(ツ)_/¯ Otherwise we get on all but x86 targets:
/usr/bin/ld:libqemu-i386-linux-user.fa.p/target_i386_cpu.c.o: in function `x86_cpu_get_feature_words':
../target/i386/cpu.c:4587: undefined reference to `visit_type_X86CPUFeatureWordInfoList'
collect2: error: ld returned 1 exit status
Quoted 7 lines
I suppose you mean "on all but x86 hosts", since it links libqemu-i386-linux-user.fa.p? But I don't understand how that happens.
Is it related to{ 'struct': 'DummyForceArrays',
'data': { 'unused': ['X86CPUFeatureWordInfo'] } }and if so can DummyForceArrays be moved to machine-target.json together with X86CPUFeatureWordInfo, and under 'if': '
TARGET_I386'?
Err this one is not an *arch* problem, but a user/system one (sorry I got confused with another one). Here the problem is it is not trivial to restrict visit_type_X86CPUFeatureWordInfoList() to sysemu.
So machine.json must be in qapi_all_modules[] even if !have_system.