From patchwork Wed Jun 8 14:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shahab Vahedi X-Patchwork-Id: 12873587 X-Patchwork-Delegate: bpf@iogearbox.net 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 0FEB4C433EF for ; Wed, 8 Jun 2022 14:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241247AbiFHO3h (ORCPT ); Wed, 8 Jun 2022 10:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241117AbiFHO3f (ORCPT ); Wed, 8 Jun 2022 10:29:35 -0400 Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 557DE38C751 for ; Wed, 8 Jun 2022 07:29:34 -0700 (PDT) Received: from mailhost.synopsys.com (badc-mailhost1.synopsys.com [10.192.0.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id D4223C00B4 for ; Wed, 8 Jun 2022 14:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1654698573; bh=6JvkDIPUotM6x8XBcaH41jHFBD7d0jqxgh5GkfiSBMs=; h=From:To:CC:Subject:Date:From; b=OGH0Xd7hcaAZ2PvQVgd0HW2LtBS02DMSK1k5qZDi9p1gV6uoGbPAq0KsrIAuRxK50 9BGPJjGejcmiLjjbPmVSFQ1Bz/aMLtkVjHvboUst4H76qwkG+xTH3HNhqSZ4kqMHkA i69lDJj6FFxJ5vcO5IB5kKN/+J7gKmpq/zRebs46rkjzRMLeAdUVHNZWIEW2zAAkpu nFtpo1Ihl15u1nP+7enufuo7lLvrRLlVf/UsKj33G+D8LfA8v13MDqfavaiaOh2mo6 NvV7yVPuntemCy6YipzmIq5Qd+IkUU6rxTsNu3RGxiWhilp0V59fHojnrTDKmVlQCc DLuWygiU51lnA== Received: from o365relay-in.synopsys.com (sv2-o365relay3.synopsys.com [10.202.1.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (verified OK)) by mailhost.synopsys.com (Postfix) with ESMTPS id 48373A0071 for ; Wed, 8 Jun 2022 14:29:32 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id AAF2540086 for ; Wed, 8 Jun 2022 14:29:32 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=shahab@synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="KFTJ5kj6"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gf17bofdcnIkg8DfcKOKYGRrjal2vrVSj1fAdtus7hczNus0T+ecrUVs49pUz5S9AKgWJ9uAWtU0d+PZWoOTZqE6THn92MEr5fDjk+6aVy1NNYrbHeSPDzpWWhFM5CLjYme2jyOjG70hXDFncRosjnQdK87fpFAJzWWzLkPgNwwLSuLJ1dtsPU9xHFLVmW3NDPqtPzcQS/7DiuC5EhneP8FhLmeeN8RKx23RCf1TqHepkTo78EYjspWdT5tVI0Dy8Fhj8JxaNxmPzAbHt8AzrU8nDOufFKq/aHvGtqxwnvGdFxxKAEfOkm2pqv/nRXV/48gTZAVgabYq2ZyCNIPSRg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6JvkDIPUotM6x8XBcaH41jHFBD7d0jqxgh5GkfiSBMs=; b=Sw8RLsl2jufD2sUecOQB8W7OHcZ3p2qIrqflVchYzpyEg5o+WqAteMWBqoOiVQbjO1Wip43kAZQWlQtNySvp1yJk0WWY+vSvDRQZUx8ejRmm6pp3N/QMboRvRn/SwwE5Z/PoWdreF3q2mN6D0p9tqUbc64gN6ckqiNBTiBcH+TvP8Uinpf+UKLFXv1ZMMNvtkoqcdJFA2GwerYQeyUb4WOd4w+w3hyrXiInCJqfAhAFBFJab6v3Sw++bcjE9PWbOUMrRpkrShr68FOnMH5rFP1T8lunqeFWGCg+Ktl4tGj9otsyytTVJzRPm1i2EDbtssp06m310zMO9LdiyKo9FHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6JvkDIPUotM6x8XBcaH41jHFBD7d0jqxgh5GkfiSBMs=; b=KFTJ5kj6pbGXCLGSAD7g9uF8jPB6cZTkFvvFvVJ4zxAdtqcxsJrCCkbWWJ306H22vyAQj6K63+0m18atFTXw6DUtrrpDbaAbzsJeyQb6pJPGoqUIJ2Q3KGqlOW54tO8bMt3CF2qN4WMZ0bUmN7gjefdHkPkGLyVjgRFAcH/8hqs= Received: from SN6PR12MB2782.namprd12.prod.outlook.com (2603:10b6:805:73::19) by SN1PR12MB2575.namprd12.prod.outlook.com (2603:10b6:802:25::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.17; Wed, 8 Jun 2022 14:29:30 +0000 Received: from SN6PR12MB2782.namprd12.prod.outlook.com ([fe80::1175:61f1:71e9:2038]) by SN6PR12MB2782.namprd12.prod.outlook.com ([fe80::1175:61f1:71e9:2038%6]) with mapi id 15.20.5314.019; Wed, 8 Jun 2022 14:29:29 +0000 X-SNPS-Relay: synopsys.com From: Shahab Vahedi To: "bpf@vger.kernel.org" CC: Shahab Vahedi Subject: [PATCH] bpftool: Fix bootstrapping during a cross compilation Thread-Topic: [PATCH] bpftool: Fix bootstrapping during a cross compilation Thread-Index: AQHYe0Qp1eGJCiibuEuC+dJXsd+L2w== Date: Wed, 8 Jun 2022 14:29:28 +0000 Message-ID: <8d297f0c-cfd0-ef6f-3970-6dddb3d9a87a@synopsys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=synopsys.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e36a918d-1e11-4b37-f5a9-08da495b4ba0 x-ms-traffictypediagnostic: SN1PR12MB2575:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pMeCuuLnWq5/nhT/nQfvQ2ttBC2Fys6DzkxuYHHV/iN98JXvr6ZxxiYKpGCxcAOntwvV/FbQrEtDM2jgtW0v6Kml5jJrFrwR1LyPncoKxoJGtwOKCtW0uhT+ndiSLMQle/XTC90v9fzS8o8hpOjILW9lcuGIbr6zKf0URqRj1e/wX0FnQghY5IBNbpDNetpT6CsOSCUgqecmYnNHgJ641vhMdvE3eJ+Pf50SU2kF+NzB1TbozC64/DL8Jqbd7DKBWtOeaiBGW60pSmM/6LtRw7pRyrHUZClC2DPjy3xMy0QHKMUgLy2xzvVe36R4FiLk3I6w5+/wrTKv7+AKThSDkoirOfuC3h+IU37oJ0ijRbI460Wvmv/v0Oas4UaekSjMRYRIY0O74QM6B6V2EYOam0JEwfszf8PZtlU/NdjQgU0zp0os5c5C/sSprYqa9ePw9TBUnqOkYb91ThwoJuB2MZRMg2s1UA/ngdTe5IGkxY+ZOr0STfI065REsShg7p3POflOnF+D3zomEi2SBLZRtD23WYNRrws97pOMD9ykW1rgZt3WgaBk91L4YvkUzcnxXOBsizXn/iQTL6tyg7K6iHrnc7miQ0gAqD1uUgjXc9bssL9xwAkbBPnWLgIV8CXfMBDqwQ22MNS1IUIcmssg6tNdCImxdAw0shDJBU/+HdMlNyr9O+zvMr4ZRxBSKCBkgAHlYuVppvvsqEeuO1JkxBtZJnTon90t3d15UWBssm8= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2782.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(4326008)(6486002)(186003)(107886003)(6506007)(122000001)(38070700005)(36756003)(31696002)(86362001)(38100700002)(6512007)(2906002)(316002)(6916009)(76116006)(66946007)(66446008)(66476007)(64756008)(2616005)(66556008)(8676002)(91956017)(5660300002)(31686004)(508600001)(83380400001)(8936002)(71200400001)(45980500001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?5kvTaxKvCh9FaH0lLil7oM+X9L3l?= =?utf-8?q?F40k9jcufFvAjHeJiGBmTgns6JEJzLpEn0qiLf4kYVvh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XZjN/f3tjUyPJUq+e2c?= =?utf-8?q?fehHTQuabqlPyxdcG5zqwGDRmZ9RRjOIgkVjaSXtZcEow3Bk3yQbt5mFp1d1YPujU?= =?utf-8?q?uiHVnZ0D+PyIO4awsmeF8OYAsb613FM0TZtrtZvUxqZdNLt74+7f429N3QopMebaW?= =?utf-8?q?G4A4f7IN0UwjVmRuYooMUh6cFtpe3AYMlU10Ks5+7Zy41Z5GeUY2+vJCzbk7QAI6f?= =?utf-8?q?87PuEOf2iouToMAuG3HI0c51ePqZIg8jHyM63b6qqrHcvgyaLzxf4b7gGFHwrhx74?= =?utf-8?q?7mKqjVhXKqWab3bwB/LLH7fwG8EVxXpppZP01WZZ9b5AYH0DdA6v/mqKURrHzwiI7?= =?utf-8?q?VU50trw9S8FswrlYij0K99zoF+Qy4H06+V9N/GAhb82iWzcYg6oqAypqpcMkC4Hjj?= =?utf-8?q?Uf32L0F0Nixc8qjjDMess0BSBd/Ua1jn8miCv5Nk1viuT6xWmmRCMsRO9bVI8rl0l?= =?utf-8?q?dQosE4nge1dbV5v5kHzj9KEvnIzOY2bv3DidSWh0LDjfEjcFAi42J8vPAeGUmO5rD?= =?utf-8?q?0+CJK2YsfSQNK2GmS35TVzAjH7Z46/z97HCdDS7I8uMMADRjBUlGNvtgKwgA32n31?= =?utf-8?q?eWh6e6+KLpIy/x1QL78tkZvM/x/azghBlFOf/r30fSoVMGQRh68X/L4vOOA89WP28?= =?utf-8?q?tQgIm6wuZKz7iW+lugzdJ5rUa7yYQ2Cr5qYni51w6YwnXEAVumqXswQzx/BRB3+9g?= =?utf-8?q?EN4C7Oe+81vKCG0JhRXGHpf1XEWOQjubIZVLFMtN+eeKMHMaYPEx4=3D?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2782.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e36a918d-1e11-4b37-f5a9-08da495b4ba0 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2022 14:29:28.5725 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZnMDfKaOIFdvnDv7svxogsQkB4sYH8JD6icKQ7pOMIQfQBxtN997qRSWc69rZKuTVR/pnzZUbMtNgT+hxoHk9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2575 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org This change adjusts the Makefile to use "HOSTAR" as the archive tool to keep the sanity of the build process for the bootstrap part in check. For the rationale, please continue reading. When cross compiling bpftool with buildroot, it leads to an invocation like: $ AR="/path/to/buildroot/host/bin/arc-linux-gcc-ar" \ CC="/path/to/buildroot/host/bin/arc-linux-gcc" \ ... make Which in return fails while building the bootstrap section: ----------------------------------8<---------------------------------- make: Entering directory '/src/bpftool-v6.7.0/src' ... libbfd: [ on ] ... disassembler-four-args: [ on ] ... zlib: [ on ] ... libcap: [ OFF ] ... clang-bpf-co-re: [ on ] <-- triggers bootstrap . . . LINK /src/bpftool-v6.7.0/src/bootstrap/bpftool /usr/bin/ld: /src/bpftool-v6.7.0/src/bootstrap/libbpf/libbpf.a: error adding symbols: archive has no index; run ranlib to add one collect2: error: ld returned 1 exit status make: *** [Makefile:211: /src/bpftool-v6.7.0/src/bootstrap/bpftool] Error 1 make: *** Waiting for unfinished jobs.... AR /src/bpftool-v6.7.0/src/libbpf/libbpf.a make[1]: Leaving directory '/src/bpftool-v6.7.0/libbpf/src' make: Leaving directory '/src/bpftool-v6.7.0/src' ---------------------------------->8---------------------------------- This occurs because setting "AR" confuses the build process for the bootstrap section and it calls "arc-linux-gcc-ar" to create and index "libbpf.a" instead of the host "ar". Signed-off-by: Shahab Vahedi Reviewed-by: Quentin Monnet Reviewed-by: Jean-Philippe Brucker --- tools/bpf/bpftool/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile index c6d2c77d0252..c19e0e4c41bd 100644 --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -53,7 +53,7 @@ $(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_ $(LIBBPF_BOOTSTRAP): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_BOOTSTRAP_OUTPUT) $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_BOOTSTRAP_OUTPUT) \ DESTDIR=$(LIBBPF_BOOTSTRAP_DESTDIR:/=) prefix= \ - ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD) $@ install_headers + ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD) AR=$(HOSTAR) $@ install_headers $(LIBBPF_BOOTSTRAP_INTERNAL_HDRS): $(LIBBPF_BOOTSTRAP_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_BOOTSTRAP_HDRS_DIR) $(call QUIET_INSTALL, $@)