@@ -198,14 +198,7 @@ SECTIONS
__bss_start = .;
*(.bss.stack_aligned)
*(.bss.page_aligned)
- . = ALIGN(PAGE_SIZE);
- __per_cpu_start = .;
- *(.bss.percpu.page_aligned)
- *(.bss.percpu)
- . = ALIGN(SMP_CACHE_BYTES);
- *(.bss.percpu.read_mostly)
- . = ALIGN(SMP_CACHE_BYTES);
- __per_cpu_data_end = .;
+ PERCPU_SECTION
*(.bss .bss.*)
. = ALIGN(POINTER_ALIGN);
__bss_end = .;
@@ -148,14 +148,7 @@ SECTIONS
__bss_start = .;
*(.bss.stack_aligned)
*(.bss.page_aligned)
- . = ALIGN(PAGE_SIZE);
- __per_cpu_start = .;
- *(.bss.percpu.page_aligned)
- *(.bss.percpu)
- . = ALIGN(SMP_CACHE_BYTES);
- *(.bss.percpu.read_mostly)
- . = ALIGN(SMP_CACHE_BYTES);
- __per_cpu_data_end = .;
+ PERCPU_SECTION
*(.bss .bss.*)
. = ALIGN(POINTER_ALIGN);
__bss_end = .;
@@ -321,14 +321,7 @@ SECTIONS
DECL_SECTION(.bss) {
__bss_start = .;
*(.bss.page_aligned*)
- . = ALIGN(PAGE_SIZE);
- __per_cpu_start = .;
- *(.bss.percpu.page_aligned)
- *(.bss.percpu)
- . = ALIGN(SMP_CACHE_BYTES);
- *(.bss.percpu.read_mostly)
- . = ALIGN(SMP_CACHE_BYTES);
- __per_cpu_data_end = .;
+ PERCPU_SECTION
*(.bss .bss.*)
. = ALIGN(POINTER_ALIGN);
__bss_end = .;
@@ -151,6 +151,16 @@
#define LOCK_PROFILE_DATA
#endif
+#define PERCPU_SECTION \
+ . = ALIGN(PAGE_SIZE); \
+ __per_cpu_start = .; \
+ *(.bss.percpu.page_aligned) \
+ *(.bss.percpu) \
+ . = ALIGN(SMP_CACHE_BYTES); \
+ *(.bss.percpu.read_mostly) \
+ . = ALIGN(SMP_CACHE_BYTES); \
+ __per_cpu_data_end = .; \
+
#ifdef CONFIG_HAS_VPCI
#define VPCI_ARRAY \
. = ALIGN(POINTER_ALIGN); \
Introduce PERCPU_SECTION macro which manages: * Alignment of the section start * Insertion of per-CPU data sections * Alignment and start/end markers for per-CPU data This change simplifies the linker script maintenance and ensures a unified approach for per-CPU sections across different architectures. Refactor the linker scripts for Arm, PPC, and x86 architectures by using the common macro PERCPU_SECTION defined in xen/xen.lds.h to handle per-CPU data sections. No functional changes. Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> --- xen/arch/arm/xen.lds.S | 9 +-------- xen/arch/ppc/xen.lds.S | 9 +-------- xen/arch/x86/xen.lds.S | 9 +-------- xen/include/xen/xen.lds.h | 10 ++++++++++ 4 files changed, 13 insertions(+), 24 deletions(-)