#20 Fix build with binutils 2.41
Closed 3 months ago by coiby. Opened 4 months ago by salimma.
rpms/ salimma/kexec-tools fix-binutils-2.41  into  rawhide

@@ -0,0 +1,91 @@ 

+ From b8d99cf22dff15ca4ead82e08cc3e8f7428aed6a Mon Sep 17 00:00:00 2001

+ From: Michel Lind <salimma@fedoraproject.org>

+ Date: Mon, 29 Jan 2024 16:45:29 -0600

+ Subject: [PATCH] Fix building on x86_64 with binutils 2.41

+ 

+ Newer versions of the GNU assembler (observed with binutils 2.41) will

+ complain about the ".arch i386" in files assembled with "as --64",

+ with the message "Error: 64bit mode not supported on 'i386'".

+ 

+ Fix by moving ".arch i386" below the relevant ".code32" directive, so

+ that the assembler is no longer expecting 64-bit instructions to be used

+ by the time that the ".arch i386" directive is encountered.

+ 

+ Based on similar iPXE fix:

+ https://github.com/ipxe/ipxe/commit/6ca597eee

+ 

+ Signed-off-by: Michel Lind <michel@michel-slm.name>

+ ---

+  purgatory/arch/i386/entry32-16-debug.S | 2 +-

+  purgatory/arch/i386/entry32-16.S       | 2 +-

+  purgatory/arch/i386/entry32.S          | 2 +-

+  purgatory/arch/i386/setup-x86.S        | 2 +-

+  4 files changed, 4 insertions(+), 4 deletions(-)

+ 

+ diff --git a/purgatory/arch/i386/entry32-16-debug.S b/purgatory/arch/i386/entry32-16-debug.S

+ index 5167944..12e1164 100644

+ --- a/purgatory/arch/i386/entry32-16-debug.S

+ +++ b/purgatory/arch/i386/entry32-16-debug.S

+ @@ -25,10 +25,10 @@

+  	.globl entry16_debug_pre32

+  	.globl entry16_debug_first32

+  	.globl entry16_debug_old_first32

+ -	.arch i386

+  	.balign 16

+  entry16_debug:

+  	.code32

+ +	.arch i386

+  	/* Compute where I am running at (assumes esp valid) */

+  	call	1f

+  1:	popl	%ebx

+ diff --git a/purgatory/arch/i386/entry32-16.S b/purgatory/arch/i386/entry32-16.S

+ index c051aab..eace095 100644

+ --- a/purgatory/arch/i386/entry32-16.S

+ +++ b/purgatory/arch/i386/entry32-16.S

+ @@ -20,10 +20,10 @@

+  #undef i386	

+  	.text

+  	.globl entry16, entry16_regs

+ -	.arch i386

+  	.balign 16

+  entry16:

+  	.code32

+ +	.arch i386

+  	/* Compute where I am running at (assumes esp valid) */

+  	call	1f

+  1:	popl	%ebx

+ diff --git a/purgatory/arch/i386/entry32.S b/purgatory/arch/i386/entry32.S

+ index f7a494f..8ce9e31 100644

+ --- a/purgatory/arch/i386/entry32.S

+ +++ b/purgatory/arch/i386/entry32.S

+ @@ -20,10 +20,10 @@

+  #undef i386

+  

+  	.text

+ -	.arch	i386

+  	.globl entry32, entry32_regs

+  entry32:

+  	.code32

+ +	.arch	i386

+  

+  	/* Setup a gdt that should that is generally usefully */

+  	lgdt	%cs:gdt

+ diff --git a/purgatory/arch/i386/setup-x86.S b/purgatory/arch/i386/setup-x86.S

+ index 201bb2c..a212eed 100644

+ --- a/purgatory/arch/i386/setup-x86.S

+ +++ b/purgatory/arch/i386/setup-x86.S

+ @@ -21,10 +21,10 @@

+  #undef i386

+  

+  	.text

+ -	.arch	i386

+  	.globl purgatory_start

+  purgatory_start:

+  	.code32

+ +	.arch	i386

+  

+  	/* Load a gdt so I know what the segment registers are */

+  	lgdt	%cs:gdt

+ -- 

+ 2.41.0

+ 

file modified
+6 -1
@@ -5,7 +5,7 @@ 

  

  Name: kexec-tools

  Version: 2.0.28

- Release: 3%{?dist}

+ Release: 4%{?dist}

  License: GPL-2.0-only

  Summary: The kexec/kdump userspace component

  
@@ -89,6 +89,7 @@ 

  #

  # Patches 101 through 200 are meant for x86_64 kexec-tools enablement

  #

+ Patch101:       kexec-tools-2.0.28-fix-for-binutils-2.41-64bit-archi386.patch

  

  #

  # Patches 301 through 400 are meant for ppc64 kexec-tools enablement
@@ -120,6 +121,7 @@ 

  tar -z -x -v -f %{SOURCE9}

  tar -z -x -v -f %{SOURCE19}

  

+ %patch	101 -p1

  

  %ifarch ppc

  %define archdef ARCH=ppc
@@ -359,6 +361,9 @@ 

  %endif

  

  %changelog

+ * Mon Jan 29 2024 Michel Lind <salimma@fedoraproject.org> - 2.0.28-4

+ - Fix build with binutils 2.41

+ 

  * Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.28-3

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

  

Newer versions of the GNU assembler (observed with binutils 2.41) will
complain about the ".arch i386" in files assembled with "as --64",
with the message "Error: 64bit mode not supported on 'i386'".

Fix by moving ".arch i386" below the relevant ".code32" directive, so
that the assembler is no longer expecting 64-bit instructions to be used
by the time that the ".arch i386" directive is encountered.

Based on similar iPXE fix:
https://github.com/ipxe/ipxe/commit/6ca597eee

Signed-off-by: Michel Lind salimma@fedoraproject.org

Build succeeded.
https://fedora.softwarefactory-project.io/zuul/buildset/de5fa38e3ae24a8b837bc704d4aea009

Hi Michel,

Thanks for the patch! If it's not urgent, could you send the patch to the upstream mailing list kexec@lists.infradead.org [1]? I expect the upstream will merge it within one or two weeks and I'll then do the backporting. Btw, if you are not comfortable with email-based workflow, I can send the patch upstream on behalf of you.

[1] https://lists.infradead.org/mailman/listinfo/kexec

Hi Michel,

Thanks for the patch! If it's not urgent, could you send the patch to the upstream mailing list kexec@lists.infradead.org [1]? I expect the upstream will merge it within one or two weeks and I'll then do the backporting. Btw, if you are not comfortable with email-based workflow, I can send the patch upstream on behalf of you.

[1] https://lists.infradead.org/mailman/listinfo/kexec

hi @coiby ! Yup, I just sent it - https://lists.infradead.org/pipermail/kexec/2024-January/029341.html

Wanted to do it yesterday but was about to board my plane, and haven't finished my b4 setup then. sorry for the delay!

(It's not urgent yet but we want to get this fixed before ELN branches into CentOS Stream 10 - around the same time F40 release branches are cut)

Your patch has been merged upstream and I've backported your patch and released kexec-tools-2.0.28-4.fc40. Thank for you efforts!

Pull-Request has been closed by coiby

3 months ago