From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lj5z2-0003S9-FD for mharc-grub-devel@gnu.org; Tue, 18 May 2021 16:06:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lj5z0-0003M4-7k for grub-devel@gnu.org; Tue, 18 May 2021 16:06:26 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:34445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lj5yy-0002BN-Oe for grub-devel@gnu.org; Tue, 18 May 2021 16:06:25 -0400 Received: by mail-ed1-x52b.google.com with SMTP id w12so4954823edx.1 for ; Tue, 18 May 2021 13:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=NZdhH5n2aRmEcUGDxvnSBz1gJqixlHQHopFAikJuXJs=; b=bwYFiOuIbwAOPdn/73OD53DwJ+zV2V6v9UUr/kLDy0HZTS86ozQRCFfBh7OoTWRQap ZnzdvX25Sn1R8qiVCeyLQfDgE8SUrOGPV2bfQPyIkvIqvLeNBO3v+3bOa7vT+qdPccR1 k6Qg/l94FrRTFU48D3YLjO+pbu1k6Duojm1vNDF3zLJZyNR3CxfL143i3SfZ4beWZM86 SkDMivS074d7GvAj5WkwcXpQXaNb76IlRCJ2C4XxP8lBLy9+6XwS418zGPOvmzhKVIzG cVKd2MqjUyoOgpjqvAZ0PG4elYBIUVpQjMfsiH/0v3mBTa8SctoGXCiYhWzWCT6socHE 9P5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=NZdhH5n2aRmEcUGDxvnSBz1gJqixlHQHopFAikJuXJs=; b=dAbIOiCj6BDkb8b/Lj3W9mPgHZZsVGxzXFqE2v7+JWKZ121CWgi7ICGSKroT7qhPFV fDagMSnqJeTnrwrbu4SXLIOLAMn7quDNAyns8Kmqw7HorXKSyzxChf461U78xrz2mOiJ HG9Yw8gNfTtXATBn0/tPlHjDcTk5goXgTDyHw22gDrR2gMNaRbUoy7mrl4EV5yPKOoEM 2+SCd7mzHddWD0PfZ+fFC/YeZaJe1lIAF8b8Xxb5fkg/Ors/u9GGNqXGTs0sVEcFP9Gr TLIkGhxDqiT7daVUpwgrgBaED+gA5yFH1ZTpddb3iZAO8RxcS3KMxBd4fKDNNVdOE8Sf NpSQ== X-Gm-Message-State: AOAM531GkK/gg9/JbI/peEFSc1AR/TjxsEKc+mlzY7M7RP7wXwH3vnbJ FTskYgnBAGZb+CCA7VJlqgM4RiY8zAaiB4Oz3uc18zAHFLY= X-Google-Smtp-Source: ABdhPJz3zaDc58cen1v/9b5GRTvU8aWfBOb+u4zItFvn8ZfDSiN5/Os8b8pRzVmNUx1FDchmEagvAGF4rIKLGxVSThI= X-Received: by 2002:a05:6402:749:: with SMTP id p9mr6433673edy.149.1621368381500; Tue, 18 May 2021 13:06:21 -0700 (PDT) MIME-Version: 1.0 References: <20210518104733.23391-1-janneke@gnu.org> In-Reply-To: <20210518104733.23391-1-janneke@gnu.org> From: Matt Turner Date: Tue, 18 May 2021 13:06:09 -0700 Message-ID: Subject: Re: [PATCH v2] grub-core: Build fixes for i386 To: The development of GNU GRUB Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=mattst88@gmail.com; helo=mail-ed1-x52b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2021 20:06:26 -0000 On Tue, May 18, 2021 at 3:48 AM Jan (janneke) Nieuwenhuizen wrote: > > This fixes cross-compiling to x86 (e.g., the Hurd) from x86-linux. > > To reproduce, update the Grub source description in your local Guix > archive and run > > ./pre-inst-env guix build --system=i686-linux --target=i586-pc-gnu grub > > or install an x86 cross-build environment on x86-linux (32bit!) and > configure to cross build and make, e.g., do something like > > ./configure \ > CC_FOR_BUILD=gcc \ > --build=i686-unknown-linux-gnu > --host=i586-pc-gnu > make > > * grub-core/lib/i386/relocator64.S: Avoid x86_64 instructions on i386. > --- > grub-core/lib/i386/relocator64.S | 27 +++++++++++++++++++++++++-- > 1 file changed, 25 insertions(+), 2 deletions(-) > > diff --git a/grub-core/lib/i386/relocator64.S b/grub-core/lib/i386/relocator64.S > index 148f38adb..b4675dd16 100644 > --- a/grub-core/lib/i386/relocator64.S > +++ b/grub-core/lib/i386/relocator64.S > @@ -63,8 +63,10 @@ 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 > > +#ifdef __x86_64__ > movq %rax, %rsp > +#else > + /* movq %rax, %rsp */ > + .byte 0x48 > + .byte 0x89 > + .byte 0xc4 > +#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. */ > +#ifdef __x86_64__ > andq $~15, %rsp > +#else > + .byte 0x48 > + .byte 0x83 > + .byte 0xe4 > + .byte 0xf0 Indentation on these lines is inconsistent.