@@ -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
@@ -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
@@ -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
@@ -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
@@ -89,7 +89,9 @@
#define DISCARD_SECTIONS \
/DISCARD/ : { \
*(.text.exit) \
+ *(.fixup.text.exit) \
*(.exit.text) \
+ *(.fixup.exit.text) \
*(.exit.data) \
*(.exitcall.exit) \
*(.discard) \
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@suse.com> --- Similarly (and perhaps of more interest) we could split .ex_table, allowing to reduce the number of entries to search through post-init.