Skip to contentSkip to conversation

rust: Use awk instead of recent xargs

PATCH Applied Matthew Maurer 4 participants 4 messages Sep 28, 2023 – Oct 15, 2023 Rust

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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).

---

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(-)
rust/Makefile +1 -3
index 87958e864be0..c4e583e9e443 100644
@@ -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)
Signature · 1 line
2.42.0.582.g8ccd20d70d-goog
reviewer Reviewed-by Tested-by on v2 1/1
#2 lore raw
In reply to Matthew Maurer
Quoted 6 lines · Matthew Maurer

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

Tested both in an Android and non-Android build.