Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VnUYd-0003EP-Ma for mharc-grub-devel@gnu.org; Mon, 02 Dec 2013 09:33:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnUYW-0003DK-8q for grub-devel@gnu.org; Mon, 02 Dec 2013 09:33:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnUYQ-0002uy-9A for grub-devel@gnu.org; Mon, 02 Dec 2013 09:33:00 -0500 Received: from mail-wg0-f51.google.com ([74.125.82.51]:54376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnUYQ-0002us-2z for grub-devel@gnu.org; Mon, 02 Dec 2013 09:32:54 -0500 Received: by mail-wg0-f51.google.com with SMTP id b13so8956400wgh.18 for ; Mon, 02 Dec 2013 06:32:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=YaLjuAp20faxIGB+LzPvR5Xl7Q1ow/2MO0MEYFFUhKU=; b=cF0jA8rYaUMkkf8/w7pcbE8VvLI+vmkccRYajdYVPVOpYlN0nKGYiAzbyeExGK55KG vDJfy6qAci6dANieOoUggGdkTm5LOfBtDnM9GP/1piAzTStz/kWGZ1rGsxV8WncR8Rrw GVYeTvqukMIsowPz3ZLeAJtn/1gUD14x766VA+Xjv6zIJOxGbphjtTHU0E2z3MhXtOBh OMhU8lk/IFK48f6881HH66dmjx4KDerDCXpMXOuLw1la5yOAmUNzVp3qJvF6RDMNCRYV nfRTPCyGo1aIKlrPtsYq1O6J4Elb4PJz6R2nr9suLoJmFzf1q3Aw2+Q06pzy/nVBibui +5ZQ== X-Gm-Message-State: ALoCoQl8whbpMPWb5cBRNQsyM3xMJX62ZLLvpFt61skFZK7lugrq+b6ZKr5xoHgbusnlIWnKeq1r X-Received: by 10.181.12.75 with SMTP id eo11mr18386009wid.37.1385994772951; Mon, 02 Dec 2013 06:32:52 -0800 (PST) Received: from rocoto.smurfnet.nu ([2001:4b98:dc0:41:216:3eff:fea7:75f3]) by mx.google.com with ESMTPSA id g16sm82613842wiw.6.2013.12.02.06.32.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Dec 2013 06:32:51 -0800 (PST) Date: Mon, 2 Dec 2013 15:33:06 +0100 From: Leif Lindholm To: The development of GNU GRUB Subject: Re: [PATCH, RFC, RFT] ARM relocation fixes Message-ID: <20131202143306.GI24997@rocoto.smurfnet.nu> References: <529AD1E8.8010305@gmail.com> <20131202105330.GA24997@rocoto.smurfnet.nu> <529C6820.9090902@gmail.com> <20131202112846.GC24997@rocoto.smurfnet.nu> <529C7305.5070002@gmail.com> <20131202133051.GE24997@rocoto.smurfnet.nu> <20131202141450.GG24997@rocoto.smurfnet.nu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131202141450.GG24997@rocoto.smurfnet.nu> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.51 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2013 14:33:06 -0000 On Mon, Dec 02, 2013 at 03:14:50PM +0100, Leif Lindholm wrote: > On Mon, Dec 02, 2013 at 02:30:51PM +0100, Leif Lindholm wrote: > > > >>> Amusingly, I wrote the attached > > > >> Nothing is attached to your mail. Right now could you pause work on > > > >> */dl.c: I'm reorganising them to declare more of it as platform > > > >> independent and unify handling (ARM dl.c is unnecessarily different from > > > >> other versions and forget some of ELF handling) > > > > > > > > Ok, I'll hold off. > > > > > > > I've uploaded current work to phcoder/reloc > > > > Ok, so I've tested this on arm64, and it works on the commercial FVP > > Base model (which does not trigger veneer generation due to its runtime > > memory map), but crashes on the Foundation model (which does). > > So the generic dl refactoring seems correct, but somehing about the > > veneers is fishy. > > Well, this one seems to be because mod->trampptr is never initilised > (which should be a problem also on the other archs?). > > With > diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c > index 33ccc98..92027e0 100644 > --- a/grub-core/kern/dl.c > +++ b/grub-core/kern/dl.c > @@ -317,6 +317,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) > #if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc__) > ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN); > mod->tramp = ptr; > + mod->trampptr = (ptr + tramp); > ptr += tramp; > ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALIGN); > mod->got = ptr; > > This runs successfully on my foundation model. Umm, that's obviously not correct. But it did work :) What is needed is to store the size of the module before adding trampoline and got sizes. / Leif