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

[PATCH] x86: also discard .fini_array in linker script


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 4 Mar 2022 08:49:39 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=/O8NOBCkJHew4SJp04VnA85nUKzZ6JUynilejL0ZA9A=; b=Ckn1znu9dlrsVWga27fejWJXEbjrd3FjIcwsPwArkP6/bf7jBB6LsaXFYrAfy8QM9HBGsK27FC42wpeRSYJyyYeUogjaehrkGm5qfWVKygUlFNXhQWJ3JPwsJuFyz9ZZ9tGr+mszIloYMDPR/mdhe+Y/qO3AToqxjN0KonXWHjFR0buYGQF46fgzbgDEVvMsogFxnnShrKxmOrdxu2HQouIRLhc5Pm4BtuvH2bdQ4W9KE70tLnjU2gb98WLwUfrKu5pIUUn+/umKEEe73JATsWzK9zagSs/P3LzxExw+S8HRiSc4i716eTPVqvMDCJhgWj+Js6ECKWVGQ4Li5CGbEw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KugFAC3AwLdPnEccBvBKsb4d//57mNq0Img9gt8LrLGLSTZrCh3hU7bkCLtYyt3MwBTVFUTVpRUmSBjx05FOzRLbEkz2J+eTEAxjwMReMlZoywnFvPucyD39qzTj8OmOmZh8XDVPZxioxuC4720ztmMttou06qQSI2dgSHsbfRCn6lWwmlykTeLcziPa6zBMMbaExLWXjAzwghVj2LXIC5zcPbIDLIwqPQC6RCcnUNBKsFNbk87To9hE5whmysz3fnTkNG3MZSgIGJyAPuGAX/dTzaFbptGZ6KLfA1KWnSiRx5Sx6MtqMlPkZRPEaHEiurranJbh1BwaXJsczqVAuA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 04 Mar 2022 07:49:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This simply parallels .dtors. Both section types can reference
.text.exit, which requires them to be discarded together with that one.
Compilers, depending on their findings during the configure phase, may
elect to use either model. While .{init,fini}_array look to be
preferred, cross compilers apparently have this guessed, likely
resulting in a fallback to .{c,d}tors. Hence we need to support both
sets.

Fixes: 4b7fd8153ddf ("x86: fold sections in final binaries")
Reported-by: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
As mentioned elsewhere, I don't think init_constructors() is correct
for the .ctors variant. But that's a separate issue.

--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -415,6 +415,8 @@ SECTIONS
        *(.eh_frame)
        *(.dtors)
        *(.dtors.*)
+       *(.fini_array)
+       *(.fini_array.*)
 #ifdef EFI
        *(.comment)
        *(.comment.*)




 


Rackspace

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