public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
	Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	edk2-devel-01 <edk2-devel@lists.01.org>,
	"pjones@redhat.com" <pjones@redhat.com>,
	"Cole Robinson" <crobinso@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Danilo C. L. de Paula" <ddepaula@redhat.com>
Subject: Re: [PATCH] BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS
Date: Wed, 23 May 2018 14:21:05 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E22F7AA@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <72553c05-9ae1-51c4-3728-067a875c2bf0@redhat.com>

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 <liming.gao@intel.com>

Thanks
Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Laszlo Ersek
> Sent: Tuesday, May 22, 2018 5:30 PM
> To: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; edk2-devel-01 <edk2-devel@lists.01.org>; Gao, Liming <liming.gao@intel.com>;
> pjones@redhat.com; Cole Robinson <crobinso@redhat.com>; Paolo Bonzini <pbonzini@redhat.com>; Danilo C. L. de Paula
> <ddepaula@redhat.com>
> Subject: Re: [edk2] [PATCH] BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS
> 
> 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 section
> >> 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.
> 
> I guess this could be implemented in two places in BaseTools:
> 
> (1) In GenFw / ElfConvert. I'm afraid that's beyond my binutils-fu at
> the moment.
> 
> (2) In "BaseTools/Scripts/GccBase.lds". This is similarly beyond my
> binutils-fu, but at least I can make more comments on it:
> 
> 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], <Command.GCC, Command.GCCLD> in
> "BaseTools/Conf/build_rule.template").
> 
> 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.
> 
> 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.
> 
> 
> I suggest we push this patch now, plus I could:
> 
> - 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.
> 
> Thanks
> Laszlo
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2018-05-23 14:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 18:23 [PATCH] BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS Laszlo Ersek
2018-05-19  8:21 ` Ard Biesheuvel
2018-05-21  0:37   ` Gao, Liming
2018-05-21  9:32     ` Ard Biesheuvel
2018-05-22  9:05       ` Laszlo Ersek
2018-05-21 10:30 ` Leif Lindholm
2018-05-22  9:29   ` Laszlo Ersek
2018-05-23 14:21     ` Gao, Liming [this message]
2018-05-23 15:18       ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E22F7AA@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox