From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 129801B49D for ; Sun, 6 Jan 2019 14:20:15 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x06DJbdK010887; Sun, 6 Jan 2019 05:20:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=gY2l44U5TbQnanWJdu6sXZMM61tVDFbBGvKM5uPGbUM=; b=X9RcW14rdv+IyGjLIXP1h/16ppes4cS33+cC3j5TkJ8SfaCmVrGOYAyoXQhri3yhnNZK zVxlBpAzLodX64MjOHyYdJ4wJvqgDRGGSPkyE5oI96/bNigleIkqfULX3jy4oM+atitb z3z+WpMM2EFMOT2Do3Au7M1061/9Fszh4AW/r9hsNht4Xkv52fL+LAjV4vcxTstopjjy ahtnyGhQbklW4znmz3lsMWqfTq6KG5uxQ3WEC9tBTQwSISm2aUnE/hCbcpnnVYWSBZGp NN5L0gXBeZOla00G0bMJmYgZ11fjCb9917GYtZqu8hgnH8ABGWh/TWiywqa5h+5G6f57 iA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2ptvypb06r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 06 Jan 2019 05:20:11 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 6 Jan 2019 05:20:10 -0800 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.52) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sun, 6 Jan 2019 05:20:10 -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=gY2l44U5TbQnanWJdu6sXZMM61tVDFbBGvKM5uPGbUM=; b=t3QnkmSJtBcjuLajOjoO29tPfUgjOUOPYz6p3jUf5zbezWNeUHUm9kx4HgloY2V5tbiC3I+e1yxW3EYslS65INh8WUnF2qt+HM7olbJUBxqxltFeILKFgzoJ466/v1C0bzkHwbT3PNgYbN8auhUU5TtfSY7NxE/GEHohAVgMFQY= Received: from BYAPR18MB2424.namprd18.prod.outlook.com (20.179.91.149) by BYAPR18MB2406.namprd18.prod.outlook.com (20.179.91.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.6; Sun, 6 Jan 2019 13:20:03 +0000 Received: from BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::1d21:75dc:c1d9:65f1]) by BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::1d21:75dc:c1d9:65f1%2]) with mapi id 15.20.1495.011; Sun, 6 Jan 2019 13:20:03 +0000 From: Jerin Jacob Kollanukkaran To: Thomas Monjalon CC: "dev@dpdk.org" , "gavin.hu@arm.com" , Jerin Jacob Kollanukkaran Thread-Topic: [dpdk-dev] [PATCH 1/3] mk: introduce helper to check valid compiler argument Thread-Index: AQHUpcKItcuIf5uBAUCmtPFnk+SEBg== Date: Sun, 6 Jan 2019 13:20:03 +0000 Message-ID: <20190106131933.7898-1-jerinj@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BMXPR01CA0037.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::23) To BYAPR18MB2424.namprd18.prod.outlook.com (2603:10b6:a03:130::21) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [106.201.58.187] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR18MB2406; 20:AchOwMTqxE2p84/4BXI4Q7dsrN5V9oM5N17anA9gD70KUPTQ0QftHeSqq+eDEinMM3Co8Qlc/ox/9EOX7Xn5ZPEFJBWiJcP+pR+f14MKQNtdzac0W7yv9p9OdRln5bkbv8udBhUz530yYpbQ4KIbOrwCxY6m5uuK3L0u1Le3MEA= x-ms-office365-filtering-correlation-id: c3086045-2191-4ac0-b6a0-08d673d9aab2 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR18MB2406; x-ms-traffictypediagnostic: BYAPR18MB2406: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231475)(944501520)(52105112)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:BYAPR18MB2406; BCL:0; PCL:0; RULEID:; SRVR:BYAPR18MB2406; x-forefront-prvs: 09090B6B69 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(396003)(136003)(39850400004)(199004)(189003)(7736002)(6436002)(107886003)(6486002)(305945005)(53936002)(6116002)(3846002)(5660300001)(68736007)(6916009)(6512007)(386003)(6506007)(55236004)(99286004)(97736004)(102836004)(14454004)(1076003)(106356001)(105586002)(478600001)(86362001)(186003)(8936002)(81166006)(81156014)(66066001)(8676002)(486006)(52116002)(476003)(2616005)(26005)(316002)(256004)(54906003)(71200400001)(71190400001)(36756003)(2906002)(25786009)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2406; H:BYAPR18MB2424.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: W3aS8/Mdk6qC5PYMqx2MOf58nM5AbFd6HnZruzqhTV/Z3tthIL95RpAqzNWnJTt/rhMEcVOYF0Bd97M+ZmIqpusabB2oBSMlPRZPG0MI2MiSrUdsBf2vwGtgR0cHo4PzCaCzvjQ+mu5bbOkIlX8FQuwUIKQlu5rmSvJWDwZOvWP+AsKXX+w8XPfhJBunlBxv9sH5EBZeT/SYJx/JxzZp+w6vz+RHpXTbq10dMcgiJ5BA3+R7nY6r2EvKvf9tnsutnbCL+amj4OO+DZTNdrQqFUGi3SYCGfnVULUwO1yEEAl3sDhw2yhVLa2r/qenYi5h spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c3086045-2191-4ac0-b6a0-08d673d9aab2 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2019 13:20:03.7997 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2406 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-06_06:, , 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=712 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901060121 Subject: [dpdk-dev] [PATCH 1/3] 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: , X-List-Received-Date: Sun, 06 Jan 2019 13:20:16 -0000 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 +=3D $(call rte_cc_has_argument, -mcpu=3Docteontx2) This would allow adding -mcpu=3Docteontx2 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 --- mk/rte.helper.mk | 12 ++++++++++++ mk/target/generic/rte.vars.mk | 22 +++++++++++----------- 2 files changed, 23 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..2c5d5275e --- /dev/null +++ b/mk/rte.helper.mk @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Marvell International Ltd + +# rte_cc_has_argument +# Usage: MACHINE_CFLAGS +=3D $(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) -Werror $(1) -c -x c /dev/null -o tmp$$ 2> /dev/null && rm = -f tmp$$ && echo $(1) | xargs echo -n) +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. # =20 +# +# 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 =20 -# -# 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: # --=20 2.20.1