[PATCH v2] mos6522: fix linking error when CONFIG_MOS6522 is not set

Murilo Opsfelder Araujo posted 1 patch 2 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220506011632.183257-1-muriloo@linux.ibm.com
Maintainers: "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Markus Armbruster <armbru@redhat.com>
There is a newer version of this series
hmp-commands-info.hx | 2 ++
monitor/misc.c       | 3 +++
2 files changed, 5 insertions(+)
[PATCH v2] mos6522: fix linking error when CONFIG_MOS6522 is not set
Posted by Murilo Opsfelder Araujo 2 years ago
When CONFIG_MOS6522 is not set, building ppc64-softmmu target fails:

    /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'

Make devices configuration available in hmp-commands*.hx and check for
CONFIG_MOS6522.

Fixes: 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)
Signed-off-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Fabiano Rosas <farosas@linux.ibm.com>
---
v2:
- Included devices configuration in monitor/misc.c

v1:
- https://lore.kernel.org/qemu-devel/20220429233146.29662-1-muriloo@linux.ibm.com/

 hmp-commands-info.hx | 2 ++
 monitor/misc.c       | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index adfa085a9b..9ad784dd9f 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -881,6 +881,7 @@ SRST
 ERST
 
 #if defined(TARGET_M68K) || defined(TARGET_PPC)
+#if defined(CONFIG_MOS6522)
     {
         .name         = "via",
         .args_type    = "",
@@ -889,6 +890,7 @@ ERST
         .cmd          = hmp_info_via,
     },
 #endif
+#endif
 
 SRST
   ``info via``
diff --git a/monitor/misc.c b/monitor/misc.c
index 6c5bb82d3b..3d2312ba8d 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -84,6 +84,9 @@
 #include "hw/s390x/storage-attributes.h"
 #endif
 
+/* Make devices configuration available for use in hmp-commands*.hx templates */
+#include CONFIG_DEVICES
+
 /* file descriptors passed via SCM_RIGHTS */
 typedef struct mon_fd_t mon_fd_t;
 struct mon_fd_t {
-- 
2.35.1
Re: [PATCH v2] mos6522: fix linking error when CONFIG_MOS6522 is not set
Posted by Thomas Huth 1 year, 12 months ago
On 06/05/2022 03.16, Murilo Opsfelder Araujo wrote:
> When CONFIG_MOS6522 is not set, building ppc64-softmmu target fails:
> 
>      /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
> 
> Make devices configuration available in hmp-commands*.hx and check for
> CONFIG_MOS6522.
> 
> Fixes: 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)
> Signed-off-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Cc: Fabiano Rosas <farosas@linux.ibm.com>
> ---
> v2:
> - Included devices configuration in monitor/misc.c
> 
> v1:
> - https://lore.kernel.org/qemu-devel/20220429233146.29662-1-muriloo@linux.ibm.com/
> 
>   hmp-commands-info.hx | 2 ++
>   monitor/misc.c       | 3 +++
>   2 files changed, 5 insertions(+)
> 
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index adfa085a9b..9ad784dd9f 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -881,6 +881,7 @@ SRST
>   ERST
>   
>   #if defined(TARGET_M68K) || defined(TARGET_PPC)
> +#if defined(CONFIG_MOS6522)

I think you could even get rid of the TARGET_ stuff now that the CONFIG line 
works!

>       {
>           .name         = "via",
>           .args_type    = "",
> @@ -889,6 +890,7 @@ ERST
>           .cmd          = hmp_info_via,
>       },
>   #endif
> +#endif
>   
>   SRST
>     ``info via``
> diff --git a/monitor/misc.c b/monitor/misc.c
> index 6c5bb82d3b..3d2312ba8d 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -84,6 +84,9 @@
>   #include "hw/s390x/storage-attributes.h"
>   #endif
>   
> +/* Make devices configuration available for use in hmp-commands*.hx templates */
> +#include CONFIG_DEVICES

Looks reasonable to me.

So with the "#if defined(TARGET_M68K) || defined(TARGET_PPC)" removed:

Reviewed-by: Thomas Huth <thuth@redhat.com>
Re: [PATCH v2] mos6522: fix linking error when CONFIG_MOS6522 is not set
Posted by Murilo Opsfelder Araújo 1 year, 12 months ago
Hi, Thomas.

On 5/10/22 04:24, Thomas Huth wrote:
> On 06/05/2022 03.16, Murilo Opsfelder Araujo wrote:
>> When CONFIG_MOS6522 is not set, building ppc64-softmmu target fails:
>>
>>      /usr/bin/ld: libqemu-ppc64-softmmu.fa.p/monitor_misc.c.o:(.data+0x1158): undefined reference to `hmp_info_via'
>>
>> Make devices configuration available in hmp-commands*.hx and check for
>> CONFIG_MOS6522.
>>
>> Fixes: 409e9f7131e5 (mos6522: add "info via" HMP command for debugging)
>> Signed-off-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
>> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> Cc: Fabiano Rosas <farosas@linux.ibm.com>
>> ---
>> v2:
>> - Included devices configuration in monitor/misc.c
>>
>> v1:
>> - https://lore.kernel.org/qemu-devel/20220429233146.29662-1-muriloo@linux.ibm.com/
>>
>>   hmp-commands-info.hx | 2 ++
>>   monitor/misc.c       | 3 +++
>>   2 files changed, 5 insertions(+)
>>
>> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
>> index adfa085a9b..9ad784dd9f 100644
>> --- a/hmp-commands-info.hx
>> +++ b/hmp-commands-info.hx
>> @@ -881,6 +881,7 @@ SRST
>>   ERST
>>   #if defined(TARGET_M68K) || defined(TARGET_PPC)
>> +#if defined(CONFIG_MOS6522)
> 
> I think you could even get rid of the TARGET_ stuff now that the CONFIG line works!
> 
>>       {
>>           .name         = "via",
>>           .args_type    = "",
>> @@ -889,6 +890,7 @@ ERST
>>           .cmd          = hmp_info_via,
>>       },
>>   #endif
>> +#endif
>>   SRST
>>     ``info via``
>> diff --git a/monitor/misc.c b/monitor/misc.c
>> index 6c5bb82d3b..3d2312ba8d 100644
>> --- a/monitor/misc.c
>> +++ b/monitor/misc.c
>> @@ -84,6 +84,9 @@
>>   #include "hw/s390x/storage-attributes.h"
>>   #endif
>> +/* Make devices configuration available for use in hmp-commands*.hx templates */
>> +#include CONFIG_DEVICES
> 
> Looks reasonable to me.
> 
> So with the "#if defined(TARGET_M68K) || defined(TARGET_PPC)" removed:
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 

I've sent v3 with your suggestion:

     https://lore.kernel.org/qemu-devel/20220510235439.54775-1-muriloo@linux.ibm.com/

Thank you for your review.

-- 
Murilo