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.web08.5811.1623840756997787646 for ; Wed, 16 Jun 2021 03:52:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=TXd4/93f; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: bob.c.feng@intel.com) IronPort-SDR: zVdWZzv/K9johtLQZlcYrPmPrhm0iAd7Z2dzDwy/P2PsG6AWd5R8zh8Qvm/tHKqOqP+9wiqiUq D3gwLAKxQNpA== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="186531796" X-IronPort-AV: E=Sophos;i="5.83,277,1616482800"; d="scan'208";a="186531796" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 03:52:34 -0700 IronPort-SDR: OVyzJymltArrkYhYybH8KJY+8L69WNnInx8yOruepbs5WG9P9svG4e1lY0lDCgTLsTU4wxsTaa S3Bix/6uWrxg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,277,1616482800"; d="scan'208";a="554771090" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by fmsmga001.fm.intel.com with ESMTP; 16 Jun 2021 03:52:34 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX605.amr.corp.intel.com (10.22.229.18) 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 03:52:34 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) 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 03:52:34 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.175) by edgegateway.intel.com (134.134.137.100) 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 03:52:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZSwxN+z6dAjdwlSiKDsDDpmpASrj61ctfz35j08xaXsAbox4NlSf23+kuL3ISMwBRLvLUtjHBg2XKZvfkcpeaalSPR/RXMf/4giug9GlysSf/0vZbA+iAAjCZ8uW09XQHAdoGNV3QOTcbrQpJqhqKEb2RUS+CknBHkoid1I9HtsUZ4m4LgyNygV6/EoPkpSuK5zvgIdHr4ln0m7PQeYDeA/NAorDfqEfpACjoa/VodUxQNlnsFpMWpY+kXWnxngBVdWEuF6Cs+CQwyWUcPmh8hc0qaiZlgXEPxjqCtRF4LKIJUbqIQMTcqMTqR5S2Ud3xjJrv69sWs0AZpKDohJlqg== 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=W13C85iun9DpbQT/Qc6fkBVR6Gy5DFdT2AvcayCKbWw=; b=JdL7ZhzWgmV+Eo8267E+r7opxyFBK3LNwvxkQUpec52dLA14PENSOciEXlKT/tFLFV42LaLP/0IH0KiGhuWhsqgElHSXztx5d2TfoI5DoBTurfgdOJODb7OvWGYOsZJTy6/Mf/EDUQXpauXmYM4neVWak5FgIsd2oV5ngnoptv6VZwIqnRvnXMSv1St4vdRdrv/BjxluJlSCtTvR/vksvpspBNB+mMEjr8CFbS19K9ygsI+JQLYymmqBvlKlEs4NpdDl1pHTi5bNFcdKNqQztSv7DANFErutYPZ74OGK/lXXPnLQ6+s38Uo6F61iqgsPyhA0nyZGWyJJUCe76+zD3g== 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=W13C85iun9DpbQT/Qc6fkBVR6Gy5DFdT2AvcayCKbWw=; b=TXd4/93fWf3NgnBL/kaX5G4NvpnOIb8PKoM3Vefbkw1b/hjJEYBcP40F8u//bB64ODHZ0zpnUBsxk9pOO/MFcJNdounL1E3sCYeG4HlBvPhsPglFLvICymiYGtg3Q0WL06FQxyFWDvu0LM6bcYoKf53gTX8NV4xN5HITBXVf+78= Received: from DM6PR11MB4073.namprd11.prod.outlook.com (2603:10b6:5:19f::22) by DM6PR11MB3356.namprd11.prod.outlook.com (2603:10b6:5:58::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.25; Wed, 16 Jun 2021 10:52:32 +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 10:52:32 +0000 From: "Bob Feng" To: Liming Gao , "devel@edk2.groups.io" CC: "Ni, Ray" Subject: Re: [patch v2 1/1] BaseTools GenFw: Keep read only alloc section as text when convert ELF Thread-Topic: [patch v2 1/1] BaseTools GenFw: Keep read only alloc section as text when convert ELF Thread-Index: AQHXYoVqIYDobfN0606BF24z/vZqy6sWdgMQ Date: Wed, 16 Jun 2021 10:52:32 +0000 Message-ID: References: <20210616075809.1498-1-gaoliming@byosoft.com.cn> In-Reply-To: <20210616075809.1498-1-gaoliming@byosoft.com.cn> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: byosoft.com.cn; dkim=none (message not signed) header.d=none;byosoft.com.cn; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e68d4990-23a4-4aea-40a3-08d930b4d810 x-ms-traffictypediagnostic: DM6PR11MB3356: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:962; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nxDSM/fFc8I1sMgMpnyUiI+uiOj85Lu824GsEAN/HLfF7CkYUnFJm13wyEv1s6lA2j/OoI8XzjBjiEIJzkniQc1npIovQuV+HpwS0rhnZyauD8BX49aRfjPEZAwsTfhMeAT9MfLLc5gEtRoK5SvftP9Wf0SkeCNLYmVlzkAzMW4kg5jJzuMJviYtj5HbjQ7boAUznfO0K+up4ouiUAc4yrgixSrswrwaAxcyIlQhBJ6jMuDISd1PwFji0uUVwpywDgQ1Eqvoq58aeXCAefSVc5+pHmPQPQI2BST0jcMGd+7f0t2p1kt6SFOfQjW19UbMW+x9awdwovrSfY2hAL5nqZxFxOw2fy8LkkODB612M7lU7eP2uPOB3sPADqtnccIGoyA5zSH5BATFBy/wOzoVRuEVuJUY0XSMi6e/LqTliFym4kKbzdNJI+q67DAfZPf5ljJ1rzaXV0GmtwbglOgQnMSI6kvpXjOvGBboAW/nMXPF7wClbLusOSmR/DwwI0FqaLLjDCFjXm05QlSX6zF3QbGKx3GJ0GxetdErDq0IFYPZz2nnETT8qn3D7ZQvUIOr+UbE+HRnc0lBVCiVO00XgaxD83SIHE9gd531g430FBLkRokRYJpHqEsIY9qCy/3D2Pl/Qvmdkhxbz57XN9E999OK5hU0xI/oWt2dC3h3YgS6L/l50evR5kkAB3dkT/hn0gcfnDD6XlYwVdfV7+jnRaO/lqa+QUBN2nNhAMjbE1c= 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)(136003)(396003)(366004)(346002)(376002)(316002)(110136005)(186003)(83380400001)(107886003)(26005)(52536014)(66946007)(4326008)(966005)(8936002)(5660300002)(8676002)(53546011)(76116006)(6506007)(66446008)(66556008)(33656002)(66476007)(64756008)(7696005)(478600001)(55016002)(9686003)(122000001)(38100700002)(19627235002)(86362001)(2906002)(71200400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QS8hm7P6M4XJvcBIsA1rqgPa52NCyb981N+41lfaXoc8eF0P5aJOK8VBmd1K?= =?us-ascii?Q?3FMqkKp5x3L+LaJB9zMFH52kMQ4+5OqcoAyzKTmznBQvCttD7KDvekTPY1Tv?= =?us-ascii?Q?2aBLoHggTstqDzYPbb9A7Tq1clRQFwemPBCIM3RWwU+mOyFL8RAubKiNpHJf?= =?us-ascii?Q?SgTSbZi/gAfNX5V9EG0o7VV/dTUuPnacSA/MRc0ZDXyiiEGQXOFnA8qpjkrC?= =?us-ascii?Q?uv3McrPUgHyV64LMm+p3X16+k7sz1lsVR9MkbQhDWtEEKIw6IHwUcbq9KjJn?= =?us-ascii?Q?jq1iDuFQhCeLrX3qdaBCXd68ElRnvzVZyE4IwYUESrgDEdadSfHiBcEA5kQ/?= =?us-ascii?Q?bApYWaU9q5zcC8um6b5uWuMdpeCuNtHD1fxjAf6bF+3V0K7fgv1AyH0cp310?= =?us-ascii?Q?IDZvM3Yy6DA2we74Aluoa+ztX3UngraUaG5vyDZeY469yBsrY8W28kj0r9S2?= =?us-ascii?Q?Olvn0iwDAuKLEtaIP7/XncpwRMjKmOuUvfr3YhNWEzcl8H0oerDIG8NN4C6e?= =?us-ascii?Q?BJ/4+HeJkwOFqvsxjubz4dKm2NWGVIK+jPGPRxemDRqB+SKSTCNXC5WfRT69?= =?us-ascii?Q?ldEVuYFedtjjj/paFRhjXBBcXEnQfTPS/6znnh7CBJ7Wg3ZRsquju/4Sn5tb?= =?us-ascii?Q?bu9sL/1MG3eYw1aC6lXAIRJwiKqAxB3wgJBjdh1mCSgrDZYV7O4whEMNftWI?= =?us-ascii?Q?xnmoUnuEJTjdDeUN1E1aXHPIEBoP8hDTYaxfxLJuushfbR0yOQruq4tGWCwt?= =?us-ascii?Q?umfNqkwEy4jujnxwp3IbT3a54lBSBQp9rPrJ0YOKuss81cA9tTEJufwW0mDF?= =?us-ascii?Q?0YOt74zn4nPNgTAyyxSq1JU0xkMekkbUkFSeE0g+QipxogBVUPuTI8sYjJH8?= =?us-ascii?Q?vVOYXKQGdaU+hRywgMXYuaJeQL73iR6z+tyZ8mXtK1FD8LUj/W9r0Q7N4oK/?= =?us-ascii?Q?AgaIL+tr/SaPrKkm9VltBX4UuxnKM18dM/vIZatngCpYFEZLYCIeoPw/ScKU?= =?us-ascii?Q?Vwuk/b6egLT2FeQq8FZ7zWx+ZDP745AmPH2Yos4KzSc5xZLADnpIhSNqZbc0?= =?us-ascii?Q?2QC7Vrxgk2h3iyWYqHCYRY+7VzQAoPqa6CtZw61NytiKwrupDjsCs7kUwSse?= =?us-ascii?Q?iJynXGSW6MWCCCkV4RHUt2gOQdCG+Jb26BHfsgPoJHGC969hKDbWH3YNI4PH?= =?us-ascii?Q?XuYq+lVuOLm6qEI05eb8Fv1FQZxRFg366whKNCriazBwLSbbX88TJsIgluSt?= =?us-ascii?Q?izi7FLVfZQ9SpJ1S3KgNLjNHlhT6yChT2mQu0yCBxTXZj8qxJrbUI253Jsxo?= =?us-ascii?Q?Y4Qo9FxM6+IYbspalv7HABTm?= 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: e68d4990-23a4-4aea-40a3-08d930b4d810 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jun 2021 10:52:32.5417 (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: T7vJ6McFhyB6dl0BmTz91T0YcKxLmuFoa6WxW+NsT2HLMSvoCiHVQjoTudZlVO5wzrx2cT+QgSAhkctSMLnW9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3356 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 Created a PR. https://github.com/tianocore/edk2/pull/1724 -----Original Message----- From: Liming Gao =20 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 te= xt 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 read= only 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/G= enFw/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/G= enFw/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