From patchwork Sun Feb 24 18:11:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 50473 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8A3B72BBB; Sun, 24 Feb 2019 19:11:31 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 98CE62B9C for ; Sun, 24 Feb 2019 19:11:30 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1OI4ejY006885; Sun, 24 Feb 2019 10:11:26 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=FbdzF6bJXAydguNHx0d6rOhRSKWCb3WM1il96ycBS+0=; b=uPpWAGMEVEWL3Qj0P1AcWlUWySG+L5T6JcOCtrGZLce8IXzVWkUzjiqOAwvDQxXT0CUe wmI8ZGzsVR5dgn4G58VvQSj376rGbVjPlxYJNmn8dIPsLGzovJAz+pEMFeRuiM6iX1lD oSIxMx9K+oNIc/rCwHHFSZigRZBkx4LGQcwyMcmhXVHqG3+8kYfIO0kACBGZ1P599MZq VBRmx0c87L7gCfbCnTU5QstWRG64pIrpzj4SF+hz5GLCuAp6BjuM1JMSHRMNv2OxYfhM Nyw93zOIXWgrlQQzjBitZONfvrK9t7fCrGBj6Qg9C7m7uf+HbKKACBkb4qcTBju65G32 Xg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2qu4dstgxw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 24 Feb 2019 10:11:26 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 24 Feb 2019 10:11:24 -0800 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (104.47.32.51) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sun, 24 Feb 2019 10:11:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FbdzF6bJXAydguNHx0d6rOhRSKWCb3WM1il96ycBS+0=; b=rpEd6WohVOOtqsS5ydModAou4KWFzy8xj+UuQpYtrU8mL4W3fuZhoKpnWMMa0pTfxJ8D0TUKieRv0pFtOrDY/d9Je2bGiaeD+LYQ7f5VcjE24iRQW5lya/shgzt27VNmL90tIpJYf/IdxrMAD52auKJpLJfI0fowcQbZ+KOsWdE= Received: from BYAPR18MB2424.namprd18.prod.outlook.com (20.179.91.149) by BYAPR18MB2679.namprd18.prod.outlook.com (20.179.94.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.18; Sun, 24 Feb 2019 18:11:22 +0000 Received: from BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::910b:ab85:3e93:70c7]) by BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::910b:ab85:3e93:70c7%4]) with mapi id 15.20.1643.019; Sun, 24 Feb 2019 18:11:22 +0000 From: Jerin Jacob Kollanukkaran To: Thomas Monjalon CC: "dev@dpdk.org" , "phil.yang@arm.com" , "bruce.richardson@intel.com" , "Jerin Jacob Kollanukkaran" , Pavan Nikhilesh Bhagavatula Thread-Topic: [dpdk-dev] [PATCH v5 1/4] mk: introduce helper to check valid compiler argument Thread-Index: AQHUzGxZY6i4a5o7LU6jL3n/vH1FBA== Date: Sun, 24 Feb 2019 18:11:22 +0000 Message-ID: <20190224181041.27127-1-jerinj@marvell.com> References: <20190109103915.29210-1-pbhagavatula@marvell.com> In-Reply-To: <20190109103915.29210-1-pbhagavatula@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR01CA0103.apcprd01.prod.exchangelabs.com (2603:1096:3:15::29) To BYAPR18MB2424.namprd18.prod.outlook.com (2603:10b6:a03:130::21) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [106.201.37.126] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b0d96519-fe04-4300-163a-08d69a837b70 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR18MB2679; x-ms-traffictypediagnostic: BYAPR18MB2679: x-microsoft-exchange-diagnostics: 1; BYAPR18MB2679; 20:eiBES4wO7SSQT7ix9QWdy8FGCRKG/Ky3w3UGDKfO9DGl+pbZc+YPKVkq8LPM4nmOPNUcymzvzxhCcW1Usag0cVzTUUzBV8SEyM+9rT3BD0snvyKUfjGriEwVji8FC6cMgGueIv8BcqXUkr4AbD+xhXPbMInWEaf1J6bfi1aB8Jw= x-microsoft-antispam-prvs: x-forefront-prvs: 09583628E0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39850400004)(396003)(376002)(136003)(346002)(189003)(199004)(14454004)(6512007)(106356001)(50226002)(6486002)(107886003)(305945005)(99286004)(476003)(2616005)(446003)(11346002)(486006)(53936002)(86362001)(2906002)(478600001)(105586002)(68736007)(6436002)(8936002)(66066001)(3846002)(25786009)(316002)(186003)(256004)(14444005)(5660300002)(4326008)(97736004)(54906003)(102836004)(7736002)(1076003)(71190400001)(71200400001)(8676002)(26005)(55236004)(76176011)(6506007)(386003)(6116002)(36756003)(81156014)(81166006)(52116002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2679; H:BYAPR18MB2424.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 3z1ifwg93lNIfmzwQ8EXAj9M9davHB/R2JAWsiYpS/bMOzGlYf1ybUxn4ge2AzxQr1DYJVetUv0plpBV2EsXC/CdCrW2pDvHxBHEHGVLwBtwjVeVTPMas8OSF76B7k0kr6T7et7zxVo6oSv4kYjEIMSzq1mfTXesBQkQFNjIhk0pHURRe2VVwlbPw3IKwMkowIDwf+VpQ1utT8tFgJ1t6/AG+IM0pfPKV0J66skJQG1/JybDzC2lVzcrR54Z68mgz/gR9/z+vh2MXqCEjIVavIlLKzRppV23WQEtruWZG80Cm5KnLja5kSK5JesYTfQ4nBwmSv5zUtWojivtpgFcTERySdFjzMZQ1uf2crLvJhLFOQrkYjixqap4768Y2Ka8vjGJ6K+M/tHvSXEQWv4oGlvI8t4NQ/L1Q58Lx43MDpI= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b0d96519-fe04-4300-163a-08d69a837b70 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2019 18:11:16.6801 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2679 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-24_10:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902240143 Subject: [dpdk-dev] [PATCH v5 1/4] mk: introduce helper to check valid compiler argument X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Introduce rte_cc_has_argument() Makefile helper to check a given argument is support by the compiler. Example Usage: include $(RTE_SDK)/mk/rte.helper.mk MACHINE_CFLAGS += $(call rte_cc_has_argument, -mcpu=octeontx2) This would allow adding -mcpu=octeontx2 in MACHINE_CFLAGS if it is only supported by the compiler. The use case for such scheme is to enable the mcpu optimization if the compiler supports else it needs to compile the source code without any errors. This patch also moves inclusion of toolchain's rte.vars.mk to before the machine's rte.vars.mk inclusion to make correct CC available for the cross compile case. Signed-off-by: Jerin Jacob Signed-off-by: Pavan Nikhilesh Reviewed-by: Phil Yang --- Change history of this series: v2 Changes: - Add meson build support. v3 Changes: - Squash meson build support into config support for thunderx2/octeontx2. v4 Changes: - Fix incorrect signoff marrvell -> marvell. v5 Changes: - Fix incorrect meson flag parsing(Phil Yang) - Squash meson cross build patch(5/5) into configuration update patches for thunderx2(3/5) and octeontx2(4/5)(Thomas) - Changed octeontx2's march as armv8-a and added the extension required instead of armv8-2a(Phil Yang) - Improved rte_cc_has_argument() implementaion by removing the temp file(Thomas) --- mk/rte.helper.mk | 10 ++++++++++ mk/target/generic/rte.vars.mk | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 mk/rte.helper.mk diff --git a/mk/rte.helper.mk b/mk/rte.helper.mk new file mode 100644 index 000000000..6e7fd03d7 --- /dev/null +++ b/mk/rte.helper.mk @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Marvell International Ltd + +# rte_cc_has_argument +# Usage: MACHINE_CFLAGS += $(call rte_cc_has_argument, -mno-avx512f) +# Return the argument if the argument is supported by the compiler. +# +define rte_cc_has_argument + $(shell $(CC) -E $(1) -xc /dev/null 1>/dev/null 2>/dev/null && echo $(1)) +endef diff --git a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk index dd149acc9..25a578ad7 100644 --- a/mk/target/generic/rte.vars.mk +++ b/mk/target/generic/rte.vars.mk @@ -7,6 +7,17 @@ # executive environment. # +# +# toolchain: +# +# - define CC, LD, AR, AS, ... +# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value) +# - may override any previously defined variable +# +include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.vars.mk + # # machine: # @@ -45,17 +56,6 @@ endif # include $(RTE_SDK)/mk/arch/$(RTE_ARCH)/rte.vars.mk -# -# toolchain: -# -# - define CC, LD, AR, AS, ... -# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value) -# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value) -# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value) -# - may override any previously defined variable -# -include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.vars.mk - # # exec-env: #