[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v9] common: honor CONFIG_CC_SPLIT_SECTIONS also for assembly functions
- To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Wed, 28 Jan 2026 09:35:48 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=NHu8Cz4NJZCZKEg8BY5ysWNTXUrzN9kwI/SmKpiBfws=; b=lqlnUk9NBeQqw3Id4YkXMLTBpvJ+KRRxQmR8PAKEEdTEQIHHTzmVe+MQtJ8u6N/UrcgpI6IeTHSwE8EJ3QaQzebFBGfxumirQcym8NXFZ3NWlYI/1HQrCNfniPhAKaLJVD6YvkU6w0IHNbTrvZjyisi+YD0v+G4e7iXHeehnCBdt46CYmgkCjS5TVVbY1GkinUndOiuweo3uLCT0Ca/tBAjtDT3YMjj3xCnZRuhmoAJ931htYj/XyMEVDwrfiBXwPO1cdIUESCxN+x+1MKQUh9VwyE2lOxHE+B1x6HwFVf1vLOxFqTqnjaRSnIRNqfRU4JoYB4Qt+DIvs83yLixGOQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jxA/2Xii0HEaj18jv2jcXYbcsSf+MC4DYE/NjR9cojO+w7AlJdDjHctH4aNRY1rkp/pttBCAyoea8Td9loM5zxg87CLPE1i3hQK/uTiSUH/knRfZ5gn37C1aKEFxG8teDgjYBzp9Td5+DylCMdyUJgN7uVdJ77YddhjcsbrQLgitc7vT3V2EKH/rYB4WL+k+XND2beee0UPnkBM2QXilRi+JNEie7kdNMAw5AQUuhEbiqkoFtz5NzTMMF03m2h1qVh0p6AIIGI3MN1Sg4Ns5ht4a0J5b8WumAnMd0N5iucx4Qk25NjW/L6bODv/xo2yf2QZRU85pdk/uucIgA/rIXw==
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
- Delivery-date: Wed, 28 Jan 2026 14:35:40 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2025-04-01 06:58, Jan Beulich wrote:
Leverage the new infrastructure in xen/linkage.h to also switch to per-
function sections (when configured), deriving the specific name from the
"base" section in use at the time FUNC() is invoked.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Tested-by: Luca Fancellu <luca.fancellu@xxxxxxx> # arm
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
Though I have two suggestions below.
---
TBD: Since we use .subsection in UNLIKELY_START(), a perhaps not really
wanted side effect of this change is that respective out-of-line
code now moves much closer to its original (invoking) code.
TBD: Of course something with the same overall effect, but less
impactful might do in Config.mk. E.g. $(filter-out -D%,$(3))
instead of $(firstword (3)). In fact Roger wants the detection to
be in Kconfig, for LIVEPATCH to depend on it. Yet the whole
underlying discussion there imo would first need settling (and
therefore reviving).
Note that we'd need to split DATA() in order to separate r/w, r/o, and
BSS contributions. Further splitting might be needed to also support
more advanced attributes (e.g. merge), hence why this isn't done right
here. Sadly while a new section's name can be derived from the presently
in use, its attributes cannot be. Perhaps the only thing we can do is
give DATA() a 2nd mandatory parameter. Then again I guess most data
definitions could be moved to C anyway.
---
v9: Move Arm32 SYM_PUSH_SECTION() overrides here.
v7: Override SYM_PUSH_SECTION() in arch/x86/indirect-thunk.S. Re-base,
notably to deal with fallout from fba250ae604e ("xen/arm64: head:
Add missing code symbol annotations").
v6: Deal with x86'es entry_PF() and entry_int82() falling through to the
next "function". Re-base.
v5: Re-base over changes earlier in the series.
v4: Re-base.
v2: Make detection properly fail on old gas (by adjusting
cc-option-add-closure).
--- a/Config.mk
+++ b/Config.mk
@@ -102,7 +102,7 @@ cc-option = $(shell if $(1) $(2:-Wno-%=-
# Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)
Maybe expand to illustrate extra flags will also be passed
(-DHAVE_AS_SECTNAME_SUBST)?
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/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -48,6 +48,13 @@
.section .text.header, "ax", %progbits
.arm
+/*
+ * Code below wants to all live in the section established above. Annotations
+ * from xen/linkage.h therefore may not switch sections (honoring
+ * CONFIG_CC_SPLIT_SECTIONS). Override the respective macro.
+ */
+#undef SYM_PUSH_SECTION
+#define SYM_PUSH_SECTION(name, attr)
I put this through CI and it passed as-is, so it doesn't need to change.
However, included in a different branch with some --gc-sections
experiments, I needed to add SYM_PUSH_SECTION re-definitions like above to:
xen/arch/ppc/ppc64/head.S
or ppc failed the linker script
ASSERT(_stext_exceptions == EXCEPTION_VECTORS_START);
And these:
xen/arch/riscv/riscv64/head.S
xen/arch/arm/arm64/mmu/head.S
riscv and arm64 built, but hung when booting in CI tests.
There are also these:
xen/arch/arm/arm32/mpu/head.S
xen/arch/arm/arm64/mpu/head.S
They aren't built or tested in CI, FWICT. And they are not in alternate
sections. Maybe an ARM person can chime in on those.
Thanks,
Jason
|