Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mde1n-0002lf-3H for mharc-grub-devel@gnu.org; Thu, 21 Oct 2021 15:47:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mde1l-0002iV-NP for grub-devel@gnu.org; Thu, 21 Oct 2021 15:47:02 -0400 Received: from shcp25.hosting.zen.net.uk ([82.71.204.30]:47506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mde1g-0006jL-3r for grub-devel@gnu.org; Thu, 21 Oct 2021 15:47:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=monkeyircd.org; s=default; h=Content-Transfer-Encoding:MIME-Version: Content-Type:Date:To:From:Subject:Message-ID:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nSWqfTfAFLRj3nDFrxowWsOeQftD54N1wXTKsHpe4Jo=; b=C8gJUUf3tTyNaBmGveGO+1Mt2S BP5Or54gTlJmzxh9WgoUI9PWLg85Fdxvf2zzDfkzRlrQMeDAw5zfGi0HeHYpl76CJryIrXGmVWH/q iHSPBd7s7F+IiVVlbuRcHierWEcWJGRbWEPBVV3UlP86BK7NqSO8nmQjXSUYLhjQQjgDpPAfb/wUt Jpp0aubFmluoEGxWuwuevGZ32I77Aot/RYT74PLbHynAyaR3UYQ4zEKJlJ13mRJm+LbHpgqoSLbST wX+XGSmuoQ80HsS1gHn2KgpPE7FRgpBv3Kd99wBPHTQ83AcKXGaStrR6Ls8mcAMXoNa/ltoH7D7H9 Q3eAZ0LQ==; Received: from [82.69.123.44] (port=5812 helo=[172.28.129.80]) by shcp25.hosting.zen.net.uk with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mde1G-00BuI0-35 for grub-devel@gnu.org; Thu, 21 Oct 2021 19:46:29 +0000 Message-ID: <2e466a0c9876fa76c33ed911c705b2fb9b5552c0.camel@monkeyircd.org> Subject: Multiboot ELF Loader - Alignment From: Chris Plant To: grub-devel@gnu.org Date: Thu, 21 Oct 2021 20:46:06 +0100 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - shcp25.hosting.zen.net.uk X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - monkeyircd.org X-Get-Message-Sender-Via: shcp25.hosting.zen.net.uk: authenticated_id: chris@monkeyircd.org X-Authenticated-Sender: shcp25.hosting.zen.net.uk: chris@monkeyircd.org Received-SPF: pass client-ip=82.71.204.30; envelope-from=chris@monkeyircd.org; helo=shcp25.hosting.zen.net.uk X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 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, HAS_X_OUTGOING_SPAM_STAT=0.993, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: Thu, 21 Oct 2021 19:47:02 -0000 Hello, I'm continuing to play with Multiboot2 on ARM64 on a Raspberry Pi, and I've run into something which I'm trying to understand. I have an ELF file for my kernel which has two segments (I have no idea why rust is giving me two segments, but it is).  If I boot directly into the ELF file from the Pi firmware it boots fine, but if I boot via GRUB I have issues with data corruption in .rodata which is in the second segment.  The first segment (.text) appears to load correctly. Digging into this, the ELF headers specify a load base address of 0x801060 for the second segment, but GRUB allocates and loads this to 0x802000.  If I change my linker to align the second segment onto 0x1000 everything works fine. Is this alignment to 0x1000 a defined behaviour of the GRUB allocator or Multiboot2?  I'm assuming it's not a problem with the ELF file as it's generated by usual means and runs fine otherwise. Thanks, Chris