public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/kvm: Move kvm_fastop_exception to .fixup section
@ 2017-10-04 14:43 Josh Poimboeuf
  2017-10-04 15:16 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Poimboeuf @ 2017-10-04 14:43 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Guenter Roeck

When compiling the kernel with the '-frecord-gcc-switches' flag, objtool
complains:

  arch/x86/kvm/emulate.o: warning: objtool: .GCC.command.line+0x0: special: can't find new instruction

And also the kernel fails to link.

The problem is that the 'kvm_fastop_exception' code gets placed into the
throwaway '.GCC.command.line' section instead of '.text'.

Exception fixup code is conventionally placed in the '.fixup' section,
so put it there where it belongs.

Reported-and-tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/kvm/emulate.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a36254cbf776..d90cdc77e077 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
 	#op " %al \n\t" \
 	FOP_RET
 
-asm(".global kvm_fastop_exception \n"
-    "kvm_fastop_exception: xor %esi, %esi; ret");
+asm(".pushsection .fixup, \"ax\"\n"
+    ".global kvm_fastop_exception \n"
+    "kvm_fastop_exception: xor %esi, %esi; ret\n"
+    ".popsection");
 
 FOP_START(setcc)
 FOP_SETCC(seto)
-- 
2.13.6

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

* Re: [PATCH] x86/kvm: Move kvm_fastop_exception to .fixup section
  2017-10-04 14:43 [PATCH] x86/kvm: Move kvm_fastop_exception to .fixup section Josh Poimboeuf
@ 2017-10-04 15:16 ` Guenter Roeck
  2017-10-04 15:36   ` Josh Poimboeuf
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2017-10-04 15:16 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: x86, linux-kernel

On Wed, Oct 04, 2017 at 09:43:06AM -0500, Josh Poimboeuf wrote:
> When compiling the kernel with the '-frecord-gcc-switches' flag, objtool
> complains:
> 
>   arch/x86/kvm/emulate.o: warning: objtool: .GCC.command.line+0x0: special: can't find new instruction
> 
> And also the kernel fails to link.
> 
> The problem is that the 'kvm_fastop_exception' code gets placed into the
> throwaway '.GCC.command.line' section instead of '.text'.
> 
> Exception fixup code is conventionally placed in the '.fixup' section,
> so put it there where it belongs.
> 
> Reported-and-tested-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>

Thanks!

Guenter

> ---
>  arch/x86/kvm/emulate.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index a36254cbf776..d90cdc77e077 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
>  	#op " %al \n\t" \
>  	FOP_RET
>  
> -asm(".global kvm_fastop_exception \n"
> -    "kvm_fastop_exception: xor %esi, %esi; ret");
> +asm(".pushsection .fixup, \"ax\"\n"
> +    ".global kvm_fastop_exception \n"
> +    "kvm_fastop_exception: xor %esi, %esi; ret\n"
> +    ".popsection");
>  
>  FOP_START(setcc)
>  FOP_SETCC(seto)
> -- 
> 2.13.6
> 

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

* Re: [PATCH] x86/kvm: Move kvm_fastop_exception to .fixup section
  2017-10-04 15:16 ` Guenter Roeck
@ 2017-10-04 15:36   ` Josh Poimboeuf
  0 siblings, 0 replies; 5+ messages in thread
From: Josh Poimboeuf @ 2017-10-04 15:36 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: x86, linux-kernel

On Wed, Oct 04, 2017 at 08:16:36AM -0700, Guenter Roeck wrote:
> On Wed, Oct 04, 2017 at 09:43:06AM -0500, Josh Poimboeuf wrote:
> > When compiling the kernel with the '-frecord-gcc-switches' flag, objtool
> > complains:
> > 
> >   arch/x86/kvm/emulate.o: warning: objtool: .GCC.command.line+0x0: special: can't find new instruction
> > 
> > And also the kernel fails to link.
> > 
> > The problem is that the 'kvm_fastop_exception' code gets placed into the
> > throwaway '.GCC.command.line' section instead of '.text'.
> > 
> > Exception fixup code is conventionally placed in the '.fixup' section,
> > so put it there where it belongs.
> > 
> > Reported-and-tested-by: Guenter Roeck <linux@roeck-us.net>
> > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> 
> Thanks!

I forgot to add the kvm maintainers to CC.  Will resend.

-- 
Josh

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

* [PATCH] x86/kvm: Move kvm_fastop_exception to .fixup section
@ 2017-10-04 15:39 Josh Poimboeuf
  2017-10-05  6:54 ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Poimboeuf @ 2017-10-04 15:39 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář
  Cc: x86, linux-kernel, kvm, Guenter Roeck

When compiling the kernel with the '-frecord-gcc-switches' flag, objtool
complains:

  arch/x86/kvm/emulate.o: warning: objtool: .GCC.command.line+0x0: special: can't find new instruction

And also the kernel fails to link.

The problem is that the 'kvm_fastop_exception' code gets placed into the
throwaway '.GCC.command.line' section instead of '.text'.

Exception fixup code is conventionally placed in the '.fixup' section,
so put it there where it belongs.

Reported-and-tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/kvm/emulate.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a36254cbf776..d90cdc77e077 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
 	#op " %al \n\t" \
 	FOP_RET
 
-asm(".global kvm_fastop_exception \n"
-    "kvm_fastop_exception: xor %esi, %esi; ret");
+asm(".pushsection .fixup, \"ax\"\n"
+    ".global kvm_fastop_exception \n"
+    "kvm_fastop_exception: xor %esi, %esi; ret\n"
+    ".popsection");
 
 FOP_START(setcc)
 FOP_SETCC(seto)
-- 
2.13.6

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

* Re: [PATCH] x86/kvm: Move kvm_fastop_exception to .fixup section
  2017-10-04 15:39 Josh Poimboeuf
@ 2017-10-05  6:54 ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2017-10-05  6:54 UTC (permalink / raw)
  To: Josh Poimboeuf, Radim Krčmář
  Cc: x86, linux-kernel, kvm, Guenter Roeck

On 04/10/2017 17:39, Josh Poimboeuf wrote:
> When compiling the kernel with the '-frecord-gcc-switches' flag, objtool
> complains:
> 
>   arch/x86/kvm/emulate.o: warning: objtool: .GCC.command.line+0x0: special: can't find new instruction
> 
> And also the kernel fails to link.
> 
> The problem is that the 'kvm_fastop_exception' code gets placed into the
> throwaway '.GCC.command.line' section instead of '.text'.
> 
> Exception fixup code is conventionally placed in the '.fixup' section,
> so put it there where it belongs.
> 
> Reported-and-tested-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  arch/x86/kvm/emulate.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index a36254cbf776..d90cdc77e077 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
>  	#op " %al \n\t" \
>  	FOP_RET
>  
> -asm(".global kvm_fastop_exception \n"
> -    "kvm_fastop_exception: xor %esi, %esi; ret");
> +asm(".pushsection .fixup, \"ax\"\n"
> +    ".global kvm_fastop_exception \n"
> +    "kvm_fastop_exception: xor %esi, %esi; ret\n"
> +    ".popsection");
>  
>  FOP_START(setcc)
>  FOP_SETCC(seto)
> 


Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

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

end of thread, other threads:[~2017-10-05  6:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-04 14:43 [PATCH] x86/kvm: Move kvm_fastop_exception to .fixup section Josh Poimboeuf
2017-10-04 15:16 ` Guenter Roeck
2017-10-04 15:36   ` Josh Poimboeuf
  -- strict thread matches above, loose matches on Subject: below --
2017-10-04 15:39 Josh Poimboeuf
2017-10-05  6:54 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox