2023-09-29 06:59:23

by Matthew Maurer

[permalink] [raw]
Subject: [PATCH v2] rust: Use awk instead of recent xargs

`awk` is already required by the kernel build, and the `xargs` feature
used in current Rust detection is not present in all `xargs` (notably,
toybox based xargs, used in the Android kernel build).

Signed-off-by: Matthew Maurer <[email protected]>
---

I absorbed the grep and cut into the awk command as well, as Joe Perches
suggested.

rust/Makefile | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/rust/Makefile b/rust/Makefile
index 87958e864be0..c4e583e9e443 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -364,9 +364,7 @@ $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers.c FORCE
quiet_cmd_exports = EXPORTS $@
cmd_exports = \
$(NM) -p --defined-only $< \
- | grep -E ' (T|R|D) ' | cut -d ' ' -f 3 \
- | xargs -Isymbol \
- echo 'EXPORT_SYMBOL_RUST_GPL(symbol);' > $@
+ | awk '/ (T|R|D) / {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@

$(obj)/exports_core_generated.h: $(obj)/core.o FORCE
$(call if_changed,exports)
--
2.42.0.582.g8ccd20d70d-goog


2023-10-02 09:32:52

by Alice Ryhl

[permalink] [raw]
Subject: Re: [PATCH v2] rust: Use awk instead of recent xargs

On Thu, Sep 28, 2023 at 10:50 PM Matthew Maurer <[email protected]> wrote:
>
> `awk` is already required by the kernel build, and the `xargs` feature
> used in current Rust detection is not present in all `xargs` (notably,
> toybox based xargs, used in the Android kernel build).
>
> Signed-off-by: Matthew Maurer <[email protected]>

Tested both in an Android and non-Android build.

Reviewed-by: Alice Ryhl <[email protected]>
Tested-by: Alice Ryhl <[email protected]>

2023-10-15 20:07:04

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH v2] rust: Use awk instead of recent xargs

On Thu, Sep 28, 2023 at 10:50 PM Matthew Maurer <[email protected]> wrote:
>
> `awk` is already required by the kernel build, and the `xargs` feature
> used in current Rust detection is not present in all `xargs` (notably,
> toybox based xargs, used in the Android kernel build).
>
> Signed-off-by: Matthew Maurer <[email protected]>

Applied to `rust-next` -- thanks everyone!

Cheers,
Miguel