linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: dummy-tools: pretend we understand -fpatchable-function-entry
@ 2023-10-30 11:34 Jiri Slaby (SUSE)
  2023-10-31 16:09 ` Nathan Chancellor
  2023-11-01 14:30 ` Masahiro Yamada
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-10-30 11:34 UTC (permalink / raw)
  To: masahiroy
  Cc: linux-kernel, Jiri Slaby (SUSE),
	Nathan Chancellor, Nick Desaulniers, Nicolas Schier,
	linux-kbuild, Naveen N Rao, Christophe Leroy, Michael Ellerman

Commit 0f71dcfb4aef (powerpc/ftrace: Add support for
-fpatchable-function-entry) added a script to check for
-fpatchable-function-entry compiler support. The script expects compiler
to emit the section __patchable_function_entries and few nops after a
function entry.

If the compiler understands and emits the above,
CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY is set.

So teach dummy-tools' gcc about this.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nicolas Schier <nicolas@fjasle.eu>
Cc: linux-kbuild@vger.kernel.org
Cc: Naveen N Rao <naveen@kernel.org>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Michael Ellerman <mpe@ellerman.id.au>
---
 scripts/dummy-tools/gcc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/scripts/dummy-tools/gcc b/scripts/dummy-tools/gcc
index 07f6dc4c5cf6..e6c41427c02f 100755
--- a/scripts/dummy-tools/gcc
+++ b/scripts/dummy-tools/gcc
@@ -91,6 +91,16 @@ if arg_contain -S "$@"; then
 		fi
 		exit 0
 	fi
+
+	# For arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh
+	if arg_contain -m64 "$@" && arg_contain -fpatchable-function-entry=2 "$@"; then
+		echo "func:"
+		echo ".section __patchable_function_entries"
+		echo ".localentry"
+		echo "  nop"
+		echo "  nop"
+		exit 0
+	fi
 fi
 
 # To set GCC_PLUGINS
-- 
2.42.0


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

* Re: [PATCH] kbuild: dummy-tools: pretend we understand -fpatchable-function-entry
  2023-10-30 11:34 [PATCH] kbuild: dummy-tools: pretend we understand -fpatchable-function-entry Jiri Slaby (SUSE)
@ 2023-10-31 16:09 ` Nathan Chancellor
  2023-11-01 14:30 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2023-10-31 16:09 UTC (permalink / raw)
  To: Jiri Slaby (SUSE)
  Cc: masahiroy, linux-kernel, Nick Desaulniers, Nicolas Schier,
	linux-kbuild, Naveen N Rao, Christophe Leroy, Michael Ellerman

On Mon, Oct 30, 2023 at 12:34:16PM +0100, Jiri Slaby (SUSE) wrote:
> Commit 0f71dcfb4aef (powerpc/ftrace: Add support for
> -fpatchable-function-entry) added a script to check for
> -fpatchable-function-entry compiler support. The script expects compiler
> to emit the section __patchable_function_entries and few nops after a
> function entry.
> 
> If the compiler understands and emits the above,
> CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY is set.
> 
> So teach dummy-tools' gcc about this.
> 
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Nicolas Schier <nicolas@fjasle.eu>
> Cc: linux-kbuild@vger.kernel.org
> Cc: Naveen N Rao <naveen@kernel.org>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> ---

This seems reasonable to me. I did not test it but it seems like it
should work based on my reading of gcc-check-fpatchable-function-entry.sh.

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

One minor nit, there should be quotes around the subject of 0f71dcfb4aef
in the commit message, should there need to be a v2 for some reason.

>  scripts/dummy-tools/gcc | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/scripts/dummy-tools/gcc b/scripts/dummy-tools/gcc
> index 07f6dc4c5cf6..e6c41427c02f 100755
> --- a/scripts/dummy-tools/gcc
> +++ b/scripts/dummy-tools/gcc
> @@ -91,6 +91,16 @@ if arg_contain -S "$@"; then
>  		fi
>  		exit 0
>  	fi
> +
> +	# For arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh
> +	if arg_contain -m64 "$@" && arg_contain -fpatchable-function-entry=2 "$@"; then
> +		echo "func:"
> +		echo ".section __patchable_function_entries"
> +		echo ".localentry"
> +		echo "  nop"
> +		echo "  nop"
> +		exit 0
> +	fi
>  fi
>  
>  # To set GCC_PLUGINS
> -- 
> 2.42.0
> 

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

* Re: [PATCH] kbuild: dummy-tools: pretend we understand -fpatchable-function-entry
  2023-10-30 11:34 [PATCH] kbuild: dummy-tools: pretend we understand -fpatchable-function-entry Jiri Slaby (SUSE)
  2023-10-31 16:09 ` Nathan Chancellor
@ 2023-11-01 14:30 ` Masahiro Yamada
  1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2023-11-01 14:30 UTC (permalink / raw)
  To: Jiri Slaby (SUSE)
  Cc: linux-kernel, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, linux-kbuild, Naveen N Rao, Christophe Leroy,
	Michael Ellerman

On Mon, Oct 30, 2023 at 8:34 PM Jiri Slaby (SUSE) <jirislaby@kernel.org> wrote:
>
> Commit 0f71dcfb4aef (powerpc/ftrace: Add support for
> -fpatchable-function-entry) added a script to check for
> -fpatchable-function-entry compiler support. The script expects compiler
> to emit the section __patchable_function_entries and few nops after a
> function entry.
>
> If the compiler understands and emits the above,
> CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY is set.
>
> So teach dummy-tools' gcc about this.
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Nicolas Schier <nicolas@fjasle.eu>
> Cc: linux-kbuild@vger.kernel.org
> Cc: Naveen N Rao <naveen@kernel.org>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> ---


Applied to linux-kbuild.
Thanks.




-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2023-11-01 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 11:34 [PATCH] kbuild: dummy-tools: pretend we understand -fpatchable-function-entry Jiri Slaby (SUSE)
2023-10-31 16:09 ` Nathan Chancellor
2023-11-01 14:30 ` Masahiro Yamada

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