qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ppc: qtest already exports qtest_rtas_call()
@ 2023-10-30 16:38 Juan Quintela
  2023-10-30 16:41 ` Cédric Le Goater
  2023-11-07 18:56 ` Daniel Henrique Barboza
  0 siblings, 2 replies; 6+ messages in thread
From: Juan Quintela @ 2023-10-30 16:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, David Gibson,
	Daniel Henrique Barboza, Nicholas Piggin, Cédric Le Goater,
	Juan Quintela

Having two functions with the same name is a bad idea.  As spapr only
uses the function locally, made it static.

When you compile with clang, you get this compilation error:

/usr/bin/ld: tests/qtest/libqos/libqos.fa.p/.._libqtest.c.o: in function `qtest_rtas_call':
/scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/tests/qtest/libqtest.c:1195: multiple definition of `qtest_rtas_call'; libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_rtas.c.o:/scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/hw/ppc/spapr_rtas.c:536: first defined here
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
make: *** [Makefile:162: run-ninja] Error 1

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/hw/ppc/spapr_rtas.h | 10 ----------
 hw/ppc/spapr_rtas.c         |  4 ++--
 2 files changed, 2 insertions(+), 12 deletions(-)
 delete mode 100644 include/hw/ppc/spapr_rtas.h

diff --git a/include/hw/ppc/spapr_rtas.h b/include/hw/ppc/spapr_rtas.h
deleted file mode 100644
index 383611f10f..0000000000
--- a/include/hw/ppc/spapr_rtas.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef HW_SPAPR_RTAS_H
-#define HW_SPAPR_RTAS_H
-/*
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
-                         uint32_t nret, uint64_t rets);
-#endif /* HW_SPAPR_RTAS_H */
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 26c384b261..cec01b2c92 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -531,8 +531,8 @@ target_ulong spapr_rtas_call(PowerPCCPU *cpu, SpaprMachineState *spapr,
     return H_PARAMETER;
 }
 
-uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
-                         uint32_t nret, uint64_t rets)
+static uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
+                                uint32_t nret, uint64_t rets)
 {
     int token;
 
-- 
2.41.0



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

* Re: [PATCH] ppc: qtest already exports qtest_rtas_call()
  2023-10-30 16:38 [PATCH] ppc: qtest already exports qtest_rtas_call() Juan Quintela
@ 2023-10-30 16:41 ` Cédric Le Goater
  2023-10-31  1:13   ` David Gibson
  2023-11-07 18:56 ` Daniel Henrique Barboza
  1 sibling, 1 reply; 6+ messages in thread
From: Cédric Le Goater @ 2023-10-30 16:41 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, David Gibson,
	Daniel Henrique Barboza, Nicholas Piggin

On 10/30/23 17:38, Juan Quintela wrote:
> Having two functions with the same name is a bad idea.  As spapr only
> uses the function locally, made it static.
> 
> When you compile with clang, you get this compilation error:
> 
> /usr/bin/ld: tests/qtest/libqos/libqos.fa.p/.._libqtest.c.o: in function `qtest_rtas_call':
> /scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/tests/qtest/libqtest.c:1195: multiple definition of `qtest_rtas_call'; libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_rtas.c.o:/scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/hw/ppc/spapr_rtas.c:536: first defined here
> clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
> ninja: build stopped: subcommand failed.
> make: *** [Makefile:162: run-ninja] Error 1
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.



> ---
>   include/hw/ppc/spapr_rtas.h | 10 ----------
>   hw/ppc/spapr_rtas.c         |  4 ++--
>   2 files changed, 2 insertions(+), 12 deletions(-)
>   delete mode 100644 include/hw/ppc/spapr_rtas.h
> 
> diff --git a/include/hw/ppc/spapr_rtas.h b/include/hw/ppc/spapr_rtas.h
> deleted file mode 100644
> index 383611f10f..0000000000
> --- a/include/hw/ppc/spapr_rtas.h
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#ifndef HW_SPAPR_RTAS_H
> -#define HW_SPAPR_RTAS_H
> -/*
> - * This work is licensed under the terms of the GNU GPL, version 2 or later.
> - * See the COPYING file in the top-level directory.
> - */
> -
> -uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
> -                         uint32_t nret, uint64_t rets);
> -#endif /* HW_SPAPR_RTAS_H */
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 26c384b261..cec01b2c92 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -531,8 +531,8 @@ target_ulong spapr_rtas_call(PowerPCCPU *cpu, SpaprMachineState *spapr,
>       return H_PARAMETER;
>   }
>   
> -uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
> -                         uint32_t nret, uint64_t rets)
> +static uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
> +                                uint32_t nret, uint64_t rets)
>   {
>       int token;
>   



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

* Re: [PATCH] ppc: qtest already exports qtest_rtas_call()
  2023-10-30 16:41 ` Cédric Le Goater
@ 2023-10-31  1:13   ` David Gibson
  2023-10-31 10:15     ` Juan Quintela
  0 siblings, 1 reply; 6+ messages in thread
From: David Gibson @ 2023-10-31  1:13 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Juan Quintela, qemu-devel, Harsh Prateek Bora, qemu-ppc,
	Daniel Henrique Barboza, Nicholas Piggin

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

On Mon, Oct 30, 2023 at 05:41:36PM +0100, Cédric le Goater wrote:
> On 10/30/23 17:38, Juan Quintela wrote:
> > Having two functions with the same name is a bad idea.  As spapr only
> > uses the function locally, made it static.
> > 
> > When you compile with clang, you get this compilation error:
> > 
> > /usr/bin/ld: tests/qtest/libqos/libqos.fa.p/.._libqtest.c.o: in function `qtest_rtas_call':
> > /scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/tests/qtest/libqtest.c:1195: multiple definition of `qtest_rtas_call'; libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_rtas.c.o:/scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/hw/ppc/spapr_rtas.c:536: first defined here
> > clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
> > ninja: build stopped: subcommand failed.
> > make: *** [Makefile:162: run-ninja] Error 1
> > 
> > Signed-off-by: Juan Quintela <quintela@redhat.com>
> 
> 
> Reviewed-by: Cédric Le Goater <clg@kaod.org>

I think changing the name of one of the functions would be even
better.  Making it static means it won't confuse the compiler, but it
can still confuse people.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] ppc: qtest already exports qtest_rtas_call()
  2023-10-31  1:13   ` David Gibson
@ 2023-10-31 10:15     ` Juan Quintela
  2023-10-31 10:22       ` Cédric Le Goater
  0 siblings, 1 reply; 6+ messages in thread
From: Juan Quintela @ 2023-10-31 10:15 UTC (permalink / raw)
  To: David Gibson
  Cc: Cédric Le Goater, qemu-devel, Harsh Prateek Bora, qemu-ppc,
	Daniel Henrique Barboza, Nicholas Piggin

David Gibson <david@gibson.dropbear.id.au> wrote:
> On Mon, Oct 30, 2023 at 05:41:36PM +0100, Cédric le Goater wrote:
>> On 10/30/23 17:38, Juan Quintela wrote:
>> > Having two functions with the same name is a bad idea.  As spapr only
>> > uses the function locally, made it static.
>> > 
>> > When you compile with clang, you get this compilation error:
>> > 
>> > /usr/bin/ld: tests/qtest/libqos/libqos.fa.p/.._libqtest.c.o: in function `qtest_rtas_call':
>> > /scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/tests/qtest/libqtest.c:1195:
>> > multiple definition of `qtest_rtas_call';
>> > libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_rtas.c.o:/scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/hw/ppc/spapr_rtas.c:536:
>> > first defined here
>> > clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
>> > ninja: build stopped: subcommand failed.
>> > make: *** [Makefile:162: run-ninja] Error 1
>> > 
>> > Signed-off-by: Juan Quintela <quintela@redhat.com>
>> 
>> 
>> Reviewed-by: Cédric Le Goater <clg@kaod.org>
>
> I think changing the name of one of the functions would be even
> better.  Making it static means it won't confuse the compiler, but it
> can still confuse people.

I think that made it static when it is not used anywhere else is a good
idea.

After that, I don't understand it enough to make a rename that makes
sense.

This patch is the typical fix for "make all" with clang fails here.
I let ppc maintainers to do anything more sensible.

Later, Juan.



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

* Re: [PATCH] ppc: qtest already exports qtest_rtas_call()
  2023-10-31 10:15     ` Juan Quintela
@ 2023-10-31 10:22       ` Cédric Le Goater
  0 siblings, 0 replies; 6+ messages in thread
From: Cédric Le Goater @ 2023-10-31 10:22 UTC (permalink / raw)
  To: quintela, David Gibson
  Cc: qemu-devel, Harsh Prateek Bora, qemu-ppc, Daniel Henrique Barboza,
	Nicholas Piggin

On 10/31/23 11:15, Juan Quintela wrote:
> David Gibson <david@gibson.dropbear.id.au> wrote:
>> On Mon, Oct 30, 2023 at 05:41:36PM +0100, Cédric le Goater wrote:
>>> On 10/30/23 17:38, Juan Quintela wrote:
>>>> Having two functions with the same name is a bad idea.  As spapr only
>>>> uses the function locally, made it static.
>>>>
>>>> When you compile with clang, you get this compilation error:
>>>>
>>>> /usr/bin/ld: tests/qtest/libqos/libqos.fa.p/.._libqtest.c.o: in function `qtest_rtas_call':
>>>> /scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/tests/qtest/libqtest.c:1195:
>>>> multiple definition of `qtest_rtas_call';
>>>> libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_rtas.c.o:/scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/hw/ppc/spapr_rtas.c:536:
>>>> first defined here
>>>> clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
>>>> ninja: build stopped: subcommand failed.
>>>> make: *** [Makefile:162: run-ninja] Error 1
>>>>
>>>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>>>
>>>
>>> Reviewed-by: Cédric Le Goater <clg@kaod.org>
>>
>> I think changing the name of one of the functions would be even
>> better.  Making it static means it won't confuse the compiler, but it
>> can still confuse people.

Since it is a spapr file, something like :

   static uint64_t spapr_qtest_rtas_call(...)

?

Thanks,

C.


> I think that made it static when it is not used anywhere else is a good
> idea.
> 
> After that, I don't understand it enough to make a rename that makes
> sense.
> 
> This patch is the typical fix for "make all" with clang fails here.
> I let ppc maintainers to do anything more sensible.
> 
> Later, Juan.
> 



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

* Re: [PATCH] ppc: qtest already exports qtest_rtas_call()
  2023-10-30 16:38 [PATCH] ppc: qtest already exports qtest_rtas_call() Juan Quintela
  2023-10-30 16:41 ` Cédric Le Goater
@ 2023-11-07 18:56 ` Daniel Henrique Barboza
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Henrique Barboza @ 2023-11-07 18:56 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, David Gibson, Nicholas Piggin,
	Cédric Le Goater

Queue in ppc-next after amending this in:


$ git diff
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index cec01b2c92..f329693c55 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -38,7 +38,6 @@
  
  #include "hw/ppc/spapr.h"
  #include "hw/ppc/spapr_vio.h"
-#include "hw/ppc/spapr_rtas.h"
  #include "hw/ppc/spapr_cpu_core.h"
  #include "hw/ppc/ppc.h"


Gitlab complained that we were including a non-existing header.




Thanks,

Daniel

On 10/30/23 13:38, Juan Quintela wrote:
> Having two functions with the same name is a bad idea.  As spapr only
> uses the function locally, made it static.
> 
> When you compile with clang, you get this compilation error:
> 
> /usr/bin/ld: tests/qtest/libqos/libqos.fa.p/.._libqtest.c.o: in function `qtest_rtas_call':
> /scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/tests/qtest/libqtest.c:1195: multiple definition of `qtest_rtas_call'; libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_rtas.c.o:/scratch/qemu/clang/full/all/../../../../../mnt/code/qemu/full/hw/ppc/spapr_rtas.c:536: first defined here
> clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
> ninja: build stopped: subcommand failed.
> make: *** [Makefile:162: run-ninja] Error 1
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>   include/hw/ppc/spapr_rtas.h | 10 ----------
>   hw/ppc/spapr_rtas.c         |  4 ++--
>   2 files changed, 2 insertions(+), 12 deletions(-)
>   delete mode 100644 include/hw/ppc/spapr_rtas.h
> 
> diff --git a/include/hw/ppc/spapr_rtas.h b/include/hw/ppc/spapr_rtas.h
> deleted file mode 100644
> index 383611f10f..0000000000
> --- a/include/hw/ppc/spapr_rtas.h
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#ifndef HW_SPAPR_RTAS_H
> -#define HW_SPAPR_RTAS_H
> -/*
> - * This work is licensed under the terms of the GNU GPL, version 2 or later.
> - * See the COPYING file in the top-level directory.
> - */
> -
> -uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
> -                         uint32_t nret, uint64_t rets);
> -#endif /* HW_SPAPR_RTAS_H */
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index 26c384b261..cec01b2c92 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -531,8 +531,8 @@ target_ulong spapr_rtas_call(PowerPCCPU *cpu, SpaprMachineState *spapr,
>       return H_PARAMETER;
>   }
>   
> -uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
> -                         uint32_t nret, uint64_t rets)
> +static uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args,
> +                                uint32_t nret, uint64_t rets)
>   {
>       int token;
>   


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

end of thread, other threads:[~2023-11-07 18:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-30 16:38 [PATCH] ppc: qtest already exports qtest_rtas_call() Juan Quintela
2023-10-30 16:41 ` Cédric Le Goater
2023-10-31  1:13   ` David Gibson
2023-10-31 10:15     ` Juan Quintela
2023-10-31 10:22       ` Cédric Le Goater
2023-11-07 18:56 ` Daniel Henrique Barboza

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).