[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 14:43:25 +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=o+SBL3Rf+ExGdrUo3Mmdpp8ZIwRGZZZeo7loAC7KyZI=; b=N9mueqtH94q+6VxnO44tWR1m/UVTE6lJsbv99Eog8RjS6NiKJajBwnHs65CEOYdQjsfnpq4qi3mduSruRJhVxuEfTxXcKrZu91Bh3OQ5l1AIgTNRigqpBfLoFh1EEEM006FPfYGthuMKnTYXS1ztEYhZsaXxHKLMGlFwmR0c7ZdPPzjJwoHHMWnbJORWLm6NQX0uHm5f1INsDYYH7DwOPAXYf8kop4J/+NjAKddlhbbyGvtqDdqODOR3OJwwefSEz8+CoygsGhf+L5X/79ileuJBYcEgWeWM8zplFQH7CNQOCVtXN//LOu7tI9EezVNOcJq6HCe51aRs27suqgseMw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K5vCUTK4EWu/UnquWQ3DFsn9FxKdTINpw/NZVoYMQQY4ueUXWCkSzJBBgt4noj6Wcxfu86v3oRY0LI+oRBEZn3qH+6u3P8fwYvPLe8Xczz4pbNDlvKGrW2DDPP5ipJUB6cpcew8xCMqGxksBT16OhMtt3nUmF7H0WFV2YlQTc1aBtWqKphdVkKupnPegr1wbRlFtIboAZ7hox1fHgyf3sAag4CSmGrVRZgDaoezWAXCNKMvt7GxMWnO2op6a+IF5RsnB2RKOxY+spO1utSzsfC46MQFESglCL42oo+XxSDQBGOuxpYYrCU5igWrONoE6b9RIKi0hrnUXhKTGhG9Icw==
  • Authentication-results: esa5.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 13:43:42 +0000
  • Ironport-data: A9a23:/ofwJquaWf1FVU/KPHcCJuu69OfnVEBeMUV32f8akzHdYApBsoF/q tZmKT3UPqyJNDSmfdx3O4W0phhX7JXWzINgSgA+pCsxFXsa+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/nOHNIQMcacUsxLbVYMpBwJ1FQyw4bVvqYy2YLjW1jV4 IuoyyHiEATNNwBcYzp8B52r8HuDjNyq0N/PlgVjDRzjlAa2e0g9VPrzF4noR5fLatA88tqBb /TC1NmEElbxpH/BPD8HfoHTKSXmSpaKVeSHZ+E/t6KK2nCurQRquko32WZ1he66RFxlkvgoo Oihu6BcRi81GqDhodo9XyUBNCEhF/RlpIL3LCKW5Jn7I03uKxMAwt1rBUAye4YZ5vx2ESdF8 vlwxDIlN07ZwbjsmfTiF7cq1p9LwMrDZevzvll6yj7UF7A+SI3rSKTW/95Imjw3g6iiGN6AO 5REOGQ0MHwsZTVoH0dJLLUYgNyNmyGhWBB0+GqzmvAetj27IAtZj+G2bYu9lsaxbdpRtlaVo CTB5WuRKgEXMpmTxCSI9lqoh/TThmXrVYQKDrq6+/V2xlqJyQQ7ChcbSF+6qvmRkVOlVpRUL El8x8Y1hfFsrgrxFIC7BkDm5i7f1vIBZzZOO/Ee5Sy09IrY31++BjcuFx0dVewr7uZjEFTGy WS1t9/uADVutpicRnSc6qqYoFuOBMQFEYMRTXRaFFVYurEPtKl210uSFYg7TMZZm/WoQWmY/ tyckMQpa1z/Z+Yv3r7zw13IiinESnPhHl9svVW/so5IA2pEiG+Zi26AtACzARVodt/xory9U J4swZD2AAcmV8zlqcB1aL9RdIxFHt7cWNEmvXZhHoM66xOm8GO5cIZb7VlWfRk1bJ5bImG1O RaK6Gu9AaO/2lPwNsebhKrrVqwXIVXIT4y5Bpg4kPIUCnSOSON31H43PhPBt4wcuEMtjbs+K f+mnTWEVh4n5VBc5GPuHY81iOZzrghnnD+7bc2rnnyPjOvFDFbIGOhtDbd7Rr1ghE9yiF6Oq Ig32grj40g3bdASlQGMqd9DdQ1RdCNjbX00wuQOHtO+zsNdMDhJI9fawK87epwjmKJQl+zS+ Wq6VFMew1367UAr4y3TApy/QNsDhapCkE8=
  • Ironport-hdrordr: A9a23:jMbR/KrAUsyYLpu2z99fdxwaV5oleYIsimQD101hICG9E/b1qy nKpp8mPHDP5wr5NEtPpTnjAsm9qALnlKKdiLN5Vd3OYOCMghrKEGgN1/qG/xTQXwH46+5Bxe NBXsFFebnN5IFB/KTH3DU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

> 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.

The patch LGTM:

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

With the possible addition of --orphan-handling=warn.

Thanks, Roger.



 


Rackspace

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