From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.7685.1623851103912331161 for ; Wed, 16 Jun 2021 06:45:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=ScjzB8oq; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: bob.c.feng@intel.com) IronPort-SDR: kIPVMhS78w1QvY7NHPwxy3lIpXUg7IkyfukaTf2lSU1a2XF+iS/Nnv2lQUUeLkRTLfL0adt+s4 dovM8FBaiX8w== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="267325419" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="267325419" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 06:45:02 -0700 IronPort-SDR: 4f7LW1WepjbetwB1KS5tQzkIbG75YmLoHUW7/K/FNHMP0JjoEfDZnbVBE9UKTMQHDo1W7PwdQo ceLQZymGQcEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="640007854" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga005.fm.intel.com with ESMTP; 16 Jun 2021 06:45:02 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Wed, 16 Jun 2021 06:45:02 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Wed, 16 Jun 2021 06:45:01 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Wed, 16 Jun 2021 06:45:01 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.172) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Wed, 16 Jun 2021 06:45:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lZBoY3xU9eJsAXYJo47c61NZJLSiy6Mh4tCqkFm4J8yIRxaxgeISEkIT8CyjJFNTIwKK5WlNnAVJAuKOKZaRxh4BDQdat/z5glMhIxhxa9sXkMNxJe+fWveY7N4ifQhTL1qpegKMLJ4CW1sYUtOiPWpa75UE7yo+w5LdTENz1SQR/wflOum9yrlt/vfJhnJY0aV5YPCk+8jpzMk+3m+4VZYMEuL3kcllzVJFdIYtiAPaQiuqDG5ZACURSobewBs/HjcRwW+vG3c5Oie4y0yUqYST+N1QkgQdx+QMjfbddljone8X83prxjpLrdrlLvyhdv5d5awhaF02FzekdQI2/w== 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=oppDtF6tL0RPTALH66ajt9Ilh3hiz8hz0OgNCv8JZnE=; b=a82bWReMCewriDSwCYgik30l6hmB3+ttsie+X2qq8c4OlkS9NzjqnFrLPidgVJvYCMWuFipWUJ9wYRTpmI7Am+HKP3tGczmE/U59pFdlSU33MKOYgjBmnE3Jt32NwxpR67O/FMggYVEXx8ido5/crqiJL8j0m6Jluern+f4rEeMIRUXGdtUufzKBmdrXP5cEdf4c6lhv/cOsIlSpNHyfCJACyqSWHOaOnxzQn6KA6HEChmji0BA0j7UjEAVPAt/N8V617wCHFkHlD5d8EvMBvCrygHUvbZeI0xIjZHOXL1JWJMku1gYCW5p+6fxQc+caOKxpE94K0ujg0Nla87mX1w== 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=oppDtF6tL0RPTALH66ajt9Ilh3hiz8hz0OgNCv8JZnE=; b=ScjzB8oqiV9GBEk6t0IcnoWNWyH+cFT3bHox9SGHv73lkz8kStjvbcG1XV605OHIyVI7WVTil2vK2KTaiP7Nfmi8kuf1Pu1TXdw5RuIWan8xH73D8zOrZ1P6O0pz7IBuQG+Qy4NzKhKWl7FbWAvJimqW/AI2zFo7I4UH1dDJt5s= Received: from DM6PR11MB4073.namprd11.prod.outlook.com (2603:10b6:5:19f::22) by DM6PR11MB4202.namprd11.prod.outlook.com (2603:10b6:5:1df::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.24; Wed, 16 Jun 2021 13:44:59 +0000 Received: from DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::585b:8bbc:602e:fb36]) by DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::585b:8bbc:602e:fb36%5]) with mapi id 15.20.4219.026; Wed, 16 Jun 2021 13:44:59 +0000 From: "Bob Feng" To: "devel@edk2.groups.io" , "Feng, Bob C" , Liming Gao , "Liu, Zhiguang" CC: "Ni, Ray" Subject: Re: [edk2-devel] [patch v2 1/1] BaseTools GenFw: Keep read only alloc section as text when convert ELF Thread-Topic: [edk2-devel] [patch v2 1/1] BaseTools GenFw: Keep read only alloc section as text when convert ELF Thread-Index: AQHXYoVqIYDobfN0606BF24z/vZqy6sWdgMQgAAwbdA= Date: Wed, 16 Jun 2021 13:44:58 +0000 Message-ID: References: <20210616075809.1498-1-gaoliming@byosoft.com.cn> <16890A90C3D11020.20493@groups.io> In-Reply-To: <16890A90C3D11020.20493@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.143.0] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0fbb2996-e889-4d6d-e9a0-08d930ccef04 x-ms-traffictypediagnostic: DM6PR11MB4202: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:972; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xQ7+Px41XkHeMIpfCeHHtI05HAXw4XghYb3bity7ZjvPtfY+kgYurIOmKna+6PcxPInT+XcPH5bDf1hfMr2ghcw91IgYM/jq4oxwt+09klL/oLGwfh/I+J05/fWHKWwPWLyGDXxS/r3kfZgewpeCWGCaqPt5hKe2pDOmfNrTvKLPhNlp6+subQ9eWs+F0+CERvW+EbWqgtSgd8kFJpZ83b0DRv5Dskna783gnKpcuRmL0/5S2Dt3aHMuhMtI/iazkHXl2Tl0sUOCOzoFnNcLYWhADkZwD6zZX5NjHPLlFFHAUbziVYkitO5YkLN2fE1BcUMaYb/I+PaUntygmKoZgFqoItTKnKxs+McUsMR1/Ekq6nlbxpeTkLwYQ33HxbG4rw4rXpAGayXZTf4AaSEKGtsFYqHoGF8wKKN/tRPKC4G3yVjDcDnJqY2Ipb+CA2QtQW//Y0i8KBFdFxkU1HqFe4qVemAbvWitbsYEYgAFCSlN5Boh7vMpJht0IK7IUzXoSfTSeF46asXexKovODz9BnqgJODIa1AT+Hag4eFhsFuZ7W17/kuyTiCLhGszC94rqtsNyB6sSfuqKinyazDbD4niMblh0A5uFjfj5y5OXPtAo/+KG4CDyKp4WNypLoes4QpbPB/DBObi6wXDWjqI6IfpzbAFLdMAdOtBp+29tNwMEw7l45s1YYfRoSQUs4cNr3/1VZ+v+ztq8zgEr5V3b8bd6MGGsy5Ric9Y8ZZ2p4DZJyhJAAyGML7Ylcd/RsxDGgRjq8RxSStCqfUiLENc3g== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4073.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(366004)(396003)(346002)(376002)(136003)(86362001)(55016002)(33656002)(66446008)(66476007)(76116006)(64756008)(66556008)(52536014)(9686003)(83380400001)(66946007)(5660300002)(110136005)(7696005)(19627235002)(107886003)(966005)(38100700002)(53546011)(26005)(186003)(316002)(6506007)(71200400001)(6636002)(2906002)(8676002)(8936002)(122000001)(4326008)(478600001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?IwIbU8q2AYvS4VkPdHsv+x4hQIxCZRtMvosGZGBUufKCijVKttXMBw63tYlF?= =?us-ascii?Q?UHHfjRLx7IpKqiLJyBD8pXJYbrFrPISojrOyv7UC5MbsHC+qRiybXCviTCvL?= =?us-ascii?Q?uPjTAKlqOSyCUI+cNvpIYWXCYjXZA0hGgB9G5rP2FNYVlqEH7tZJ9YQ4R63T?= =?us-ascii?Q?Pv1tnC4HjrumXOzhiSNRqpjI9FgFccp4slZsR0mrMEV8J/s6bmfB8W1FYPoM?= =?us-ascii?Q?xcBT5zVUVysGmykJJ8NNq2SSrkkLFGj6bm2/Z+EqfF5jHVSjquihNHZO2Lx3?= =?us-ascii?Q?jCW5WRGJ4msI5Zjwc3jxCQBElrhv+cMaM0i1HAm/V7Cd78RjTgwm+npKJ8TV?= =?us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QS7ocUUHYknxRo639GO5o+2?= =?us-ascii?Q?WmFtxUuS0zNbKNCIEExSxGegi1XXNAiNWrWYZEm0Beb6bsLUkDOLnxaJ5ILw?= =?us-ascii?Q?swDGnGVn402of+6rk+ITEnni?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4073.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fbb2996-e889-4d6d-e9a0-08d930ccef04 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jun 2021 13:44:58.9904 (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: SjSUcYdAbflNsvE0TJu8FOFo0XqE9UDYlE31/sPYUGVVJJYoSRa4yJp81zEbvArc+UD6cvgm3faIxzAx3niDbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4202 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 Create a new PR. https://github.com/tianocore/edk2/pull/1725 -----Original Message----- From: devel@edk2.groups.io On Behalf Of Bob Feng Sent: Wednesday, June 16, 2021 6:53 PM To: Liming Gao ; devel@edk2.groups.io Cc: Ni, Ray Subject: Re: [edk2-devel] [patch v2 1/1] BaseTools GenFw: Keep read only a= lloc section as text when convert ELF Created a PR. https://github.com/tianocore/edk2/pull/1724 -----Original Message----- From: Liming Gao Sent: Wednesday, June 16, 2021 3:58 PM To: devel@edk2.groups.io Cc: gaoliming ; Feng, Bob C ; Ni, Ray Subject: [patch v2 1/1] BaseTools GenFw: Keep read only alloc section as t= ext when convert ELF From: gaoliming This is the fix of the regression issue at c6b872c6. Based on ELF spec, readonly alloc section is .rodata section. It is used. This fix is to add back original check logic for ELF section. Now, the rea= donly alloc section and execute alloc section are regarded as .text. Signed-off-by: Liming Gao Cc: Bob Feng Cc: Ray Ni Reviewed-by: Bob Feng --- In v2, update commit message to pass patch check. BaseTools/Source/C/GenFw/Elf32Convert.c | 3 ++- BaseTools/Source/C/GenFw= /Elf64Convert.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/= GenFw/Elf32Convert.c index 314f8233234d..d917a444c82d 100644 --- a/BaseTools/Source/C/GenFw/Elf32Convert.c +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c @@ -238,7 +238,8 @@ IsTextShdr ( Elf_Shdr *Shdr ) { - return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) =3D=3D= (SHF_EXECINSTR | SHF_ALLOC)); + return (BOOLEAN) (((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) =3D= =3D (SHF_EXECINSTR | SHF_ALLOC)) || + ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) =3D=3D=20 + SHF_ALLOC)); } =20 STATIC diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/= GenFw/Elf64Convert.c index 8b09db7b690b..33031ec8f6e7 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -246,7 +246,8 @@ IsTextShdr ( Elf_Shdr *Shdr ) { - return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) =3D=3D= (SHF_EXECINSTR | SHF_ALLOC)); + return (BOOLEAN) (((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) =3D= =3D (SHF_EXECINSTR | SHF_ALLOC)) || + ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) =3D=3D=20 + SHF_ALLOC)); } =20 STATIC -- 2.27.0.windows.1