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 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
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
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
diff --git a/qom/meson.build b/qom/meson.build
index 062a3789d8..afc60cc19d 100644
--- a/qom/meson.build
+++ b/qom/meson.build
@@ -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'))
diff --git a/qom/user_creatable-stub.c b/qom/user_creatable-stub.c
new file mode 100644
index 0000000000..cc3638e20d
--- /dev/null
+++ b/qom/user_creatable-stub.c
@@ -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();
+}
diff --git a/tests/unit/meson.build b/tests/unit/meson.build
index 64a5e7bfde..2cdcd136c9 100644
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -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
--
2.34.1
On 04/02/2022 16.29, Philippe Mathieu-Daudé wrote:
> 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 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
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> 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
>
> diff --git a/qom/meson.build b/qom/meson.build
> index 062a3789d8..afc60cc19d 100644
> --- a/qom/meson.build
> +++ b/qom/meson.build
> @@ -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
Could you please name the new file object_interfaces_stub.c, so that it is
clear that they belong together?
Thanks,
Thomas
On 4/2/22 16:56, Thomas Huth wrote:
> On 04/02/2022 16.29, Philippe Mathieu-Daudé wrote:
>> 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 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
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> 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
>>
>> diff --git a/qom/meson.build b/qom/meson.build
>> index 062a3789d8..afc60cc19d 100644
>> --- a/qom/meson.build
>> +++ b/qom/meson.build
>> @@ -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
>
> Could you please name the new file object_interfaces_stub.c, so that it
> is clear that they belong together?
Sure!
On 2/4/22 16:29, Philippe Mathieu-Daudé via wrote: > 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 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 Please instead move these two functions to qom/object_interfaces.c. Paolo
© 2016 - 2026 Red Hat, Inc.