Hi, Thank you for the report...
On Wed, May 05, 2021 at 12:44:07PM +0300, Mikhail B. WproxyM wrote: > We are using binutils-2.35.2+ (later then 2.29.1), grub-2.04, > cross-compiling on recent buildroot under i386/i686 and getting error: May I ask you to try latest GRUB master git branch [1]? The GRUB 2.04 release is a few years old. We are going to release 2.06 soon. > > lib/i386/relocator64.S:66: Error: unknown pseudo-op: `.code64' > > So, the working patch is attached. Please add it to grub2. You can find a few comments below... > From 270667540146f8ef9ea7a44258a71b3837a7af4a Mon Sep 17 00:00:00 2001 > From: "Jan (janneke) Nieuwenhuizen" <jann...@gnu.org> > 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. Please describe in the commit message why this patch is needed and how the issue can be reproduced. Please add your "Signed-off-by: ..." line at the end of commit message. You can find good examples of commit messages in the GRUB git repository. > --- > 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/relocator64.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 > > +#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 I would do it other way around to increase readability... #ifdef __x86_64__ movq %rax, %rsp #else /* movq %rax, %rsp */ .byte 0x48 ... > #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 > > +#ifndef __x86_64__ > + /* movq %rax, %rsi */ > + .byte 0x48 > + .byte 0x89 > + .byte 0xc6 > +#else > movq %rax, %rsi > - > +#endif Ditto... > /* 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 #if defined(__APPLE__) || !defined (__x86_64__) .byte 0xff, 0x25 .quad 0 #else jmp *LOCAL(jump_addr) (%rip) #endif A patch should be prepared on top of latest GRUB master git branch [1]. And please use "git-send-email" to send the patch as Adrian said... Daniel [1] https://git.savannah.gnu.org/gitweb/?p=grub.git&view=view+git+repository _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel