[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86: fold sections in final binaries


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 1 Mar 2022 15:21:16 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=asEOo2hUVtkuimU0mOHJme/HCaJCwWp4xy/3Mmvsl/k=; b=eXBfnqHK66lXfcG5eRFXNdTtyQZ1XYDZWaHACh0O5+juSUqoNT2k+L8Jp+8cUcfSespLKF0Pv3E4qPQF4eMY3ab+a5358G4BSxoTpIyN8npyq2WJLx6wh8TmJoZkbHTbJMeBRH3GkwsKZqEQWI0Ua9xcAFXVPYCBqeU1s+Kz4BI6DYdD0i/OVRhCFE55R3CnEhgesu2xQ1ek2FUgYbx/ZewjBiYURj4r7ZPvJEq/O/vlXCj58fSMcz2+Yk9ALj4+sztUVpX6jp6isWHF0grqnEqHJAjR82Mq0m6IZO9XtZ4fEVjfQ052aHtytl1SsR7718lGgt6Hq4MqISWflvq64Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zz8CpiKRMsJrNGSKa/QegXiqORufyKQcOX2q/5UVgaDW5TOMdjrwUxgNQVFHmiVt10ho6aVbtt4jE85J8N+SacxHU3SLQeWhRGrAK1DVgKLvtf/7/Xf8gteEHEDML7grUMtLqGY66xv3loo6ph7gJaHCPCK3rQ7UmJmFwwNdKVVECALCRek17YpQxzp8/BzSxwCM42BtLUf9Ag+NuisJtgGf/MW+bMbE5+ZHztYl+72VC2lAOtD/TpHcN5y7ERzZwGRk7ED2mosuyh/Dcf+cxhR85712wHZyN7YXkCvlWnrNsYLPkPMnHy1QApnOeE4EBrntw4Z4qUQQOq/B4JWB5g==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 01 Mar 2022 14:21:33 +0000
  • Ironport-data: A9a23:QNHp46M++a9/+K/vrR20l8FynXyQoLVcMsEvi/4bfWQNrUol3mMGy zBMWDyOb6uKYmT8KNh/Pd/n9EICv5GByodrHgto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdleF+lH1dOKJQUBUjclkfJKlYAL/En03FFcMpBsJ00o5wbZi2tcw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Zl NFdq6TzWwgQNajDor4QdDN+SnovMvgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALNs7kMZlZonh95TrYEewnUdbIRKCiCdpwgmht35gTRau2i 8wxamB+RxruRzp1NVYzL9EEjtau2yf5SmgNwL6SjfVuuDWCpOBr65DyNPLFd9rMQt9a9m6Iq 2SD82nnDxUyMN2E1SHD4n+qnvXIny7wRMQVDrLQ3vxgjUCXx2cTIAYLTlb9qv684nNSQPoGd RZSoHB36/Fvqgr7FbERQiFUvlbYug4CY5lCHNQx7Q63kKfzySDAXTkLG2sphMMdiOc6Qjkj1 1msltzvBCByvLD9dU9x5ot4vhvpZ3FLcDZqiTssCFJcvoK9+N1bYgfnE447eJNZmOEZDt0ZL 9qiiCElz4segscQv0lQ1QCW2mn8znQlo+Nc2+k2Yo5Hxl4hDGJGT9bxgbQ+0RqmBNzBJrVml CJZ8/VyFMhUUfmweNWlGY3h5o2B6fefKyH7ilVyBZQn/DnF0yf9Id4Iv2ogeB4wa5dsldrVj Kn741g5CHh7ZibCUEOKS9jpV5RCIVbIT7wJqcw4nvIRO8MsJWdrDQllZFKK3nCFraTfufpXB HtvSu71VSxyIf0+lFKeHr5BuZd2lnFW7T6CHvjTkkX4uYdykVbIEN/pxnPVNbtnhE5FyS2Im +ti2zyikE0OALWjOXCMqeb+7zkidBAGOHw/kOQOHsarKQt6AmAxTfjXxLIqYYt+mKpJ0OzP+ xmAtoVwkwCXaaHvQelSVk1eVQ==
  • Ironport-hdrordr: A9a23:WcndNaw4i4T3Tf2ptAUCKrPwIr1zdoMgy1knxilNoH1uHvBw8v rEoB1173DJYVoqNk3I++rhBEDwexLhHPdOiOF6UItKNzOW21dAQrsSiLfK8nnNHDD/6/4Y9Y oISdkbNDQoNykZsfrH
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Mar 01, 2022 at 03:06:30PM +0100, Jan Beulich wrote:
> On 01.03.2022 14:43, Roger Pau Monné wrote:
> > On Tue, Mar 01, 2022 at 09:55:32AM +0100, Jan Beulich wrote:
> >> Especially when linking a PE binary (xen.efi), standalone output
> >> sections are expensive: Often the linker will align the subsequent one
> >> on the section alignment boundary (2Mb) when the linker script doesn't
> >> otherwise place it. (I haven't been able to derive from observed
> >> behavior under what conditions it would not do so.)
> >>
> >> With gcov enabled (and with gcc11) I'm observing enough sections that,
> >> as of quite recently, the resulting image doesn't fit in 16Mb anymore,
> >> failing the final ASSERT() in the linker script. (That assertion is
> >> slated to go away, but that's a separate change.)
> >>
> >> Any destructor related sections can be discarded, as we never "exit"
> >> the hypervisor. This includes .text.exit, which is referenced from
> >> .dtors.*. Constructor related sections need to all be taken care of, not
> >> just those with historically used names: .ctors.* and .text.startup is
> >> what gcc11 populates. While there re-arrange ordering / sorting to match
> >> that used by the linker provided scripts.
> >>
> >> Finally, for xen.efi only, also discard .note.gnu.*. These are
> >> meaningless in a PE binary. Quite likely, while not meaningless there,
> >> the section is also of no use in ELF, but keep it there for now.
> > 
> > Should we also use --orphan-handling=warn as to recognize orphaned
> > sections and attempt place them? We have now detected this because of
> > the 16Mb limit, but if we remove that check that we could end up
> > carrying a non-trivial amount of 2Mb aligned unhandled regions.
> 
> Yes, I guess we should use this option. See below.
> 
> >> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> >> ---
> >> TBD: We also use CONSTRUCTORS for an unknown reason. Documentation for
> >>      ld is quite clear that this is an a.out-only construct.
> > 
> > I've found some (old) documentation where it does also mention ECOFF
> > and XCOFF apart from a.out:
> > 
> > "When linking object file formats which do not support arbitrary
> > sections, such as ECOFF and XCOFF, the linker will automatically
> > recognize C++ global constructors and destructors by name. For these
> > object file formats, the CONSTRUCTORS command tells the linker where
> > this information should be placed."
> > 
> > I guess we can get rid of it.
> 
> I've taken note to make yet another patch.
> 
> > The patch LGTM:
> > 
> > Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Thanks.
> 
> > With the possible addition of --orphan-handling=warn.
> 
> As above: I agree we should make use of the option, but I don't think
> this should be squashed in here. The option appeared in 2.26, so with
> the current documented binutils baseline we'll need to probe for its
> availability. I'd therefore prefer to make this a separate change,
> and I've taken respective note as well.

I didn't check when it first appeared. I'm fine with a separate
change.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.