From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.31505.1595218231059264873 for ; Sun, 19 Jul 2020 21:10:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=zGMCqfN5; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: bob.c.feng@intel.com) IronPort-SDR: Z1ROCXgDOBe1t41L+xwStyVjSMJRpP9aZSQTKg++1iBziboZIcVafGjnirn0DCuf/0Xh6EiMzW zMtvxcySD2Fg== X-IronPort-AV: E=McAfee;i="6000,8403,9687"; a="149006250" X-IronPort-AV: E=Sophos;i="5.75,373,1589266800"; d="scan'208";a="149006250" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2020 21:10:30 -0700 IronPort-SDR: dr0GpA1EhaERFiftkYzhrMU1CRJpu9IpVzcOOgq+89H2/uLJWzGAaJ5oL1Bc3QmbQCJxrCS/j7 XP6naAsXB1FQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,373,1589266800"; d="scan'208";a="301157101" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 19 Jul 2020 21:10:29 -0700 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 19 Jul 2020 21:10:29 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 19 Jul 2020 21:10:29 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.106) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 19 Jul 2020 21:10:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C/Qf62hS3DxsNSWH6TYEy7miOa09ae1FLPBgMSNl2xsQHeWG6NN7IiBih08whLFZm0X/8/7UOEradnSVKvoRnFJcra7HbIPcwdzwrV+aGNCsQ8t9DjVIyjzaAZraTkCpm3Wr7zkuy4vp7iKBLJ2dCymDvCM6N8qly13C7kr+PVFzzNOG69Gjr9FjLGSaZdXaNiNWkiOkx9+lgWocJ1BqRdd8ODYfFartFC/RfIgrt54pCxfhO6i4Sw8A9YN8uF0LhV9DHF7i9oHTtJ1LtCGmsijBC2a6kUWSJLYHNkaZ/fX7+89WGJQTX6M6gJkxlPPHO4q8fk3Ya4Dtqryly4B7Qg== 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=oUhhSsVvt7sMunVyd6rvcoB6F3Oq+Ft8Z0PEfeOWnNo=; b=Y6pVoVeDB7qhcJrkX5IWU9VdJ6w07oWA6z69bFQWib2XdO07AcISah8+pldiPEkzQJs55023KLrQxasopQ+Z+uiGPCfUIN0izVuiZ9TkuBluyk8jZg4xysiPIqOhuHPXR+Hr6TRfO+TWj9R/l7/cRIPByfUC4A4aufMuzNjQxz6fRu+3DT9q3c6MuTQoKSHe4DI9h9aZafd1EP7xJu4uUZ8Pm/BUkWScaKw7KRsCOXQfX2IlREHylb+asDQUhLGq3eKeNr3YB9YLUXO+o9hMGeQqm9alR+QXFocLuHV3r5HrseFK3db5Fp+GzQGDcbE/4VWnJ3cqiV+DBk4y27394w== 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=oUhhSsVvt7sMunVyd6rvcoB6F3Oq+Ft8Z0PEfeOWnNo=; b=zGMCqfN5M8Z51JhRu5YHZQhvnFSOZJhyIcxl6wsNStcGpArloHgswYkkBh2LTulvGOfRMTK70hZMNvWuNzRz8sVHmwSHPE5INzbVPJtvD1imTSrWy4PnueSevBBhZCBXMofVVARpJ/pDjlWNRTzoW/4dApO6PJNnNthlQ5k/nAo= Received: from BN6PR11MB0068.namprd11.prod.outlook.com (2603:10b6:405:69::17) by BN6PR11MB4051.namprd11.prod.outlook.com (2603:10b6:405:79::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.24; Mon, 20 Jul 2020 04:10:27 +0000 Received: from BN6PR11MB0068.namprd11.prod.outlook.com ([fe80::6870:82d3:5bde:4153]) by BN6PR11MB0068.namprd11.prod.outlook.com ([fe80::6870:82d3:5bde:4153%6]) with mapi id 15.20.3174.029; Mon, 20 Jul 2020 04:10:27 +0000 From: "Bob Feng" To: PierreGondois , "devel@edk2.groups.io" CC: "Gao, Liming" , "tomas.pilar@arm.com" , "nd@arm.com" Subject: Re: [PATCH V2 1/2] BaseTools: Add gcc flag to warn on void* pointer arithmetic Thread-Topic: [PATCH V2 1/2] BaseTools: Add gcc flag to warn on void* pointer arithmetic Thread-Index: AQHWVDmfe0wkQbzBeUWGwVg6onp8AKkLggvg Date: Mon, 20 Jul 2020 04:10:27 +0000 Message-ID: References: <20200707083522.138944-1-pierre.gondois@arm.com> <20200707083522.138944-2-pierre.gondois@arm.com> In-Reply-To: <20200707083522.138944-2-pierre.gondois@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.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: 77955165-b55a-4373-1a4f-08d82c62d5bd x-ms-traffictypediagnostic: BN6PR11MB4051: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fraMWHxjiI/vOkzEor3VYn+iz2PGudR7rzLJuuuFacxoXID3eilOT+sL4I7jI9/cErc0sw6ILRVZT5svHP5HjrFYju64Qyw2Q2is/+4t9gSUuIfOzU1PSyFqqiF09Ou1s62ic3kWBivQ/wL1b2QDOEGUxfPPzjVq23j/ZN/1lc1coXcH99xGpZIy/Iw23A2zKLdyY9SVOK56NaYh9ul4M/CPj2zZGAahRxmonAQoj2WTEQ0QLU0cwgSYaUMbDIwKEtvX64lf4qLPbDOdXuVVF5H5uqsZuoM9NeZy5o1+FwNKMEIS/xN2g07wavd3lJpeuhcKDZzDcrVfEFjCRztPlsOvgf7tfxIlie0m3I6Hsni9XBKbIGXx9r5p6Jj1dltbGyYHxtT60yferRjsjB/qTQ== 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)(346002)(396003)(366004)(136003)(39860400002)(8936002)(55016002)(7696005)(316002)(9686003)(5660300002)(64756008)(76116006)(66476007)(33656002)(2906002)(54906003)(66446008)(52536014)(110136005)(86362001)(66556008)(66946007)(83380400001)(71200400001)(45080400002)(966005)(26005)(186003)(8676002)(4326008)(53546011)(6506007)(478600001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: MnV7cJUwq7C7vbJPzxewkkEshTp/iY9Cv9YYDzKpStwGreTYHMFOF0/Zdwkv6Tehu6KpgZDM1p03xPHmB7v7i6ya+f0cfxA9DYfbHR3udorJgBs4sAn+K7GF2/dPELt0oNiSuOtSkAo5O8p8H20dUzUC9CGagi3IGjm6nnsxIdsGJNaFYvcihuh70b1hmKm5OdtN/nyAeq4phWc/Se3xYQecOYFg7LDb2Nbr5w2lfCZbMjNImxmLJ+hnKDcAJbsM0IAtCAWhXOvALeJQW9AcBrDc/Y2sWUFRQLl5wZI0PMbsdS+EMG3XxJueeBfTAEuv++4Z1qI5Q6HY+oLy2WpKtO0LfJjHkXxymv0ABZrD/5NKTS9uWGwSJXJBRkZYyTJse+Yy+cNSm8x4vL8ajULjC/6ma8r1dVxvkG6nNMLRFvu/S2MjNZMVn8cGgb2tI9i8hwzY6HSksVJ5jZC2xDOlgajAWzW5LN0eav6yDKZ9CbU3b33kN1R/OJLpyeN5ki0V 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: 77955165-b55a-4373-1a4f-08d82c62d5bd X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2020 04:10:27.4773 (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: XPC86znNnw1aWJai0Y+QsSSPtDdzyF2xr6jvJdyW6SRK7QmwGAs7SpBiBK0pnel+rLHYBuZo1aij8DtIxKxrjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB4051 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 Reviewed-by: Bob Feng -----Original Message----- From: PierreGondois =20 Sent: Tuesday, July 7, 2020 4:35 PM To: devel@edk2.groups.io Cc: Pierre Gondois ; Feng, Bob C ; Gao, Liming ; tomas.pilar@arm.com; nd@arm.com Subject: [PATCH V2 1/2] BaseTools: Add gcc flag to warn on void* pointer ar= ithmetic From: Pierre Gondois 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. To prevent such pointer arithmetic, the "-Wpointer-arith" flag should be set for all GCC versions. 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 1, for convenience in calculations with void * pointers and pointers to functions." This flag is available since GCC2.95.3 which came out in 2001. Signed-off-by: Pierre Gondois --- The changes can be seen at: https://github.com/PierreARM/edk2/commits/831_A= dd_gcc_flag_warning_v2 Notes: v1: - Add "-Wpointer-arith" gcc flag. [Pierre] v2: - Only add the flag for ARM and AARCH64. [Tomas] BaseTools/Conf/tools_def.template | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index 8aeb8a2a6417e41c5660cda5066f52adc8cc3089..397b011ba38f97f81f314f8641a= c8bb95d5a2197 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 reserved.
= # Portions copyright (c) 2008 - 2009, Apple Inc. 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
# Copyri= ght (c) Microsoft Corporation @@ -1921,9 +1921,9 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG =3D --add-gnu-debu= glink=3D$(DEBUG_DIR)/$(MODULE_N DEFINE GCC_ALL_CC_FLAGS =3D -g -Os -fshort-wchar -fno-builtin -= 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 -malign-= double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-p= robe 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) -mlittle-endi= an -mabi=3Daapcs -fno-short-enums -funsigned-char -ffunction-sections -fdat= a-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=3Dsoft -fn= o-pic -fno-pie +DEFINE GCC_ARM_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -Wpointer-ari= th -mlittle-endian -mabi=3Daapcs -fno-short-enums -funsigned-char -ffunctio= n-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloa= t-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) -mlittle-endi= an -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fda= ta-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) -Wpointer-ari= th -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunctio= n-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fn= o-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_PATH)/Sc= ripts/GccBase.lds -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'