* Re: [PATCH] kbuild: avoid scripts/kallsyms parsing /dev/null
2024-08-07 18:03 ` [PATCH] kbuild: avoid scripts/kallsyms parsing /dev/null Masahiro Yamada
@ 2024-08-07 18:29 ` Nicolas Schier
2024-08-07 19:03 ` Daniel Gomez
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2024-08-07 18:29 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Daniel Gomez, Ard Biesheuvel,
Nathan Chancellor
[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]
On Thu 08 Aug 2024 03:03:00 GMT, Masahiro Yamada wrote:
> On macOS, getline() sets ENOTTY to errno if it is requested to read
> from /dev/null.
>
> If this is worth fixing, I would rather pass an empty file to
> scripts/kallsyms instead of adding the ugly #ifdef __APPLE__.
>
> Fixes: c442db3f49f2 ("kbuild: remove PROVIDE() for kallsyms symbols")
> Reported-by: Daniel Gomez <da.gomez@samsung.com>
> Closes: https://lore.kernel.org/all/20240807-macos-build-support-v1-12-4cd1ded85694@samsung.com/
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> scripts/link-vmlinux.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index f7b2503cdba9..41c68ae3415d 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -219,7 +219,8 @@ kallsymso=
> strip_debug=
>
> if is_enabled CONFIG_KALLSYMS; then
> - kallsyms /dev/null .tmp_vmlinux0.kallsyms
> + truncate -s0 .tmp_vmlinux.kallsyms0.syms
> + kallsyms .tmp_vmlinux.kallsyms0.syms .tmp_vmlinux0.kallsyms
> fi
>
> if is_enabled CONFIG_KALLSYMS || is_enabled CONFIG_DEBUG_INFO_BTF; then
> --
> 2.43.0
>
>
Thanks! I definitely support moving special MacOS support from source
code into scripts and Makefiles.
Might you want to add a comment to truncate, to prevent accidental
attempts to revert/refactor this?
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Kind regards,
Nicolas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] kbuild: avoid scripts/kallsyms parsing /dev/null
2024-08-07 18:03 ` [PATCH] kbuild: avoid scripts/kallsyms parsing /dev/null Masahiro Yamada
2024-08-07 18:29 ` Nicolas Schier
@ 2024-08-07 19:03 ` Daniel Gomez
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Gomez @ 2024-08-07 19:03 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Ard Biesheuvel, Nathan Chancellor,
Nicolas Schier
On Thu, Aug 08, 2024 at 03:03:00AM GMT, Masahiro Yamada wrote:
> On macOS, getline() sets ENOTTY to errno if it is requested to read
> from /dev/null.
>
> If this is worth fixing, I would rather pass an empty file to
> scripts/kallsyms instead of adding the ugly #ifdef __APPLE__.
>
> Fixes: c442db3f49f2 ("kbuild: remove PROVIDE() for kallsyms symbols")
> Reported-by: Daniel Gomez <da.gomez@samsung.com>
> Closes: https://lore.kernel.org/all/20240807-macos-build-support-v1-12-4cd1ded85694@samsung.com/
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> scripts/link-vmlinux.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index f7b2503cdba9..41c68ae3415d 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -219,7 +219,8 @@ kallsymso=
> strip_debug=
>
> if is_enabled CONFIG_KALLSYMS; then
> - kallsyms /dev/null .tmp_vmlinux0.kallsyms
> + truncate -s0 .tmp_vmlinux.kallsyms0.syms
This looks nicer. Thanks for a quick alternative!
I prefer self explained commands and use the larger argument if available:
truncate --size=0 .tmp_vmlinux.kallsyms0.syms
But other than that, LGTM.
Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
> + kallsyms .tmp_vmlinux.kallsyms0.syms .tmp_vmlinux0.kallsyms
> fi
>
> if is_enabled CONFIG_KALLSYMS || is_enabled CONFIG_DEBUG_INFO_BTF; then
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread