From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28682E7F154 for ; Fri, 29 Sep 2023 21:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233516AbjI2VgP convert rfc822-to-8bit (ORCPT ); Fri, 29 Sep 2023 17:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjI2VgN (ORCPT ); Fri, 29 Sep 2023 17:36:13 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE2861AB for ; Fri, 29 Sep 2023 14:36:11 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-95-t2b_ZynWOe24ksn49Kg4FA-1; Fri, 29 Sep 2023 22:36:08 +0100 X-MC-Unique: t2b_ZynWOe24ksn49Kg4FA-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 29 Sep 2023 22:36:06 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Fri, 29 Sep 2023 22:36:06 +0100 From: David Laight To: 'Joe Perches' , Matthew Maurer , Miguel Ojeda , Alex Gaynor , "Wedson Almeida Filho" CC: Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , "Alice Ryhl" , "rust-for-linux@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] rust: Use awk instead of recent xargs Thread-Topic: [PATCH] rust: Use awk instead of recent xargs Thread-Index: AQHZ8kr/VXhkUs4M10WbSSTh7+OPhLAyVEjw Date: Fri, 29 Sep 2023 21:36:06 +0000 Message-ID: References: <20230928202116.2298150-1-mmaurer@google.com> <106c8bdb960da1568d0b3879efa76cd2acec032e.camel@perches.com> In-Reply-To: <106c8bdb960da1568d0b3879efa76cd2acec032e.camel@perches.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joe Perches > Sent: 28 September 2023 21:33 > > On Thu, 2023-09-28 at 20:21 +0000, Matthew Maurer 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). > [] > > diff --git a/rust/Makefile b/rust/Makefile > [] > > @@ -365,8 +365,7 @@ 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 'NF {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$0}' > $@ > > Perhaps remove the cut as well and use $$3 instead of $$0 ? > Maybe integrate the grep as well. Or keep the grep and use a shell loop? grep -E ' (T|R|D) ' | while read val flag symbol; do \ echo "EXPORT_SYMBOL_RUST_GPL($symbol);"; done (The grep is typically much faster than a shell conditional.) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)