unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: bug-grub@gnu.org
Cc: 41982@debbugs.gnu.org
Subject: bug#41982: [PATCH v2] grub-core: Build fixes for i386
Date: Wed, 08 Jul 2020 19:29:31 +0200	[thread overview]
Message-ID: <87imexncec.fsf@gnu.org> (raw)
In-Reply-To: <87ftamrlcz.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Tue, 23 Jun 2020 14:57:00 +0200")

[-- Attachment #1: Type: text/plain, Size: 413 bytes --]

Jan Nieuwenhuizen writes:

Hello!

> When cross-compiling Grub-2.04 from i386-linux-gnu to i586-pc-hurd on
> GNU Guix, I got this error

Today, we found* that my patch introduced a regression: a native, EFI
build on i686-linux-gnu failed with

    lib/i386/relocator64.S:97: Error: bad register name `%rsp'

The attached v2 fixes that.

Greetings,
Janneke

*) http://logs.guix.gnu.org/guix/2020-07-08.log#104852


[-- Attachment #2: v2-0001-grub-core-Build-fixes-for-i386.patch --]
[-- Type: text/x-patch, Size: 2202 bytes --]

From 17b242e7b80108f1467037e15b605595e4823b2e Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Sun, 21 Jun 2020 15:10:40 +0200
Subject: [PATCH v2] grub-core: Build fixes for i386
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8

* grub-core/lib/i386/relocator64.S: Avoid x86_64 instructions on i386.
---
 grub-core/lib/i386/relocator64.S | 33 +++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/grub-core/lib/i386/relocator64.S b/grub-core/lib/i386/relocator64.S
index 148f38adb..ea39908c1 100644
--- a/grub-core/lib/i386/relocator64.S
+++ b/grub-core/lib/i386/relocator64.S
@@ -63,7 +63,9 @@ VARIABLE(grub_relocator64_cr3)
 	movq	%rax, %cr3
 #endif
 
+#ifdef __x86_64__
 	.code64
+#endif
 
 	/* mov imm64, %rax */
 	.byte 	0x48
@@ -71,7 +73,14 @@ VARIABLE(grub_relocator64_cr3)
 VARIABLE(grub_relocator64_rsp)
 	.quad	0
 
+#ifndef __x86_64__
+	/* movq	%rax, %rsp */
+	.byte 	0x48
+	.byte	0x89
+	.byte	0xc4
+#else
 	movq	%rax, %rsp
+#endif
 
 #ifdef GRUB_MACHINE_EFI
 	jmp	LOCAL(skip_efi_stack_align)
@@ -85,7 +94,14 @@ VARIABLE(grub_relocator64_rsp)
 	 */
 VARIABLE(grub_relocator64_efi_start)
 	/* Align the stack as UEFI spec requires. */
+#ifndef __x86_64__
+	.byte 0x48
+        .byte 0x83
+        .byte 0xe4
+        .byte 0xf0
+#else
 	andq	$~15, %rsp
+#endif
 
 LOCAL(skip_efi_stack_align):
 #endif
@@ -95,8 +111,15 @@ LOCAL(skip_efi_stack_align):
 VARIABLE(grub_relocator64_rsi)
 	.quad	0
 
+#ifndef	__x86_64__
+	/* movq	%rax, %rsi */
+	.byte 	0x48
+	.byte	0x89
+	.byte 	0xc6
+#else
 	movq	%rax, %rsi
-	
+#endif
+
 	/* mov imm64, %rax */
 	.byte 	0x48
 	.byte	0xb8
@@ -128,6 +151,14 @@ VARIABLE(grub_relocator64_rdx)
 #ifdef __APPLE__
 	.byte 0xff, 0x25
 	.quad 0
+#elif !defined (__x86_64__)
+	/* jmp *LOCAL(jump_addr) (%rip) */
+	.byte 0xff
+        .byte 0x25
+	.byte 0
+	.byte 0
+	.byte 0
+	.byte 0
 #else
 	jmp *LOCAL(jump_addr) (%rip)
 #endif
-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com


[-- Attachment #3: Type: text/plain, Size: 152 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com

  reply	other threads:[~2020-07-08 17:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-21 13:55 bug#41982: [PATCH 0/1] gnu: grub: Cross-build fix for system i686-linux Jan Nieuwenhuizen
2020-06-21 13:59 ` bug#41982: [PATCH 1/1] " Jan (janneke) Nieuwenhuizen
2020-06-23  9:27 ` bug#41982: [PATCH 0/1] " Ludovic Courtès
2020-06-23 12:52   ` Jan Nieuwenhuizen
2020-06-23 15:54     ` Ludovic Courtès
2020-06-25 15:52       ` Jan Nieuwenhuizen
2020-06-23 12:57 ` bug#41982: [PATCH] grub-core: Build fixes for i386 Jan Nieuwenhuizen
2020-07-08 17:29   ` Jan Nieuwenhuizen [this message]
2020-07-13 13:51     ` bug#41982: [PATCH v2] " Ludovic Courtès
2020-07-13 14:03       ` Jan Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imexncec.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=41982@debbugs.gnu.org \
    --cc=bug-grub@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).