qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-10.2 0/3] buildsys: Fix Solaris build
@ 2025-11-17 20:38 Philippe Mathieu-Daudé
  2025-11-17 20:38 ` [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg() Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-17 20:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nick Briggs, Daniel P. Berrangé, Philippe Mathieu-Daudé,
	Li Zhijian, Kostiantyn Kostiuk, Peter Xu, Marc-André Lureau,
	Andrew Deason, Eric Blake, Michael Roth, Paolo Bonzini,
	Peter Maydell, qemu-arm, Mark Cave-Ayland

Unfortunately Solaris OS is not tested in our CI, so it
bit-rotted. Fortunately the fixes are easy.

Philippe Mathieu-Daudé (3):
  qga/commands: Include proper Solaris header for getloadavg()
  migration/rdma: Check ntohll() availability with meson
  target/arm/tcg: Undefine Solaris FSCALE definition as a kludge

 meson.build                    | 4 ++++
 migration/rdma.c               | 4 +---
 qga/commands-posix.c           | 3 +++
 target/arm/tcg/translate-sve.c | 3 +++
 4 files changed, 11 insertions(+), 3 deletions(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg()
  2025-11-17 20:38 [PATCH-for-10.2 0/3] buildsys: Fix Solaris build Philippe Mathieu-Daudé
@ 2025-11-17 20:38 ` Philippe Mathieu-Daudé
  2025-11-18  8:07   ` Kostiantyn Kostiuk
  2025-11-18  8:50   ` Richard Henderson
  2025-11-17 20:38 ` [PATCH-for-10.2 2/3] migration/rdma: Check ntohll() availability with meson Philippe Mathieu-Daudé
  2025-11-17 20:38 ` [PATCH-for-10.2 3/3] target/arm/tcg: Undefine Solaris FSCALE definition as a kludge Philippe Mathieu-Daudé
  2 siblings, 2 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-17 20:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nick Briggs, Daniel P. Berrangé, Philippe Mathieu-Daudé,
	Li Zhijian, Kostiantyn Kostiuk, Peter Xu, Marc-André Lureau,
	Andrew Deason, Eric Blake, Michael Roth, Paolo Bonzini,
	Peter Maydell, qemu-arm, Mark Cave-Ayland

Solaris declares getloadavg() in <sys/loadavg.h>:

    getloadavg(3C)       Standard C Library Functions       getloadavg(3C)

    NAME
           getloadavg - get system load averages

    SYNOPSIS
           #include <sys/loadavg.h>

           int getloadavg(double loadavg[], int nelem);

    [...]

    Oracle Solaris 11.4           23 Jul 2020               getloadavg(3C)

Include it in order to avoid:

  ../qga/commands-posix.c: In function 'qmp_guest_get_load':
  ../qga/commands-posix.c:1408:9: error: implicit declaration of function 'getloadavg' [-Wimplicit-function-declaration]
   1408 |     if (getloadavg(loadavg, G_N_ELEMENTS(loadavg)) < 0) {
      |         ^~~~~~~~~~
  ../qga/commands-posix.c:1408:9: warning: nested extern declaration of 'getloadavg' [-Wnested-externs]

../configure relevant output:

  C compiler for the host machine: gcc (gcc 14.2.0 "gcc (GCC) 14.2.0")
  C linker for the host machine: gcc ld.solaris 5.11-1.3315

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 qga/commands-posix.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index c7059857e44..66f3e6f6733 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -43,6 +43,9 @@
 #include <net/ethernet.h>
 #endif
 #ifdef CONFIG_SOLARIS
+#ifdef CONFIG_GETLOADAVG
+#include <sys/loadavg.h>
+#endif
 #include <sys/sockio.h>
 #endif
 #endif
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH-for-10.2 2/3] migration/rdma: Check ntohll() availability with meson
  2025-11-17 20:38 [PATCH-for-10.2 0/3] buildsys: Fix Solaris build Philippe Mathieu-Daudé
  2025-11-17 20:38 ` [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg() Philippe Mathieu-Daudé
@ 2025-11-17 20:38 ` Philippe Mathieu-Daudé
  2025-11-17 21:36   ` Peter Xu
  2025-11-18  8:48   ` Richard Henderson
  2025-11-17 20:38 ` [PATCH-for-10.2 3/3] target/arm/tcg: Undefine Solaris FSCALE definition as a kludge Philippe Mathieu-Daudé
  2 siblings, 2 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-17 20:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nick Briggs, Daniel P. Berrangé, Philippe Mathieu-Daudé,
	Li Zhijian, Kostiantyn Kostiuk, Peter Xu, Marc-André Lureau,
	Andrew Deason, Eric Blake, Michael Roth, Paolo Bonzini,
	Peter Maydell, qemu-arm, Mark Cave-Ayland

Commit 44ce1b5d2fc ("migration/rdma: define htonll/ntohll
only if not predefined") tried to only include htonll/ntohll
replacements when their symbol is *defined*, but this doesn't
work, as they aren't:

  ../migration/rdma.c:242:17: error: static declaration of 'htonll' follows non-static declaration
    242 | static uint64_t htonll(uint64_t v)
        |                 ^~~~~~
  In file included from /usr/include/netinet/in.h:73,
                   from /usr/include/sys/socket.h:32,
                   from /home/f4bug/qemu/include/system/os-posix.h:30,
                   from /home/f4bug/qemu/include/qemu/osdep.h:176,
                   from ../migration/rdma.c:17:
  /usr/include/sys/byteorder.h:75:18: note: previous declaration of 'htonll' with type 'uint64_t(uint64_t)' {aka 'long unsigned int(long unsigned int)'}
     75 | extern  uint64_t htonll(uint64_t);
        |                  ^~~~~~
  ../migration/rdma.c:252:17: error: static declaration of 'ntohll' follows non-static declaration
    252 | static uint64_t ntohll(uint64_t v)
        |                 ^~~~~~
  /usr/include/sys/byteorder.h:76:18: note: previous declaration of 'ntohll' with type 'uint64_t(uint64_t)' {aka 'long unsigned int(long unsigned int)'}
     76 | extern  uint64_t ntohll(uint64_t);
        |                  ^~~~~~

Better to check the symbol availability with meson.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 meson.build      | 1 +
 migration/rdma.c | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index df4460035c3..72edd6097a4 100644
--- a/meson.build
+++ b/meson.build
@@ -2663,6 +2663,7 @@ config_host_data.set('CONFIG_SYNCFS', cc.has_function('syncfs'))
 config_host_data.set('CONFIG_SYNC_FILE_RANGE', cc.has_function('sync_file_range'))
 config_host_data.set('CONFIG_TIMERFD', cc.has_function('timerfd_create'))
 config_host_data.set('CONFIG_GETLOADAVG', cc.has_function('getloadavg'))
+config_host_data.set('CONFIG_ARPA_INET_64', cc.has_function('htonll'))
 config_host_data.set('HAVE_COPY_FILE_RANGE', cc.has_function('copy_file_range'))
 config_host_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs'))
 config_host_data.set('HAVE_GLIB_WITH_SLICE_ALLOCATOR', glib_has_gslice)
diff --git a/migration/rdma.c b/migration/rdma.c
index 2d839fce6c4..337b4158899 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -238,7 +238,7 @@ static const char *control_desc(unsigned int rdma_control)
     return strs[rdma_control];
 }
 
-#if !defined(htonll)
+#if !defined(CONFIG_ARPA_INET_64)
 static uint64_t htonll(uint64_t v)
 {
     union { uint32_t lv[2]; uint64_t llv; } u;
@@ -246,9 +246,7 @@ static uint64_t htonll(uint64_t v)
     u.lv[1] = htonl(v & 0xFFFFFFFFULL);
     return u.llv;
 }
-#endif
 
-#if !defined(ntohll)
 static uint64_t ntohll(uint64_t v)
 {
     union { uint32_t lv[2]; uint64_t llv; } u;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH-for-10.2 3/3] target/arm/tcg: Undefine Solaris FSCALE definition as a kludge
  2025-11-17 20:38 [PATCH-for-10.2 0/3] buildsys: Fix Solaris build Philippe Mathieu-Daudé
  2025-11-17 20:38 ` [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg() Philippe Mathieu-Daudé
  2025-11-17 20:38 ` [PATCH-for-10.2 2/3] migration/rdma: Check ntohll() availability with meson Philippe Mathieu-Daudé
@ 2025-11-17 20:38 ` Philippe Mathieu-Daudé
  2025-11-18  8:51   ` Richard Henderson
  2 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-11-17 20:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nick Briggs, Daniel P. Berrangé, Philippe Mathieu-Daudé,
	Li Zhijian, Kostiantyn Kostiuk, Peter Xu, Marc-André Lureau,
	Andrew Deason, Eric Blake, Michael Roth, Paolo Bonzini,
	Peter Maydell, qemu-arm, Mark Cave-Ayland

 CONFIG_SOLARIS_FSCALE

Solaris defines FSCALE in <sys/param.h>:

  301 /*
  302  * Scale factor for scaled integers used to count
  303  * %cpu time and load averages.
  304  */
  305 #define FSHIFT  8               /* bits to right of fixed binary point */
  306 #define FSCALE  (1<<FSHIFT)

When emulating the SVE FSCALE instruction, we defines the same name
in decodetree format in target/arm/tcg/sve.decode:

  1129:FSCALE          01100101 .. 00 1001 100 ... ..... .....    @rdn_pg_rm

This leads to a definition clash:

  In file included from ../target/arm/tcg/translate-sve.c:21:
  ../target/arm/tcg/translate.h:875:17: error: pasting "trans_" and "(" does not give a valid preprocessing token
    875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
        |                 ^~~~~~
  ../target/arm/tcg/translate-sve.c:4205:5: note: in expansion of macro 'TRANS_FEAT'
   4205 |     TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a)
        |     ^~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        | ^~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4249:12: error: expected declaration specifiers or '...' before numeric constant
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        |            ^~~~~~
  ../target/arm/tcg/translate.h:875:25: note: in definition of macro 'TRANS_FEAT'
    875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
        |                         ^~~~
  ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        | ^~~~~~~~~~
  ../target/arm/tcg/translate.h:875:47: error: pasting "arg_" and "(" does not give a valid preprocessing token
    875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
        |                                               ^~~~
  ../target/arm/tcg/translate-sve.c:4205:5: note: in expansion of macro 'TRANS_FEAT'
   4205 |     TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a)
        |     ^~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        | ^~~~~~~~~~
  In file included from ../target/arm/tcg/translate-sve.c:100:
  libqemu-aarch64-softmmu.a.p/decode-sve.c.inc:1227:13: warning: 'trans_FSCALE' used but never defined
   1227 | static bool trans_FSCALE(DisasContext *ctx, arg_FSCALE *a);
        |             ^~~~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4249:30: warning: 'sve_fscalbn_zpzz_fns' defined but not used [-Wunused-const-variable=]
   4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
        |                              ^~~~~~~~~~~
  ../target/arm/tcg/translate-sve.c:4201:42: note: in definition of macro 'DO_ZPZZ_FP'
   4201 |     static gen_helper_gvec_4_ptr * const name##_zpzz_fns[4] = { \
        |                                          ^~~~

As a kludge, check the definition existence with meson, then undefine
it locally in target/arm/tcg/translate-sve.c file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 meson.build                    | 3 +++
 target/arm/tcg/translate-sve.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/meson.build b/meson.build
index 72edd6097a4..65dd2bc6873 100644
--- a/meson.build
+++ b/meson.build
@@ -2779,6 +2779,9 @@ config_host_data.set('HAVE_TCP_KEEPINTVL',
                      #endif
                      int main(void) { return 0; }''',
                      name: 'Win32 TCP_KEEPINTVL'))
+if host_os == 'sunos'
+  config_host_data.set('CONFIG_SOLARIS_FSCALE', cc.has_header_symbol('sys/param.h', 'FSCALE'))
+endif
 
 # has_member
 config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID',
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
index 07b827fa8e8..b6fd069aa0c 100644
--- a/target/arm/tcg/translate-sve.c
+++ b/target/arm/tcg/translate-sve.c
@@ -4246,6 +4246,9 @@ DO_ZPZZ_AH_FP_B16(FMAX_zpzz, aa64_sve, sve_fmax, sve_ah_fmax)
 DO_ZPZZ_FP_B16(FMINNM_zpzz, aa64_sve, sve_fminnum)
 DO_ZPZZ_FP_B16(FMAXNM_zpzz, aa64_sve, sve_fmaxnum)
 DO_ZPZZ_AH_FP(FABD, aa64_sve, sve_fabd, sve_ah_fabd)
+#ifdef CONFIG_SOLARIS_FSCALE
+#undef FSCALE /* Kludge for Solaris which defines FSCALE in <sys/param.h> */
+#endif
 DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
 DO_ZPZZ_FP(FDIV, aa64_sve, sve_fdiv)
 DO_ZPZZ_FP(FMULX, aa64_sve, sve_fmulx)
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH-for-10.2 2/3] migration/rdma: Check ntohll() availability with meson
  2025-11-17 20:38 ` [PATCH-for-10.2 2/3] migration/rdma: Check ntohll() availability with meson Philippe Mathieu-Daudé
@ 2025-11-17 21:36   ` Peter Xu
  2025-11-18  8:48   ` Richard Henderson
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Xu @ 2025-11-17 21:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Nick Briggs, Daniel P. Berrangé, Li Zhijian,
	Kostiantyn Kostiuk, Marc-André Lureau, Andrew Deason,
	Eric Blake, Michael Roth, Paolo Bonzini, Peter Maydell, qemu-arm,
	Mark Cave-Ayland

On Mon, Nov 17, 2025 at 09:38:33PM +0100, Philippe Mathieu-Daudé wrote:
> Commit 44ce1b5d2fc ("migration/rdma: define htonll/ntohll
> only if not predefined") tried to only include htonll/ntohll
> replacements when their symbol is *defined*, but this doesn't
> work, as they aren't:
> 
>   ../migration/rdma.c:242:17: error: static declaration of 'htonll' follows non-static declaration
>     242 | static uint64_t htonll(uint64_t v)
>         |                 ^~~~~~
>   In file included from /usr/include/netinet/in.h:73,
>                    from /usr/include/sys/socket.h:32,
>                    from /home/f4bug/qemu/include/system/os-posix.h:30,
>                    from /home/f4bug/qemu/include/qemu/osdep.h:176,
>                    from ../migration/rdma.c:17:
>   /usr/include/sys/byteorder.h:75:18: note: previous declaration of 'htonll' with type 'uint64_t(uint64_t)' {aka 'long unsigned int(long unsigned int)'}
>      75 | extern  uint64_t htonll(uint64_t);
>         |                  ^~~~~~
>   ../migration/rdma.c:252:17: error: static declaration of 'ntohll' follows non-static declaration
>     252 | static uint64_t ntohll(uint64_t v)
>         |                 ^~~~~~
>   /usr/include/sys/byteorder.h:76:18: note: previous declaration of 'ntohll' with type 'uint64_t(uint64_t)' {aka 'long unsigned int(long unsigned int)'}
>      76 | extern  uint64_t ntohll(uint64_t);
>         |                  ^~~~~~
> 
> Better to check the symbol availability with meson.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Acked-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg()
  2025-11-17 20:38 ` [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg() Philippe Mathieu-Daudé
@ 2025-11-18  8:07   ` Kostiantyn Kostiuk
  2025-11-18  8:50   ` Richard Henderson
  1 sibling, 0 replies; 9+ messages in thread
From: Kostiantyn Kostiuk @ 2025-11-18  8:07 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Nick Briggs, Daniel P. Berrangé, Li Zhijian,
	Peter Xu, Marc-André Lureau, Andrew Deason, Eric Blake,
	Michael Roth, Paolo Bonzini, Peter Maydell, qemu-arm,
	Mark Cave-Ayland

[-- Attachment #1: Type: text/plain, Size: 1716 bytes --]

Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>

On Mon, Nov 17, 2025 at 10:38 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> Solaris declares getloadavg() in <sys/loadavg.h>:
>
>     getloadavg(3C)       Standard C Library Functions       getloadavg(3C)
>
>     NAME
>            getloadavg - get system load averages
>
>     SYNOPSIS
>            #include <sys/loadavg.h>
>
>            int getloadavg(double loadavg[], int nelem);
>
>     [...]
>
>     Oracle Solaris 11.4           23 Jul 2020               getloadavg(3C)
>
> Include it in order to avoid:
>
>   ../qga/commands-posix.c: In function 'qmp_guest_get_load':
>   ../qga/commands-posix.c:1408:9: error: implicit declaration of function
> 'getloadavg' [-Wimplicit-function-declaration]
>    1408 |     if (getloadavg(loadavg, G_N_ELEMENTS(loadavg)) < 0) {
>       |         ^~~~~~~~~~
>   ../qga/commands-posix.c:1408:9: warning: nested extern declaration of
> 'getloadavg' [-Wnested-externs]
>
> ../configure relevant output:
>
>   C compiler for the host machine: gcc (gcc 14.2.0 "gcc (GCC) 14.2.0")
>   C linker for the host machine: gcc ld.solaris 5.11-1.3315
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  qga/commands-posix.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index c7059857e44..66f3e6f6733 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -43,6 +43,9 @@
>  #include <net/ethernet.h>
>  #endif
>  #ifdef CONFIG_SOLARIS
> +#ifdef CONFIG_GETLOADAVG
> +#include <sys/loadavg.h>
> +#endif
>  #include <sys/sockio.h>
>  #endif
>  #endif
> --
> 2.51.0
>
>

[-- Attachment #2: Type: text/html, Size: 2378 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH-for-10.2 2/3] migration/rdma: Check ntohll() availability with meson
  2025-11-17 20:38 ` [PATCH-for-10.2 2/3] migration/rdma: Check ntohll() availability with meson Philippe Mathieu-Daudé
  2025-11-17 21:36   ` Peter Xu
@ 2025-11-18  8:48   ` Richard Henderson
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2025-11-18  8:48 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Nick Briggs, Daniel P. Berrangé, Li Zhijian,
	Kostiantyn Kostiuk, Peter Xu, Marc-André Lureau,
	Andrew Deason, Eric Blake, Michael Roth, Paolo Bonzini,
	Peter Maydell, qemu-arm, Mark Cave-Ayland

On 11/17/25 21:38, Philippe Mathieu-Daudé wrote:
> Commit 44ce1b5d2fc ("migration/rdma: define htonll/ntohll
> only if not predefined") tried to only include htonll/ntohll
> replacements when their symbol is *defined*, but this doesn't
> work, as they aren't:
> 
>    ../migration/rdma.c:242:17: error: static declaration of 'htonll' follows non-static declaration
>      242 | static uint64_t htonll(uint64_t v)
>          |                 ^~~~~~
>    In file included from /usr/include/netinet/in.h:73,
>                     from /usr/include/sys/socket.h:32,
>                     from /home/f4bug/qemu/include/system/os-posix.h:30,
>                     from /home/f4bug/qemu/include/qemu/osdep.h:176,
>                     from ../migration/rdma.c:17:
>    /usr/include/sys/byteorder.h:75:18: note: previous declaration of 'htonll' with type 'uint64_t(uint64_t)' {aka 'long unsigned int(long unsigned int)'}
>       75 | extern  uint64_t htonll(uint64_t);
>          |                  ^~~~~~
>    ../migration/rdma.c:252:17: error: static declaration of 'ntohll' follows non-static declaration
>      252 | static uint64_t ntohll(uint64_t v)
>          |                 ^~~~~~
>    /usr/include/sys/byteorder.h:76:18: note: previous declaration of 'ntohll' with type 'uint64_t(uint64_t)' {aka 'long unsigned int(long unsigned int)'}
>       76 | extern  uint64_t ntohll(uint64_t);
>          |                  ^~~~~~
> 
> Better to check the symbol availability with meson.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   meson.build      | 1 +
>   migration/rdma.c | 4 +---
>   2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index df4460035c3..72edd6097a4 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2663,6 +2663,7 @@ config_host_data.set('CONFIG_SYNCFS', cc.has_function('syncfs'))
>   config_host_data.set('CONFIG_SYNC_FILE_RANGE', cc.has_function('sync_file_range'))
>   config_host_data.set('CONFIG_TIMERFD', cc.has_function('timerfd_create'))
>   config_host_data.set('CONFIG_GETLOADAVG', cc.has_function('getloadavg'))
> +config_host_data.set('CONFIG_ARPA_INET_64', cc.has_function('htonll'))
>   config_host_data.set('HAVE_COPY_FILE_RANGE', cc.has_function('copy_file_range'))
>   config_host_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs'))
>   config_host_data.set('HAVE_GLIB_WITH_SLICE_ALLOCATOR', glib_has_gslice)

Should we bother with htonl{,l} at all, when we have <qemu/bswap.h>?

That said, this is the minimal patch for 10.2, so
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg()
  2025-11-17 20:38 ` [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg() Philippe Mathieu-Daudé
  2025-11-18  8:07   ` Kostiantyn Kostiuk
@ 2025-11-18  8:50   ` Richard Henderson
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2025-11-18  8:50 UTC (permalink / raw)
  To: qemu-devel

On 11/17/25 21:38, Philippe Mathieu-Daudé wrote:
> Solaris declares getloadavg() in <sys/loadavg.h>:
> 
>      getloadavg(3C)       Standard C Library Functions       getloadavg(3C)
> 
>      NAME
>             getloadavg - get system load averages
> 
>      SYNOPSIS
>             #include <sys/loadavg.h>
> 
>             int getloadavg(double loadavg[], int nelem);
> 
>      [...]
> 
>      Oracle Solaris 11.4           23 Jul 2020               getloadavg(3C)
> 
> Include it in order to avoid:
> 
>    ../qga/commands-posix.c: In function 'qmp_guest_get_load':
>    ../qga/commands-posix.c:1408:9: error: implicit declaration of function 'getloadavg' [-Wimplicit-function-declaration]
>     1408 |     if (getloadavg(loadavg, G_N_ELEMENTS(loadavg)) < 0) {
>        |         ^~~~~~~~~~
>    ../qga/commands-posix.c:1408:9: warning: nested extern declaration of 'getloadavg' [-Wnested-externs]
> 
> ../configure relevant output:
> 
>    C compiler for the host machine: gcc (gcc 14.2.0 "gcc (GCC) 14.2.0")
>    C linker for the host machine: gcc ld.solaris 5.11-1.3315
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   qga/commands-posix.c | 3 +++
>   1 file changed, 3 insertions(+)

Acked-by: Richard Henderson <richard.henderson@linaro.org>

r~

> 
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index c7059857e44..66f3e6f6733 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -43,6 +43,9 @@
>   #include <net/ethernet.h>
>   #endif
>   #ifdef CONFIG_SOLARIS
> +#ifdef CONFIG_GETLOADAVG
> +#include <sys/loadavg.h>
> +#endif
>   #include <sys/sockio.h>
>   #endif
>   #endif



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH-for-10.2 3/3] target/arm/tcg: Undefine Solaris FSCALE definition as a kludge
  2025-11-17 20:38 ` [PATCH-for-10.2 3/3] target/arm/tcg: Undefine Solaris FSCALE definition as a kludge Philippe Mathieu-Daudé
@ 2025-11-18  8:51   ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2025-11-18  8:51 UTC (permalink / raw)
  To: qemu-devel

On 11/17/25 21:38, Philippe Mathieu-Daudé wrote:
>   CONFIG_SOLARIS_FSCALE
> 
> Solaris defines FSCALE in <sys/param.h>:
> 
>    301 /*
>    302  * Scale factor for scaled integers used to count
>    303  * %cpu time and load averages.
>    304  */
>    305 #define FSHIFT  8               /* bits to right of fixed binary point */
>    306 #define FSCALE  (1<<FSHIFT)
> 
> When emulating the SVE FSCALE instruction, we defines the same name
> in decodetree format in target/arm/tcg/sve.decode:
> 
>    1129:FSCALE          01100101 .. 00 1001 100 ... ..... .....    @rdn_pg_rm
> 
> This leads to a definition clash:
> 
>    In file included from ../target/arm/tcg/translate-sve.c:21:
>    ../target/arm/tcg/translate.h:875:17: error: pasting "trans_" and "(" does not give a valid preprocessing token
>      875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
>          |                 ^~~~~~
>    ../target/arm/tcg/translate-sve.c:4205:5: note: in expansion of macro 'TRANS_FEAT'
>     4205 |     TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a)
>          |     ^~~~~~~~~~
>    ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
>     4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
>          | ^~~~~~~~~~
>    ../target/arm/tcg/translate-sve.c:4249:12: error: expected declaration specifiers or '...' before numeric constant
>     4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
>          |            ^~~~~~
>    ../target/arm/tcg/translate.h:875:25: note: in definition of macro 'TRANS_FEAT'
>      875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
>          |                         ^~~~
>    ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
>     4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
>          | ^~~~~~~~~~
>    ../target/arm/tcg/translate.h:875:47: error: pasting "arg_" and "(" does not give a valid preprocessing token
>      875 |     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
>          |                                               ^~~~
>    ../target/arm/tcg/translate-sve.c:4205:5: note: in expansion of macro 'TRANS_FEAT'
>     4205 |     TRANS_FEAT(NAME, FEAT, gen_gvec_fpst_arg_zpzz, name##_zpzz_fns[a->esz], a)
>          |     ^~~~~~~~~~
>    ../target/arm/tcg/translate-sve.c:4249:1: note: in expansion of macro 'DO_ZPZZ_FP'
>     4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
>          | ^~~~~~~~~~
>    In file included from ../target/arm/tcg/translate-sve.c:100:
>    libqemu-aarch64-softmmu.a.p/decode-sve.c.inc:1227:13: warning: 'trans_FSCALE' used but never defined
>     1227 | static bool trans_FSCALE(DisasContext *ctx, arg_FSCALE *a);
>          |             ^~~~~~~~~~~~
>    ../target/arm/tcg/translate-sve.c:4249:30: warning: 'sve_fscalbn_zpzz_fns' defined but not used [-Wunused-const-variable=]
>     4249 | DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
>          |                              ^~~~~~~~~~~
>    ../target/arm/tcg/translate-sve.c:4201:42: note: in definition of macro 'DO_ZPZZ_FP'
>     4201 |     static gen_helper_gvec_4_ptr * const name##_zpzz_fns[4] = { \
>          |                                          ^~~~
> 
> As a kludge, check the definition existence with meson, then undefine
> it locally in target/arm/tcg/translate-sve.c file.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   meson.build                    | 3 +++
>   target/arm/tcg/translate-sve.c | 3 +++
>   2 files changed, 6 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 72edd6097a4..65dd2bc6873 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2779,6 +2779,9 @@ config_host_data.set('HAVE_TCP_KEEPINTVL',
>                        #endif
>                        int main(void) { return 0; }''',
>                        name: 'Win32 TCP_KEEPINTVL'))
> +if host_os == 'sunos'
> +  config_host_data.set('CONFIG_SOLARIS_FSCALE', cc.has_header_symbol('sys/param.h', 'FSCALE'))
> +endif
>   
>   # has_member
>   config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID',
> diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
> index 07b827fa8e8..b6fd069aa0c 100644
> --- a/target/arm/tcg/translate-sve.c
> +++ b/target/arm/tcg/translate-sve.c
> @@ -4246,6 +4246,9 @@ DO_ZPZZ_AH_FP_B16(FMAX_zpzz, aa64_sve, sve_fmax, sve_ah_fmax)
>   DO_ZPZZ_FP_B16(FMINNM_zpzz, aa64_sve, sve_fminnum)
>   DO_ZPZZ_FP_B16(FMAXNM_zpzz, aa64_sve, sve_fmaxnum)
>   DO_ZPZZ_AH_FP(FABD, aa64_sve, sve_fabd, sve_ah_fabd)
> +#ifdef CONFIG_SOLARIS_FSCALE
> +#undef FSCALE /* Kludge for Solaris which defines FSCALE in <sys/param.h> */
> +#endif
>   DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
>   DO_ZPZZ_FP(FDIV, aa64_sve, sve_fdiv)
>   DO_ZPZZ_FP(FMULX, aa64_sve, sve_fmulx)

You don't need an ifdef for undef, just undef it.


r~


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-11-18  8:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17 20:38 [PATCH-for-10.2 0/3] buildsys: Fix Solaris build Philippe Mathieu-Daudé
2025-11-17 20:38 ` [PATCH-for-10.2 1/3] qga/commands: Include proper Solaris header for getloadavg() Philippe Mathieu-Daudé
2025-11-18  8:07   ` Kostiantyn Kostiuk
2025-11-18  8:50   ` Richard Henderson
2025-11-17 20:38 ` [PATCH-for-10.2 2/3] migration/rdma: Check ntohll() availability with meson Philippe Mathieu-Daudé
2025-11-17 21:36   ` Peter Xu
2025-11-18  8:48   ` Richard Henderson
2025-11-17 20:38 ` [PATCH-for-10.2 3/3] target/arm/tcg: Undefine Solaris FSCALE definition as a kludge Philippe Mathieu-Daudé
2025-11-18  8:51   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).