From patchwork Mon Jan 4 12:26:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Holmes X-Patchwork-Id: 1422059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=outlook.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=pVPwAZK3; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=outlook.com header.i=@outlook.com header.a=rsa-sha256 header.s=selector1 header.b=cTbMC+vi; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D8ZhD01GQz9sTv for ; Mon, 4 Jan 2021 23:29:47 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ugEyv8Cn7qz95H/4wbWaRIka7pA5KpNq8YYgQRBKW7U=; b=pVPwAZK3ICEHLci12rDaT/AMz DV8weaWDZT5ivvwryJN8VtNF0oOrnNzli9FCBBBmyXZk8mtVIuCwbiZClq31QztzR1VgS20Feol3A 3eaIGo4rRPHbL139+Qu+kh2LoNEa2/mQAcKOjIQUv7aCGNycyntx9R8GxOO5mKcxoWOv0vAv1J8gD J1pElhkIFKySeGpHNSrXd+rl1Irgl0Nab5apMCFsv21Bc1jvcDOBKE+kDEdp67FrH6g0kKZ/EIBzE kBa7NIVDFi61lMcIMeAyVVogTm6NmdJ6NLiRfijSbjBFsWpH5iqZj8lwD0MY9HtNlgLVCO5fm4CAn KUegGzkAw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwOxU-0000it-7Z; Mon, 04 Jan 2021 12:27:36 +0000 Received: from mail-oln040092253081.outbound.protection.outlook.com ([40.92.253.81] helo=APC01-SG2-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwOxN-0000Xc-0V for openwrt-devel@lists.openwrt.org; Mon, 04 Jan 2021 12:27:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OqJ+XbRsu1fK6qhWYQ4XBjivkVhf3VmtjccKInQSNuyqB9JmGB+7zUrWxem1PL5LiZZwGrH7FFDtQrYhfkiyYff95mVAWelCty0poyzimk0ZNgTOgUmAZlx7IfqMSVdWVQdcMmVIUjrgtRyI/AXoINUOPr9RmOK6HSerc86otjjFHvCz2YrfDMxwbQfKnmgEtPSWJy+Rw3ywR5W97+JEUCNk1PV7UkGmRMsx6URmmaqV5d0Z5QaGUEw9UNeVy2svKC0uFto9p2QJTa2anAVpWe08gAzEp78DtCI2+E6ub9V+y5trdgSYYFass6jhjCxakeOJuSUOnlS66aAemW0Jnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ae5RpJ25Yf3l0IKJjCIjoqa/NqSkjuYJESUrEPSLXMc=; b=awycMu1GEG8g2xSe886e3IFTVjU1OxP8/cRchnp3fqrN58yjaFq9UVUYMxuWNNvccRAsAXfoWInM5bdcmJhDKX5+7fKHeq+eYqZMGr8sRKZW4WyvAwgdjZuJpK7JyeRbTGJ6Nct8XO20jz7Bf/iT20q3IClp1tqlBvUD2P3nkUC1m0YZ+OqYmAUIQnZN+EJtV3awW0ECss/VcmfyDil5Y1Lq/fyvDF7PG1J4408VUtOIB5BIOootm3t9pALrGbDQf0BS1Qb9deE2JQmbYR27CAay7nBq4+ayyWn7A721F5zLKeNqs6ZRjQSFEokNF21I6SBoe2FMxXhr41swS7PxRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ae5RpJ25Yf3l0IKJjCIjoqa/NqSkjuYJESUrEPSLXMc=; b=cTbMC+viNHAR7m4WJWV6muAr6+X1hzRGzDG40yOz/XGqQEydfyIsQ81Sj8CeZ/zcvMkTOK+xF8Ruv+PC9Tan9BpdKDw+lcf0j3WOXM6kXjVfqXBIQKxAehU8/WKCo1DFni8Cq0qy89SQHXEP2j/7LiLtqI/G9Z+yFCGi6HH5SODqIRJkIR8b6X3HJ7r9wd0QyCUxkV9qe8cGhtUurbQnWv0j7E5NNDNCb9P8GnFMTBSguGwyhCPbrs/2DGEhM28H1lIoWRpUuUAXKG5NFEl/Hz28SgZeEEw4AFrOYd04HtFCXgS4EQSY0227CviSBecmveVmG/EQA5un6e8s65gaTA== Received: from PU1APC01FT044.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebe::41) by PU1APC01HT052.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebe::304) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20; Mon, 4 Jan 2021 12:27:02 +0000 Received: from ME1PR01MB0817.ausprd01.prod.outlook.com (2a01:111:e400:7ebe::51) by PU1APC01FT044.mail.protection.outlook.com (2a01:111:e400:7ebe::276) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20 via Frontend Transport; Mon, 4 Jan 2021 12:27:02 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:55BD696D9C25D12236F07C6B9AEA5FBD129FA3291A9A8F51BBE6DB47499171ED; UpperCasedChecksum:01D765144E0DC043F577ABDFB0B4B280A10EBB253E57A7B47E1695AA05DAF2FE; SizeAsReceived:7509; Count:47 Received: from ME1PR01MB0817.ausprd01.prod.outlook.com ([fe80::f1e8:5c17:6812:9ca3]) by ME1PR01MB0817.ausprd01.prod.outlook.com ([fe80::f1e8:5c17:6812:9ca3%12]) with mapi id 15.20.3721.024; Mon, 4 Jan 2021 12:27:00 +0000 From: Ye Holmes To: rosenp@gmail.com Subject: [PATCH] scripts/ext-toolchain.sh: modify ar/ranlib scripts Date: Mon, 4 Jan 2021 20:26:44 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-TMN: [Oig5MvoWJFlcbNPBYQPCP5yExC5CE4E+] X-ClientProxiedBy: HK2PR04CA0078.apcprd04.prod.outlook.com (2603:1096:202:15::22) To ME1PR01MB0817.ausprd01.prod.outlook.com (2603:10c6:200:9::10) X-Microsoft-Original-Message-ID: <20210104122644.18609-1-yeholmes@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (183.128.218.88) by HK2PR04CA0078.apcprd04.prod.outlook.com (2603:1096:202:15::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.20 via Frontend Transport; Mon, 4 Jan 2021 12:26:57 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 02b708c9-6dcc-497a-c74a-08d8b0ac091e X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR2IyYojA6dLi/HrZY+yetAAmowsEjjxJp0fQVZl+TTeynDdxhTuVbcRvQeMGWgvQyk3/SjuffAZ0mtLrcvBJQiW113kIeK4Jn0lpchmjqh03wYwyu9kWOnzameRdklkRAtfmkNUimxJtsjMrSZcEd4BGC6QdnLjlhImaXU3kabCIc69So+B78p4FSEM/LJIdnwLvjVMcA7X4nzeVIA/3upUz/LUcotXbSrR+qFPPhlwKBiBm+NTi9iWlkOAo3Ob+YVKXYtXH62UkNmFXdP33ozPAajZt4o6CQ25iUqUgU+4QJ0ULWQjJGO+VzZ7ThdfjxPh7Uocs6AKT8t4iDcW4bPIoMWuCX9Ur3NEWW4hB8wmrDGTWRBACaTHzixCI/jfwvlhDgKbrz6CO/Agn0j1FThL0hlCeqiF9C20C+JQO7/Vxd1DqQRjkCDt1fvmU3pbKM82ZMZpMWAs9xGAYslvEG5ikgP/nIpNAQPGAHSmvwvx/s5/Y5yEQnDRQj3eTsA3oO9T7RK7prDlSi8ERceSBTfXKIKBoqCX+uMn2Jn6oyHM+Mpjv5ILT4pjLvn6xF2Z/RAoZCWzr/86fwLGsVoe0Qrq9sTLyIE3ya6vVu8d7koZ7O/3pfUIx5eeZ7HSE9ce6FYuPaDjxa1b9CcnYwIQWT/xJJC4GMd1160PPztfebiXXCWqAPSMKP3mNTUTWY3k4Y9RdRnDpQl5w8epZAEQxBpqnQSIy6cSaNHr+njJ340HgL6IfXKn7s6rdIiFDEBHRE= X-MS-TrafficTypeDiagnostic: PU1APC01HT052: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RY8ITFp/bcbI306Chxw9RjLHOEj2xud+goEeCe0MHjDGY8sc2s/tFC269TWWV+HwdCQ8ZdzMA6KBND94iwMCbIZOf/a5CRk8mWpyTUo1jsUthM9d/B9Eht5DGYncG2Vj1jt744IVV8R1HD03/qw4/Z6fXo1CJh+GePjZ/Ee5yZjhRAdeN3datiP1L4UIhTznnerJqeH5mdFLtPtRvNEan6sp4fi101hNhMN3sNA/c6sCyWFOpia8iCCWVgAmRDCf X-MS-Exchange-AntiSpam-MessageData: gfGVPp7PEsEU3I2XXMTiTYkfTyEZPeFAKx2r5bBj3fp688vDtFu0wnB4ArpbaWyq0/SXTFs5WfyD7CInrFWiTphnjUV9jCc+Af9v5XgC1AXzEuPzrpyhI0FXG7Mi/wWxDI/yrPbR9ajIr6kHZKnJ3w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2021 12:27:00.5321 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 02b708c9-6dcc-497a-c74a-08d8b0ac091e X-MS-Exchange-CrossTenant-AuthSource: PU1APC01FT044.eop-APC01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PU1APC01HT052 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210104_072729_219963_267E796B X-CRM114-Status: GOOD ( 10.19 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [40.92.253.81 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.92.253.81 listed in wl.mailspike.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [yeholmes[at]outlook.com] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sven.wegener@stealer.net, Ye Holmes , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Modify external toolchain scripts `PREFIX-ar and `PREFIX-ranlib to handle object files compiled with LTO enabled; and simplify external toolchain scripts `PREFIX-gcc-ar and `PREFIX-gcc-ranlib to avoid failing to create static library archives. Signed-off-by: Ye Holmes --- Using external prebuilt gcc toolchain, fails to create valid static libraries via `PREFIX-ar tool due to LTO compilation flag, which a number of packages has enabled, for example: aarch64-none-linux-gnu-ar: CMakeFiles/ubusd_library.dir/ubusd.c.o: plugin needed to handle lto object aarch64-none-linux-gnu-ranlib: libubusd_library.a(ubusd.c.o): plugin needed to handle lto object [ 70%] Linking C executable ubusd openwrt/tmp/ubusd.lX2qbV.ltrans0.ltrans.o: in function `ubus_msg_dequeue': ubus-2020-12-04-d1d9ddf9/ubusd_main.c:32: undefined reference to `ubus_msg_free' One possible solution is to force the `PREFIX-ar script to invoke `PREFIX-gcc-ar (and `PREFIX-gcc-ranlib) unconditionally: $ cat ./staging_dir/PREFIX/bin/aarch64-none-linux-gnu-ar exec "/path/to/external/toolchain/aarch64-none-linux-gnu-gcc-ar" "$@" Another problem with `PREFIX-gcc-ar and `PREFIX-gcc-ranlib is that they have too many unnecessary options in the generated scripts, so that they essentially does not work properly: aarch64-none-linux-gnu-gcc-ar cr hostapd_multi.a LIST-OBJECTS.o: aarch64-none-linux-gnu/bin/ar: two different operation options specified A tested solution is to simplify `PREFIX-gcc-ar and `PREFIX-gcc-ranlib scripts, the result is that `PREFIX-ar and `PREFIX-gcc-ar are identical, while `PREFIX-ranlib and `PREFIX-gcc-ranlib scripts are identical, too. --- scripts/ext-toolchain.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh index ee7d9532f5..27c168789a 100755 --- a/scripts/ext-toolchain.sh +++ b/scripts/ext-toolchain.sh @@ -198,6 +198,33 @@ find_bins() { return 1 } +wrap_bin_ar() { + local out="$1" + local bin="$2" + + echo '#!/bin/sh' > "$out" + if [[ "$bin" =~ .+gcc-ar$ ]] ; then + echo 'exec "'"$bin"'" "$@"' >> "$out" + else + echo 'exec "'"${bin%-ar}-gcc-ar"'" "$@"' >> "$out" + fi + + chmod +x "$out" +} + +wrap_bin_ranlib() { + local out="$1" + local bin="$2" + + echo '#!/bin/sh' > "$out" + if [[ "$bin" =~ .+gcc-ranlib$ ]] ; then + echo 'exec "'"$bin"'" "$@"' >> "$out" + else + echo 'exec "'"${bin%-ranlib}-gcc-ranlib"'" "$@"' >> "$out" + fi + + chmod +x "$out" +} wrap_bin_cc() { local out="$1" @@ -256,6 +283,12 @@ wrap_bins() { fi case "${cmd##*/}" in + *-ar) + wrap_bin_ar "$out" "$bin" + ;; + *-ranlib) + wrap_bin_ranlib "$out" "$bin" + ;; *-*cc|*-*cc-*|*-*++|*-*++-*|*-cpp) wrap_bin_cc "$out" "$bin" ;;