From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.10421.1595562991056968257 for ; Thu, 23 Jul 2020 20:56:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=ldZ1UO3B; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: bob.c.feng@intel.com) IronPort-SDR: gqKrsw5MGCnLlJVgxW3BaacUpoJJY42QQlDlvfkvGaxpqFvDWrg/75YLv2Nj+Elc4bdMAgvVvs YjVEqWo9Qhrw== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="130730854" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="130730854" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 20:56:29 -0700 IronPort-SDR: XZ6VtK8uaKNMmBifxTVn8nzDkvMlaNfK4DlAVy4hF0t/mDaka4qhJndZNCJBbH92Y7pQgLbt3W yIuKB+D3CeWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="488601050" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga006.fm.intel.com with ESMTP; 23 Jul 2020 20:56:29 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 23 Jul 2020 20:56:29 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 23 Jul 2020 20:56:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VYPjleBAEObcQ+Ah1ty8SanfwRhe00A1n22ss3/MnDdlDaea0qw4Kg+EZjK72a6+5FhhogylFpaue7YGSGwxMopNfRDeqGkc8N3T8E5u0h81fFuG5HX6nwTt91Li5B0fP6tFVgmSA+v2YZtTDJ2EoqOs9u0Jn1TLqcxmeCdcf8kTxaCoi4FoCY2/S1MB7ynYJYEaSrCigihv0/+4X6KTFokFNpJ6FRdkgy8dP4+FnsSzcuK3vPCSWYT2XtSYF4ZZHtg6UiXx43woAn57WFuN1fJnMYYCIaiINYM9wOXnYDvqdqrCZw0jR7F/oFJisodTueFt6oz0kjxykE2e5vaJeg== 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=3z+D7LldB1ujhew+QpikKqgG/m0LBI3BNmAXzcsRthY=; b=SmTQ7uzItki/QDZer1w3oBV5i6h6MzVV9K2rPRlYagP71mWQBbpPdNz3QDY7KEQ6cyU/mGlp9/bfMviSNpaCcqG5c3Mwlnng0axDxj2NU5JtlCI5LZDioHMdqCx4GRgueByE2txkS5ZD06GKgclUxljyVyCAi8gOeRkvpzUKeXId0f524rMP2FetefYE7pDAdGXNZN2HAkIXRl3Lq/wge7QydbmaUC2QwhACdYDud0/LFw24bhWsbBctUZZhkY8mzJ8SEiBGOVdgJHZ4cwHdK7pWkCRm3JQFSsZZt26COw6OkF1h9L62+iDFTgvaN6b9teuRDWGxdE0KN91PGeeGsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3z+D7LldB1ujhew+QpikKqgG/m0LBI3BNmAXzcsRthY=; b=ldZ1UO3BrCOa7MkklSyruui6PNrkmdu1FU6rCO3EH/PSpDeDLmAZYccHe1csMlKoxqxELsr5zIYINCLNL3OY+hYjwWvFSQvcNOxTvxrq0Ug62dIolUb30Z/qNsa7vUpDAPkvaLFJef3SPxk1cO8xAyNcTJZoGaIp6BCId0GAR1A= Received: from BN6PR11MB0068.namprd11.prod.outlook.com (2603:10b6:405:69::17) by BN6PR11MB1380.namprd11.prod.outlook.com (2603:10b6:404:3c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.24; Fri, 24 Jul 2020 03:56:25 +0000 Received: from BN6PR11MB0068.namprd11.prod.outlook.com ([fe80::f4b6:406b:26fc:c069]) by BN6PR11MB0068.namprd11.prod.outlook.com ([fe80::f4b6:406b:26fc:c069%3]) with mapi id 15.20.3216.023; Fri, 24 Jul 2020 03:56:25 +0000 From: "Bob Feng" To: Leif Lindholm , "devel@edk2.groups.io" , "afish@apple.com" CC: PierreGondois , "Gao, Liming" , "tomas@nuviainc.com" Subject: Re: [edk2-devel] [PATCH V2 1/2] BaseTools: Add gcc flag to warn on void* pointer arithmetic Thread-Topic: [edk2-devel] [PATCH V2 1/2] BaseTools: Add gcc flag to warn on void* pointer arithmetic Thread-Index: AQHWVDmfe0wkQbzBeUWGwVg6onp8AKkLggvggAh65QCAAG790IAAI0OAgABw5YCAATHhQA== Date: Fri, 24 Jul 2020 03:56:25 +0000 Message-ID: References: <20200707083522.138944-1-pierre.gondois@arm.com> <20200707083522.138944-2-pierre.gondois@arm.com> <20200722180534.GG1337@vanye> <20200723093305.GJ1337@vanye> In-Reply-To: <20200723093305.GJ1337@vanye> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c923bd6d-39dd-43df-c6b3-08d82f858986 x-ms-traffictypediagnostic: BN6PR11MB1380: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /y4fPEm5rvVmzo2j9fiJxwMqIxYyPMzKW4pNb/QHZliDB0jgQ+ba6q4JLb9rfSfLhS+3C4FPU/PDTVs4oY+RFwo6J/PomNPcypE3omyzBSPav2XghM5dsWP+6jXMsqdv4Bv//oJg4yAzZhP4D89kUGgmTZZHg9Bd7BOqLsQJW1K/958zkAk+sHxZ/KWVUHpkS32JhYg4WE9unEAqyBD6CQDeX+YO/WXhjdjv8/d/90UMw/bXt6TmwU8BJ6HBAMpoTBm/8j5qihvxUJA30YCCjXYT+8YnuBU9KqN57zOk4H7iCW/j8VTPmvFiEgJ3FC/mIBJcB2O300/hT7ctJFloU+SgxShzB15DnVrTreRIv0bMV3IhK8CfhfkR35B4ua5c5t96btiyfei/kLIFNoTyYw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR11MB0068.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(376002)(366004)(39860400002)(346002)(396003)(136003)(8936002)(52536014)(33656002)(64756008)(66446008)(8676002)(66946007)(76116006)(66556008)(5660300002)(66476007)(2906002)(54906003)(110136005)(7696005)(45080400002)(478600001)(316002)(53546011)(26005)(966005)(71200400001)(4326008)(6506007)(186003)(83380400001)(86362001)(55016002)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: eLwEFItKcLpico69uA6I8x/wD/ca8rnRmPxK7WiNeXkV3yQTaDy6BXo/NnkwT8hUqHRDkoW91h5dscAPJofWhfLNCg/CEVz01UsKzP0stEt9CBN1rsRkVdo8PnSXA2j+ewqK1bqITwDbTMvEzfWD1wKEW6YW6P9gSiuctpxHRCKJPVR7u7z/oTryuVxPenVJ6RzdKsEqS44KKEyd8u+6Ew1Z72U9aWSNaEuV5B/KlbguDq/6y8zeKElO6ZkjXEaDRzMu85UajSKP/0TE6sX2Aq4aSMyy4Y/kyESLiLuE8xL5oJhnzgMf9eheqbKIEm+sHU1KiWwNSvWqv0zebb1s7xzPUYjBWnFeS+nqF03DBsRO9JhIhPYhDrjyCjzJrIwicXTM9oATNNTzdFQGk4AXQn/Dy5veSW31VWlTaargNQQaCvF3Zm1JoPyVxePIADY81TxbJ9yvwhFM9cgt95jaEEgoDVU8khHBnZJCipF6yeMIhJXVLaE72kwSc39eequc MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR11MB0068.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c923bd6d-39dd-43df-c6b3-08d82f858986 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jul 2020 03:56:25.6033 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oMNqLeOc3R5SUkSDRUp9s8JAWyphMzgoOxUq5pRo8uoilL7ZwzDIo6RouFkcXR5J8mF3BVq2q8XLXVHPSq21dQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1380 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable What would be your suggestion on the approach to apply this build option to= all architectures? Change the tool_def.txt firstly and push platform owner= to fix the corresponding firmware code, or changing the tool_def.txt later= , until this change will not break any platform build?=20 -----Original Message----- From: Leif Lindholm =20 Sent: Thursday, July 23, 2020 5:33 PM To: devel@edk2.groups.io; afish@apple.com Cc: Feng, Bob C ; PierreGondois ; Gao, Liming ; tomas@nuviainc.com Subject: Re: [edk2-devel] [PATCH V2 1/2] BaseTools: Add gcc flag to warn o= n void* pointer arithmetic Hi Andrew, Agreed. I also think this should be applied across all architectures, not just ARM= /AARCH64. Since Visual Studio has never been been able to compile the affec= ted code, I expect impact to Ia32/X64 to be minimal. Regards, Leif On Wed, Jul 22, 2020 at 19:49:01 -0700, Andrew Fish via groups.io wrote: > Bob, >=20 > It also looks like clang could use this flag as the default seems to=20 > be to follow the GCC behavior. >=20 > Thanks, >=20 > Andrew Fish >=20 > > On Jul 22, 2020, at 6:56 PM, Bob Feng wrote: > >=20 > > Hi Leif > >=20 > > I agree to revert that patch for now and I sent a revert patch for rev= iew. After resolving the build break issue for ARM/AARCH64 platforms in edk= 2-platforms, and make sure there is no platform build break with this patch= , we will push it again. > >=20 > > Thanks, > > Bob > >=20 > > -----Original Message----- > > From: devel@edk2.groups.io =20 > > > On Behalf Of=20 > > Leif Lindholm > > Sent: Thursday, July 23, 2020 2:06 AM > > To: devel@edk2.groups.io ; Feng, Bob C=20 > > > > > Cc: PierreGondois > >; Gao, Liming > >; tomas@nuviainc.com=20 > > > > Subject: Re: [edk2-devel] [PATCH V2 1/2] BaseTools: Add gcc flag to=20 > > warn on void* pointer arithmetic > >=20 > > Hi Bob, > >=20 > > This patch also breaks about half of the ARM/AARCH64 platforms in edk2= -platforms. I agree it should go in at a later stage, but for now, can we p= lease revert it? > >=20 > > Regards, > >=20 > > Leif > >=20 > > On Mon, Jul 20, 2020 at 04:10:27 +0000, Bob Feng wrote: > >> Reviewed-by: Bob Feng > >>=20 > >>=20 > >> -----Original Message----- > >> From: PierreGondois > >> Sent: Tuesday, July 7, 2020 4:35 PM > >> To: devel@edk2.groups.io > >> Cc: Pierre Gondois ; Feng, Bob C=20 > >> ; Gao, Liming ;=20 > >> tomas.pilar@arm.com; nd@arm.com > >> Subject: [PATCH V2 1/2] BaseTools: Add gcc flag to warn on void*=20 > >> pointer arithmetic > >>=20 > >> From: Pierre Gondois > >>=20 > >> By default, gcc allows void* pointer arithmetic. > >> This is a GCC extension. > >> However: > >> - the C reference manual states that void* > >> pointer "cannot be operands of addition > >> or subtraction operators". Cf s5.3.1 > >> "Generic Pointers"; > >> - Visual studio compiler treat such operation as > >> an error. > >>=20 > >> To prevent such pointer arithmetic, the "-Wpointer-arith" > >> flag should be set for all GCC versions. > >>=20 > >> The "-Wpointer-arith" allows to: > >> "Warn about anything that depends on the "size of" > >> a function type or of void. GNU C assigns these types a size of=20 > >> 1, for convenience in calculations with void * pointers and=20 > >> pointers to functions." > >>=20 > >> This flag is available since GCC2.95.3 which came out in 2001. > >>=20 > >> Signed-off-by: Pierre Gondois > >> --- > >>=20 > >> The changes can be seen at:=20 > >> https://github.com/PierreARM/edk2/commits/831_Add_gcc_flag_warning_ > >> v2 > >>=20 > >> Notes: > >> v1: > >> - Add "-Wpointer-arith" gcc flag. [Pierre] > >> v2: > >> - Only add the flag for ARM and AARCH64. [Tomas] > >>=20 > >> BaseTools/Conf/tools_def.template | 6 +++--- > >> 1 file changed, 3 insertions(+), 3 deletions(-) > >>=20 > >> diff --git a/BaseTools/Conf/tools_def.template > >> b/BaseTools/Conf/tools_def.template > >> index > >> 8aeb8a2a6417e41c5660cda5066f52adc8cc3089..397b011ba38f97f81f314f864 > >> 1ac > >> 8bb95d5a2197 100755 > >> --- a/BaseTools/Conf/tools_def.template > >> +++ b/BaseTools/Conf/tools_def.template > >> @@ -1,7 +1,7 @@ > >> # > >> # Copyright (c) 2006 - 2018, Intel Corporation. All rights=20 > >> reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc.=20 > >> All rights reserved.
-# Portions copyright (c) 2011 - 2019, ARM = Ltd. > >> All rights reserved.
> >> +# Portions copyright (c) 2011 - 2020, ARM Ltd. All rights=20 > >> +reserved.
> >> # Copyright (c) 2015, Hewlett-Packard Development Company, L.P.
= # (C) Copyright 2020, Hewlett Packard Enterprise Development LP
# C= opyright (c) Microsoft Corporation > >> @@ -1921,9 +1921,9 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG =3D --add-gn= u-debuglink=3D$(DEBUG_DIR)/$(MODULE_N > >> DEFINE GCC_ALL_CC_FLAGS =3D -g -Os -fshort-wchar -fno-buil= tin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h= -fno-common > >> DEFINE GCC_IA32_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -m32 -ma= lign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-= arg-probe > >> DEFINE GCC_X64_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mno-red= -zone -Wno-address -mno-stack-arg-probe > >> -DEFINE GCC_ARM_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mlittl= e-endian -mabi=3Daapcs -fno-short-enums -funsigned-char -ffunction-sections= -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=3Dso= ft -fno-pic -fno-pie > >> +DEFINE GCC_ARM_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -Wpoint= er-arith -mlittle-endian -mabi=3Daapcs -fno-short-enums -funsigned-char -ff= unction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb = -mfloat-abi=3Dsoft -fno-pic -fno-pie > >> DEFINE GCC_ARM_CC_XIPFLAGS =3D -mno-unaligned-access > >> -DEFINE GCC_AARCH64_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mlittl= e-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-section= s -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-= tables -fno-pic -fno-pie -ffixed-x18 > >> +DEFINE GCC_AARCH64_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -Wpoint= er-arith -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ff= unction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tabl= es -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18 > >> DEFINE GCC_AARCH64_CC_XIPFLAGS =3D -mstrict-align -mgeneral-regs-= only > >> DEFINE GCC_DLINK_FLAGS_COMMON =3D -nostdlib --pie > >> DEFINE GCC_DLINK2_FLAGS_COMMON =3D -Wl,--script=3D$(EDK_TOOLS_PAT= H)/Scripts/GccBase.lds > >> -- > >> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' > >>=20 > >>=20 > >>=20 > >>=20 > >=20 > >=20 > >=20 > >=20 > >=20 >=20 >=20 >=20 >=20