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

[PATCH] x86: avoid SORT_BY_INIT_PRIORITY with old GNU ld


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 7 Mar 2022 14:49:32 +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=XPMDXJ8DEsGxfE6cWFy2tMlf7ejnDjisqhedDx6eHvE=; b=RSFvSbQ64v88UO8BcYy7tKxD94gdwwGL7KYVLi1LvQgat3ekbgoTWnJOI6xtkP1PD6n0dSYFVX2jK97H8pp2ChCuFzgGgE0b1NnVohYbkeXU5TQ1tVKwl1mNjPwUSPRkIQPP6YrE9vW+ZIRI3tCQ3wUyO4CsjKOKE3Sl3y39jE+pLCnVPgbv9N5vGTqUnyI+nLOedjsD0trrNFHQSvChy7nK5WvhFcTvI47GWBHvCtLyWjCJu3GlCzl+cNUa42uzrebMUTiQVqzoDTVayxMxDQgpeCDDdTCr5zi+evf0Y4rGVlwTrcaTTpEyRg9l3L6YfDZ1iZNLY+3IFhy6oZFRuQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R5vUUEjT+CqY9fSKPmcYfMazJXfmZUx38Hfp4cgmYuJnnBZy6VtPeqgKrN3Yl1PYbaPF9R3FMWQIKe3NFkWRrRGULw5izrJIrgNi8yvlbhn8P27UjlY+n7lb1S0uVOnmZOCpA1TjbrIRyB4ViaFG2iveSnD2xaS5/qUHRJ2nyQOG1qCQ45vx/u3pTEWM2jnlDYdd0NpwcOdSZjWju8Wi/g72H3EX6Uapc3PmErH8ssbk4aF/G8aQrU4st2qlWXH8NtCCHTDEa/wYj5zcLfc7PCv1wqCImTVgr+nRnuuIMiQ4jOLsmZZcFqi9ytWtqcXXDvGsYDFXVx6TRu6cIjUuhw==
  • 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: Mon, 07 Mar 2022 13:49:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Support for this construct was added in 2.22 only. Avoid the need to
introduce logic to probe for linker script capabilities by (ab)using the
probe for a command line option having appeared at about the same time.

Fixes: 4b7fd8153ddf ("x86: fold sections in final binaries")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Obviously this doesn't take care of old LLVM ld yet, if any care is
needed there in the first place.

--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -70,6 +70,11 @@ ifeq ($(CONFIG_UBSAN),y)
 $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
 endif
 
+# While not much better than going by raw GNU ld version, utilize that the
+# feature we're after has appeared in the same release as the
+# --print-output-format command line option.
+AFLAGS-$(call ld-option,--print-output-format) += 
-DHAVE_LD_SORT_BY_INIT_PRIORITY
+
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 
 efi-check := arch/x86/efi/check
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -30,6 +30,10 @@ ENTRY(start_pa)
 # define SECTION_ALIGN PAGE_SIZE
 #endif
 
+#ifndef HAVE_LD_SORT_BY_INIT_PRIORITY
+# define SORT_BY_INIT_PRIORITY SORT
+#endif
+
 OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT)
 
 OUTPUT_ARCH(i386:x86-64)




 


Rackspace

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