From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 6BPlNHz88V7YQwAA0tVLHw (envelope-from ) for ; Tue, 23 Jun 2020 12:58:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MAs/MHz88V4nEwAA1q6Kng (envelope-from ) for ; Tue, 23 Jun 2020 12:58:36 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0131594053B for ; Tue, 23 Jun 2020 12:58:36 +0000 (UTC) Received: from localhost ([::1]:58640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jniVW-0007gg-Fa for larch@yhetil.org; Tue, 23 Jun 2020 08:58:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jniV1-00075Q-1Q for bug-guix@gnu.org; Tue, 23 Jun 2020 08:58:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jniV0-00016h-KU for bug-guix@gnu.org; Tue, 23 Jun 2020 08:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jniV0-0006vw-IT for bug-guix@gnu.org; Tue, 23 Jun 2020 08:58:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#41982: [PATCH] grub-core: Build fixes for i386 References: <87pn9sy14x.fsf@gnu.org> In-Reply-To: <87pn9sy14x.fsf@gnu.org> Resent-From: Jan Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 23 Jun 2020 12:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41982 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: bug-grub@gnu.org Received: via spool by 41982-submit@debbugs.gnu.org id=B41982.159291703526600 (code B ref 41982); Tue, 23 Jun 2020 12:58:02 +0000 Received: (at 41982) by debbugs.gnu.org; 23 Jun 2020 12:57:15 +0000 Received: from localhost ([127.0.0.1]:35680 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jniUE-0006ux-FQ for submit@debbugs.gnu.org; Tue, 23 Jun 2020 08:57:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32858) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jniUC-0006ul-BJ for 41982@debbugs.gnu.org; Tue, 23 Jun 2020 08:57:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60987) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jniU5-0000Sq-NC; Tue, 23 Jun 2020 08:57:05 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=42706 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jniU2-0002MA-MU; Tue, 23 Jun 2020 08:57:04 -0400 From: Jan Nieuwenhuizen Organization: AvatarAcademy.nl X-Url: http://AvatarAcademy.nl Date: Tue, 23 Jun 2020 14:57:00 +0200 Message-ID: <87ftamrlcz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 41982@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: wDPFlzxrFyB5 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi! When cross-compiling Grub-2.04 from i386-linux-gnu to i586-pc-hurd on GNU Guix, I got this error --8<---------------cut here---------------start------------->8--- i586-pc-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -Wall -W -DGRUB_MACHINE_PCBIOS= =3D1 -DGRUB_MACHINE=3DI386_PC -m32 -nostdinc -isystem /gnu/store/5s0ldm3110= 0d9ix15d1lmbsvi0aa77pq-gcc-cross-i586-pc-gnu-7.5.0-lib/lib/gcc/i586-pc-gnu/= 7.5.0/include -I../include -I../include -DGRUB_FILE=3D\"lib/cmos_datetime.c= \" -I. -I. -I.. -I.. -I../include -I../include -I../grub-core/lib/libgcrypt= -grub/src/ -D_FILE_OFFSET_BITS=3D64 -Os -Wall -W -Wshadow -Wpointer-arit= h -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-= optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-secur= ity -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int = -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparenthese= s -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigrap= hs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-par= ameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -= Wstrict-prototypes -g -Wredundant-decls -Wmissing-prototypes -Wmissing-decl= arations -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-= cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla = -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-regist= er-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing= -declarations -Wformat=3D2 -march=3Di386 -m32 -mrtd -mregparm=3D3 -falign-j= umps=3D1 -falign-loops=3D1 -falign-functions=3D1 -freg-struct-return -mno-m= mx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -fno-dwarf2-cfi-asm= -mno-stack-arg-probe -fno-asynchronous-unwind-tables -fno-unwind-tables -f= no-stack-protector -Wtrampolines -Werror -ffreestanding -MT lib/datetim= e_module-cmos_datetime.o -MD -MP -MF lib/.deps-core/datetime_module-cmos_da= tetime.Tpo -c -o lib/datetime_module-cmos_datetime.o `test -f 'lib/cmos_dat= etime.c' || echo './'`lib/cmos_datetime.c lib/i386/relocator64.S: Assembler messages: lib/i386/relocator64.S:66: Error: unknown pseudo-op: `.code64' lib/i386/relocator64.S:74: Error: bad register name `%rax' lib/i386/relocator64.S:98: Error: bad register name `%rax' lib/i386/relocator64.S:132: Error: bad register name `%rip)' make[3]: *** [Makefile:32165: lib/i386/relocator_module-relocator64.o] Erro= r 1 make[3]: *** Waiting for unfinished jobs.... mv -f lib/i386/.deps-core/relocator_module-relocator_common_c.Tpo lib/i386/= .deps-core/relocator_module-relocator_common_c.Po mv -f lib/i386/.deps-core/relocator_module-relocator.Tpo lib/i386/.deps-cor= e/relocator_module-relocator.Po mv -f kern/.deps-core/elf_module-elf.Tpo kern/.deps-core/elf_module-elf.Po mv -f lib/.deps-core/datetime_module-cmos_datetime.Tpo lib/.deps-core/datet= ime_module-cmos_datetime.Po mv -f fs/.deps-core/xfs_module-xfs.Tpo fs/.deps-core/xfs_module-xfs.Po mv -f lib/.deps-core/crypto_module-crypto.Tpo lib/.deps-core/crypto_module-= crypto.Po mv -f lib/.deps-core/relocator_module-relocator.Tpo lib/.deps-core/relocato= r_module-relocator.Po make[3]: Leaving directory '/tmp/guix-build-grub-minimal-2.04.drv-0/grub-2.= 04/grub-core' make[2]: *** [Makefile:26403: all] Error 2 make[2]: Leaving directory '/tmp/guix-build-grub-minimal-2.04.drv-0/grub-2.= 04/grub-core' make[1]: *** [Makefile:11304: all-recursive] Error 1 make[1]: Leaving directory '/tmp/guix-build-grub-minimal-2.04.drv-0/grub-2.= 04' make: *** [Makefile:3343: all] Error 2 command "make" "-j" "8" failed with status 2 --8<---------------cut here---------------end--------------->8--- In Guix we are now using the patch attached, which seems to fix this for us. We are not entirely sure if this is the proper fix though, see . Paraphrasing the questions raised there: why does this seem to compile on i386? Is that because the non-cross 32-bit =E2=80=98as=E2=80=99 support= s =E2=80=98.code64=E2=80=99? Is the Guix's cross-assembler =E2=80=98i586-pc-gnu-as=E2=80=99 configured w= rong and should it support this? (FWIW, this is not specific for the Hurd, cross compiling from i686-linux-gnu to i686-linux-gnu show the same error. The use case for that may be a bit thin to warrant a bug report.) Ideas welcome! Greetings, Janneke --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-grub-core-Build-fixes-for-i386.patch Content-Transfer-Encoding: quoted-printable >From 270667540146f8ef9ea7a44258a71b3837a7af4a Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sun, 21 Jun 2020 15:10:40 +0200 Subject: [PATCH] grub-core: Build fixes for i386 * grub-core/lib/i386/relocator64.S: Avoid x86_64 instructions on i386. --- grub-core/lib/i386/relocator64.S | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/grub-core/lib/i386/relocator64.S b/grub-core/lib/i386/relocato= r64.S index 148f38adb..45fed9444 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 =20 +#ifdef __x86_64__ .code64 +#endif =20 /* mov imm64, %rax */ .byte 0x48 @@ -71,7 +73,14 @@ VARIABLE(grub_relocator64_cr3) VARIABLE(grub_relocator64_rsp) .quad 0 =20 +#ifndef __x86_64__ + /* movq %rax, %rsp */ + .byte 0x48 + .byte 0x89 + .byte 0xc4 +#else movq %rax, %rsp +#endif =20 #ifdef GRUB_MACHINE_EFI jmp LOCAL(skip_efi_stack_align) @@ -95,8 +104,15 @@ LOCAL(skip_efi_stack_align): VARIABLE(grub_relocator64_rsi) .quad 0 =20 +#ifndef __x86_64__ + /* movq %rax, %rsi */ + .byte 0x48 + .byte 0x89 + .byte 0xc6 +#else movq %rax, %rsi -=09 +#endif + /* mov imm64, %rax */ .byte 0x48 .byte 0xb8 @@ -128,6 +144,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 --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-=--