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

[PATCH 2/2] x86: split .fixup section with new enough gas


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 5 Jan 2023 12:12:02 +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=NJJFY6hYgfpPLoX7W5+fl1W4cpHjk669sUfN4cB1eO4=; b=Gl2XsCoFZrKOoBk5spBRrAEktn0fQa577mT5Rnth1Dk6kGV6ksK+avl2viwFwl6P3ElZKsl4MZuSCjWG0Yozb7PPGsBMiGPoAV66uCe1qLMhGzmVEVXzck/Xz0t6QUTnanPEkiFjgKxhZ3beKo16vF2NheRMJ6bhGgVuFTtnB8bOB154N+daxkCHO0+ssF0yJRvuuOxUvkLxmW7astb0J5SDjZLss9JVoqRpjtwmLQi4WaJ6YNNIx4FTmxIIfBYZDyhi/zwA53l6LH8Dp3moRFyrno13sf/oxRL7WEHjPR0vojwTMy2pM4dkwqYi3g/lL2WzH917ZCi1DjHtq74zmA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dyXTtLgnBsZZO9u37fZXGeTTu5JWvKD1DVDmwSnNIsJQhB4siXfK9v9Tcogv9xqtAuOJ34+E92vtmDxOo1cXP0yuIguQPvURdOmjE4EqTkJiDgYvqu+ZeL6PIfUedMqOIouLtV9Key2oj7EoCKMZbh8UbGmDN8raP3k7zcKAGMhYbs9nxJh6nST71VLKQhm1mwZfnQfTm4y9gaUlQFKoa+ecGv/jux4cmyVFNe5pkPkto2RAvnovUuynVzsU6tYFrhjiqqmYA3p9mH3JoQh29hsxMgwPcHBeTDHkVxQbI41HRxdZi9QXUiQsd0qv5DNNZLgk2PXzdYPkWaTcKd3yyg==
  • 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: Thu, 05 Jan 2023 11:12:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

GNU as, as of version 2.26, allows deriving the name of a section to
switch to from the present section's name. For the replacement to occur
--sectname-subst needs to be passed to the assembler.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Similarly (and perhaps of more interest) we could split .ex_table,
allowing to reduce the number of entries to search through post-init.

--- a/Config.mk
+++ b/Config.mk
@@ -98,7 +98,7 @@ cc-option = $(shell if test -z "`echo 'v
 # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)
 cc-option-add = $(eval $(call cc-option-add-closure,$(1),$(2),$(3)))
 define cc-option-add-closure
-    ifneq ($$(call cc-option,$$($(2)),$(3),n),n)
+    ifneq ($$(call cc-option,$$($(2)),$(firstword $(3)),n),n)
         $(1) += $(3)
     endif
 endef
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -34,6 +34,9 @@ $(call as-option-add,CFLAGS,CC,\
 $(call as-option-add,CFLAGS,CC,\
     ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
 
+# Check to see whether the assmbler supports the --sectname-subst option.
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--sectname-subst 
-DHAVE_AS_SECTNAME_SUBST)
+
 CFLAGS += -mno-red-zone -fpic
 
 # Xen doesn't use MMX or SSE interally.  If the compiler supports it, also skip
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -81,10 +81,18 @@ register unsigned long current_stack_poi
 
 /* Exception recovery code section */
 #ifdef __ASSEMBLY__
-# define _ASM_FIXUP     .pushsection .fixup, "ax", @progbits
+# ifdef HAVE_AS_SECTNAME_SUBST
+#  define _ASM_FIXUP    .pushsection .fixup%S, "ax", @progbits
+# else
+#  define _ASM_FIXUP    .pushsection .fixup, "ax", @progbits
+# endif
 # define _ASM_FIXUP_END .popsection
 #else
-# define _ASM_FIXUP     " .pushsection .fixup, \"ax\", @progbits"
+# ifdef HAVE_AS_SECTNAME_SUBST
+#  define _ASM_FIXUP    " .pushsection .fixup%%S, \"ax\", @progbits"
+# else
+#  define _ASM_FIXUP    " .pushsection .fixup, \"ax\", @progbits"
+# endif
 # define _ASM_FIXUP_END " .popsection"
 #endif
 
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -103,6 +103,12 @@ SECTIONS
        *(.text.__x86_indirect_thunk_*)
 
        *(.fixup)
+       *(.fixup.text)
+       *(.fixup.text.cold)
+       *(.fixup.text.unlikely .fixup.text.*_unlikely .fixup.text.unlikely.*)
+#ifdef CONFIG_CC_SPLIT_SECTIONS
+       *(.fixup.text.*)
+#endif
        *(.gnu.warning)
        _etext = .;             /* End of text section */
   } PHDR(text) = 0x9090
@@ -215,6 +221,8 @@ SECTIONS
        _sinittext = .;
        *(.init.text)
        *(.text.startup)
+       *(.fixup.init.text)
+       *(.fixup.text.startup)
        _einittext = .;
        /*
         * Here are the replacement instructions. The linker sticks them
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -89,7 +89,9 @@
 #define DISCARD_SECTIONS     \
   /DISCARD/ : {              \
        *(.text.exit)         \
+       *(.fixup.text.exit)   \
        *(.exit.text)         \
+       *(.fixup.exit.text)   \
        *(.exit.data)         \
        *(.exitcall.exit)     \
        *(.discard)           \




 


Rackspace

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