From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B36C2209603C1 for ; Wed, 23 May 2018 07:21:09 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2018 07:21:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,433,1520924400"; d="scan'208";a="44135160" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga006.jf.intel.com with ESMTP; 23 May 2018 07:21:08 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 23 May 2018 07:21:08 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 23 May 2018 07:21:08 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.240]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.40]) with mapi id 14.03.0319.002; Wed, 23 May 2018 22:21:06 +0800 From: "Gao, Liming" To: Laszlo Ersek , Leif Lindholm CC: Ard Biesheuvel , edk2-devel-01 , "pjones@redhat.com" , "Cole Robinson" , Paolo Bonzini , "Danilo C. L. de Paula" Thread-Topic: [edk2] [PATCH] BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS Thread-Index: AQHT7tVKJd9JPXB4/keV9AB3Ql+pJKQ5ebGAgAGBYYCAAmlOkA== Date: Wed, 23 May 2018 14:21:05 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E22F7AA@SHSMSX104.ccr.corp.intel.com> References: <20180518182301.25265-1-lersek@redhat.com> <20180521103027.ck3xbokxx4bjekjf@bivouac.eciton.net> <72553c05-9ae1-51c4-3728-067a875c2bf0@redhat.com> In-Reply-To: <72553c05-9ae1-51c4-3728-067a875c2bf0@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTZlYTI4OTktNTA5ZS00ZWI5LWIzNTEtZTI5Y2M2ZDFmYmY4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTlZ6cFVhRm13Zno4dEErOGdZclY1ejE5XC94dG5hOXl1VndrUWVKdFJIV0ZjakdcL0xYYytFbnk4VDZLY3FFdjdxIn0= dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2018 14:21:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Laszlo: I agree to add this change first in tools_def.txt. Then, update IA32/X64 = arch when there is a real request. For long term, I prefer to file a BZ for= GccBase.lds / tools_def.template, to discard or strip .eh_frame under GCC. Reviewed-by: Liming Gao Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of La= szlo Ersek > Sent: Tuesday, May 22, 2018 5:30 PM > To: Leif Lindholm > Cc: Ard Biesheuvel ; edk2-devel-01 ; Gao, Liming ; > pjones@redhat.com; Cole Robinson ; Paolo Bonzini ; Danilo C. L. de Paula > > Subject: Re: [edk2] [PATCH] BaseTools/tools_def: add "-fno-unwind-tables"= to GCC_AARCH64_CC_FLAGS >=20 > On 05/21/18 12:30, Leif Lindholm wrote: > > On Fri, May 18, 2018 at 08:23:01PM +0200, Laszlo Ersek wrote: > >> The ElfConvert routines in GenFw don't handle the ".eh_frame" ELF sect= ion > >> emitted by gcc. For this reason, Leif disabled the generation of that > >> section for AARCH64 with "-fno-asynchronous-unwind-tables" in commit > >> 28e80befa4fe [1], and Ard did the same for IA32 and X64 in commit > >> 26ecc55c027d [2]. (The CLANG38 toolchain received the same flag at its > >> inception, in commit 6f756db5ea05 [3].) > >> > >> However, ".eh_frame" is back now; in upstream gcc commit 9cbee213b579 = [4] > >> (part of tag "gcc-8_1_0-release"), both "-fasynchronous-unwind-tables"= and > >> "-funwind-tables" were made the default for AARCH64. (The patch author > >> described the effects on the gcc mailing list [5].) We have to counter= the > >> latter flag with "-fno-unwind-tables", otherwise GenFw chokes on > >> ".eh_frame" again (triggered for example on Fedora 28). > >> > >> "-f[no-]unwind-tables" goes back to at least gcc-4.4 [6], so it's safe= to > >> add to GCC_AARCH64_CC_FLAGS. > > > > I'm not against this patch (which fixes a real problem), but would > > it be possible to take the opposite approach, as Peter Jones did for > > GRUB when the same issue hit there?: > > > > http://lists.gnu.org/archive/html/grub-devel/2018-02/msg00095.html > > > > I.e., rather than keep adding flags when new "special" sections are > > added by toolchains, explicitly filter those out as part of the link > > step. >=20 > I guess this could be implemented in two places in BaseTools: >=20 > (1) In GenFw / ElfConvert. I'm afraid that's beyond my binutils-fu at > the moment. >=20 > (2) In "BaseTools/Scripts/GccBase.lds". This is similarly beyond my > binutils-fu, but at least I can make more comments on it: >=20 > We already discard a good number of sections, but we keep (and realign) > "eh_frame". From Ard's commit message 26ecc55c027d, I believe the idea > here was to "retain the .eh_frame data for external debugging", and then > strip it with "objcopy -R .eh_frame" finally (see > [Dynamic-Library-File], in > "BaseTools/Conf/build_rule.template"). >=20 > However, in practice we stub out objcopy (see under "GCC Common" in > "BaseTools/Conf/tools_def.template"), and then we must prevent the > generation of .eh_frame in the first place. >=20 > Rather than adding "-fno-unwind-tables", I considered moving .eh_frame > to /DISCARD/, or else turning $(OBJCOPY) into the real thing. However, > that would affect more targets than just AARCH64/GCC, and I really > didn't (don't) remember why we have this redundancy with "objcopy -R > .eh_frame" vs. "-no-fasynchronous-unwind-tables". The latest practice > seemed to be "add more -fno-..." (see the commits I referenced above), > so I went with that. >=20 >=20 > I suggest we push this patch now, plus I could: >=20 > - submit a followup for IA32/X64, if that's deemed best, > - file a BZ for GenFw / ElfConvert about the programmatic relocation > filtering, > - file a BZ for GccBase.lds / tools_def.template, to discard or strip > .eh_frame under GCC. >=20 > Thanks > Laszlo > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel