From 2c868ca44d44e92c73758fc9381cb54129f1388c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= Date: Tue, 8 Jul 2025 12:01:15 +0200 Subject: [PATCH] package/xen: fix build for arm with binutils >= 2.41 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Xen currently fails to build for 32-bit Arm v7 with binutils >= 2.41, with the following error: proc-v7.S:33: Error: junk at end of line, first unrecognized character is `#' The failure can be reproduced with the commands: cat >.config < Cc: Alistair Francis [Julien: - reword commit title - add commands to reproduce the issue in commit log - add missing SoB lines to patches ] Signed-off-by: Julien Olivain --- ...d-.rodata-to-be-marked-as-executable.patch | 58 +++++++++++++++ ...solaris-syntax-for-.section-directiv.patch | 73 +++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 package/xen/0007-xen-arm32-avoid-.rodata-to-be-marked-as-executable.patch create mode 100644 package/xen/0008-arm-Avoid-using-solaris-syntax-for-.section-directiv.patch diff --git a/package/xen/0007-xen-arm32-avoid-.rodata-to-be-marked-as-executable.patch b/package/xen/0007-xen-arm32-avoid-.rodata-to-be-marked-as-executable.patch new file mode 100644 index 0000000000..9c484698ca --- /dev/null +++ b/package/xen/0007-xen-arm32-avoid-.rodata-to-be-marked-as-executable.patch @@ -0,0 +1,58 @@ +From 99314e08c6450a841d4f7155b7ce364e0990df1c Mon Sep 17 00:00:00 2001 +From: Jan Beulich +Date: Fri, 11 Jun 2021 11:19:15 +0200 +Subject: [PATCH] xen/arm32: avoid .rodata to be marked as executable + +The section .proc.info lives in .rodata as it doesn't contain any +executable code. However, the section is still marked as executable +as the consequence .rodata will also be marked executable. + +Xen doesn't use the ELF permissions to decide the page-table mapping +permission. However, this will confuse disassemblers. + +'#execinstr' is now removed on all the pushsection dealing with +.proc.info + +Signed-off-by: Jan Beulich +[julieng: Rework the commit message] +Acked-by: Julien Grall +Upstream: https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=163f47c14737cfa9dfb3240deea356b08caf7614 +Signed-off-by: Vincent Stehlé +--- + xen/arch/arm/arm32/proc-v7.S | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/xen/arch/arm/arm32/proc-v7.S b/xen/arch/arm/arm32/proc-v7.S +index 46bfc7a..8b418ed 100644 +--- a/xen/arch/arm/arm32/proc-v7.S ++++ b/xen/arch/arm/arm32/proc-v7.S +@@ -30,7 +30,7 @@ brahma15mp_init: + mcr CP32(r0, ACTLR) + mov pc, lr + +- .section ".proc.info", #alloc, #execinstr ++ .section ".proc.info", #alloc + .type __v7_ca15mp_proc_info, #object + __v7_ca15mp_proc_info: + .long 0x410FC0F0 /* Cortex-A15 */ +@@ -39,7 +39,7 @@ __v7_ca15mp_proc_info: + .long caxx_processor + .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info + +- .section ".proc.info", #alloc, #execinstr ++ .section ".proc.info", #alloc + .type __v7_ca7mp_proc_info, #object + __v7_ca7mp_proc_info: + .long 0x410FC070 /* Cortex-A7 */ +@@ -48,7 +48,7 @@ __v7_ca7mp_proc_info: + .long caxx_processor + .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info + +- .section ".proc.info", #alloc, #execinstr ++ .section ".proc.info", #alloc + .type __v7_brahma15mp_proc_info, #object + __v7_brahma15mp_proc_info: + .long 0x420F00F0 /* Broadcom Brahma-B15 */ +-- +2.48.1 + diff --git a/package/xen/0008-arm-Avoid-using-solaris-syntax-for-.section-directiv.patch b/package/xen/0008-arm-Avoid-using-solaris-syntax-for-.section-directiv.patch new file mode 100644 index 0000000000..127c126f99 --- /dev/null +++ b/package/xen/0008-arm-Avoid-using-solaris-syntax-for-.section-directiv.patch @@ -0,0 +1,73 @@ +From be0ff8586e38823d6ee08e031c28e5831bbb0991 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 1 Aug 2023 10:49:30 -0700 +Subject: [PATCH] arm: Avoid using solaris syntax for .section directive + +Assembler from binutils 2.41 will rejects ([1], [2]) the following +syntax + +.section "name", #alloc + +for any other any target other than ELF SPARC. This means we can't use +it in the Arm code. + +So switch to the GNU syntax + +.section name [, "flags"[, @type]] + +[1] https://sourceware.org/bugzilla/show_bug.cgi?id=11601 +[2] https://sourceware.org/binutils/docs-2.41/as.html#Section + +Signed-off-by: Khem Raj +Reviewed-by: Michal Orzel +[jgrall: Reword commit message] +Acked-by: Julien Grall +Upstream: https://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=dfc490a3740bb7d6889939934afadcb58891fbce +Signed-off-by: Vincent Stehlé +--- + xen/arch/arm/arm32/proc-v7.S | 6 +++--- + xen/arch/arm/dtb.S | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/xen/arch/arm/arm32/proc-v7.S b/xen/arch/arm/arm32/proc-v7.S +index 8b418ed..9869780 100644 +--- a/xen/arch/arm/arm32/proc-v7.S ++++ b/xen/arch/arm/arm32/proc-v7.S +@@ -30,7 +30,7 @@ brahma15mp_init: + mcr CP32(r0, ACTLR) + mov pc, lr + +- .section ".proc.info", #alloc ++ .section .proc.info, "a" + .type __v7_ca15mp_proc_info, #object + __v7_ca15mp_proc_info: + .long 0x410FC0F0 /* Cortex-A15 */ +@@ -39,7 +39,7 @@ __v7_ca15mp_proc_info: + .long caxx_processor + .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info + +- .section ".proc.info", #alloc ++ .section .proc.info, "a" + .type __v7_ca7mp_proc_info, #object + __v7_ca7mp_proc_info: + .long 0x410FC070 /* Cortex-A7 */ +@@ -48,7 +48,7 @@ __v7_ca7mp_proc_info: + .long caxx_processor + .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info + +- .section ".proc.info", #alloc ++ .section .proc.info, "a" + .type __v7_brahma15mp_proc_info, #object + __v7_brahma15mp_proc_info: + .long 0x420F00F0 /* Broadcom Brahma-B15 */ +diff --git a/xen/arch/arm/dtb.S b/xen/arch/arm/dtb.S +index c703aef..8771daf 100644 +--- a/xen/arch/arm/dtb.S ++++ b/xen/arch/arm/dtb.S +@@ -1,2 +1,2 @@ +- .section .dtb,#alloc ++ .section .dtb, "a" + .incbin CONFIG_DTB_FILE +-- +2.48.1 +