All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86: fix build with GCC10
@ 2020-06-17 15:21 Vitaly Kuznetsov
  2020-06-22 15:03 ` Claudio Imbrenda
  2020-06-22 17:22 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2020-06-17 15:21 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

kvm-unit-tests fail to build with GCC10:

/usr/bin/ld: lib/libcflat.a(usermode.o):
  ./kvm-unit-tests/lib/x86/usermode.c:17:  multiple definition of `jmpbuf';
 lib/libcflat.a(fault_test.o):
  ./kvm-unit-tests/lib/x86/fault_test.c:3: first defined here

It seems that 'jmpbuf' doesn't need to be global in either of these files,
make it static in both.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 lib/x86/fault_test.c | 2 +-
 lib/x86/usermode.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/x86/fault_test.c b/lib/x86/fault_test.c
index 078dae3da640..e15a21864562 100644
--- a/lib/x86/fault_test.c
+++ b/lib/x86/fault_test.c
@@ -1,6 +1,6 @@
 #include "fault_test.h"
 
-jmp_buf jmpbuf;
+static jmp_buf jmpbuf;
 
 static void restore_exec_to_jmpbuf(void)
 {
diff --git a/lib/x86/usermode.c b/lib/x86/usermode.c
index f01ad9be1799..f0325236dd05 100644
--- a/lib/x86/usermode.c
+++ b/lib/x86/usermode.c
@@ -14,7 +14,7 @@
 #define USERMODE_STACK_SIZE	0x2000
 #define RET_TO_KERNEL_IRQ	0x20
 
-jmp_buf jmpbuf;
+static jmp_buf jmpbuf;
 
 static void restore_exec_to_jmpbuf(void)
 {
-- 
2.25.4


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

* Re: [kvm-unit-tests PATCH] x86: fix build with GCC10
  2020-06-17 15:21 [kvm-unit-tests PATCH] x86: fix build with GCC10 Vitaly Kuznetsov
@ 2020-06-22 15:03 ` Claudio Imbrenda
  2020-06-22 17:22 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Claudio Imbrenda @ 2020-06-22 15:03 UTC (permalink / raw)
  To: Vitaly Kuznetsov; +Cc: kvm, Paolo Bonzini

On Wed, 17 Jun 2020 17:21:24 +0200
Vitaly Kuznetsov <vkuznets@redhat.com> wrote:

> kvm-unit-tests fail to build with GCC10:
> 
> /usr/bin/ld: lib/libcflat.a(usermode.o):
>   ./kvm-unit-tests/lib/x86/usermode.c:17:  multiple definition of
> `jmpbuf'; lib/libcflat.a(fault_test.o):
>   ./kvm-unit-tests/lib/x86/fault_test.c:3: first defined here
> 
> It seems that 'jmpbuf' doesn't need to be global in either of these
> files, make it static in both.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>

I stumbled upon the same issue, and I had independently tested this
exact solution :)

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Tested-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  lib/x86/fault_test.c | 2 +-
>  lib/x86/usermode.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/x86/fault_test.c b/lib/x86/fault_test.c
> index 078dae3da640..e15a21864562 100644
> --- a/lib/x86/fault_test.c
> +++ b/lib/x86/fault_test.c
> @@ -1,6 +1,6 @@
>  #include "fault_test.h"
>  
> -jmp_buf jmpbuf;
> +static jmp_buf jmpbuf;
>  
>  static void restore_exec_to_jmpbuf(void)
>  {
> diff --git a/lib/x86/usermode.c b/lib/x86/usermode.c
> index f01ad9be1799..f0325236dd05 100644
> --- a/lib/x86/usermode.c
> +++ b/lib/x86/usermode.c
> @@ -14,7 +14,7 @@
>  #define USERMODE_STACK_SIZE	0x2000
>  #define RET_TO_KERNEL_IRQ	0x20
>  
> -jmp_buf jmpbuf;
> +static jmp_buf jmpbuf;
>  
>  static void restore_exec_to_jmpbuf(void)
>  {


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

* Re: [kvm-unit-tests PATCH] x86: fix build with GCC10
  2020-06-17 15:21 [kvm-unit-tests PATCH] x86: fix build with GCC10 Vitaly Kuznetsov
  2020-06-22 15:03 ` Claudio Imbrenda
@ 2020-06-22 17:22 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-06-22 17:22 UTC (permalink / raw)
  To: Vitaly Kuznetsov, kvm

On 17/06/20 17:21, Vitaly Kuznetsov wrote:
> kvm-unit-tests fail to build with GCC10:
> 
> /usr/bin/ld: lib/libcflat.a(usermode.o):
>   ./kvm-unit-tests/lib/x86/usermode.c:17:  multiple definition of `jmpbuf';
>  lib/libcflat.a(fault_test.o):
>   ./kvm-unit-tests/lib/x86/fault_test.c:3: first defined here
> 
> It seems that 'jmpbuf' doesn't need to be global in either of these files,
> make it static in both.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  lib/x86/fault_test.c | 2 +-
>  lib/x86/usermode.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/x86/fault_test.c b/lib/x86/fault_test.c
> index 078dae3da640..e15a21864562 100644
> --- a/lib/x86/fault_test.c
> +++ b/lib/x86/fault_test.c
> @@ -1,6 +1,6 @@
>  #include "fault_test.h"
>  
> -jmp_buf jmpbuf;
> +static jmp_buf jmpbuf;
>  
>  static void restore_exec_to_jmpbuf(void)
>  {
> diff --git a/lib/x86/usermode.c b/lib/x86/usermode.c
> index f01ad9be1799..f0325236dd05 100644
> --- a/lib/x86/usermode.c
> +++ b/lib/x86/usermode.c
> @@ -14,7 +14,7 @@
>  #define USERMODE_STACK_SIZE	0x2000
>  #define RET_TO_KERNEL_IRQ	0x20
>  
> -jmp_buf jmpbuf;
> +static jmp_buf jmpbuf;
>  
>  static void restore_exec_to_jmpbuf(void)
>  {
> 

Applied, thanks.

Paolo


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

end of thread, other threads:[~2020-06-22 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 15:21 [kvm-unit-tests PATCH] x86: fix build with GCC10 Vitaly Kuznetsov
2020-06-22 15:03 ` Claudio Imbrenda
2020-06-22 17:22 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.