From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Vy08e-0000C6-Az for mharc-grub-devel@gnu.org; Tue, 31 Dec 2013 09:17:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vy08U-0008TH-4X for grub-devel@gnu.org; Tue, 31 Dec 2013 09:17:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vy08L-0003Jh-N3 for grub-devel@gnu.org; Tue, 31 Dec 2013 09:17:34 -0500 Received: from mail-ea0-x236.google.com ([2a00:1450:4013:c01::236]:57212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vy08L-0003Jc-F7 for grub-devel@gnu.org; Tue, 31 Dec 2013 09:17:25 -0500 Received: by mail-ea0-f182.google.com with SMTP id a15so5610501eae.27 for ; Tue, 31 Dec 2013 06:17:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=axWvolhtMNaE9A8AJzJwg2mHS1e36iGUUKrMbHyEw8A=; b=s0HfRDOdXYmxofS4YtkAKZvhsDmarG1SbuWApyGk3rtVqHj+OEDjRji26qEXxZ1rvX 3T7qXOprzxWw4HT81Jywfl1WzfTWrJ25bfdGApvNDklnIMUWwWVg2N54kx/Pxpip6WCz wEadIZ2Fb88LGlTgTcsrwLc1CWY4zlMIGTt1uQFiOvOqpPOYHqz8DQziRLLUuSntKFuv rF+pPvxxqdO9uPPp2RRIyku9ac9YbvSOkSp9aDBw+UCFbVVrSBYaoeSWZJr1zbut/T+H tTUA0+ZUOeybYvw++i+axbsYxTNjNuOc2C+xtA0b9b8ltYZCs136QCuXsrGcysMyysjL KA4g== X-Received: by 10.15.49.193 with SMTP id j41mr59294991eew.10.1388499443989; Tue, 31 Dec 2013 06:17:23 -0800 (PST) Received: from [192.168.56.2] (adsl-ull-216-135.44-151.net24.it. [151.44.135.216]) by mx.google.com with ESMTPSA id l4sm118564801een.13.2013.12.31.06.17.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 31 Dec 2013 06:17:23 -0800 (PST) Message-ID: <52C2D262.9050202@gmail.com> Date: Tue, 31 Dec 2013 15:19:14 +0100 From: Francesco Lavra User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH 6/7] mkimage: support images which require full relocation at mkimage time. References: <1388342839.32105.25.camel@hastur.hellion.org.uk> <1388342856-18317-6-git-send-email-ijc@hellion.org.uk> In-Reply-To: <1388342856-18317-6-git-send-email-ijc@hellion.org.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::236 Cc: Vladimir Serbinenko , Leif Lindholm , Ian Campbell 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: Tue, 31 Dec 2013 14:17:43 -0000 On 12/29/2013 07:47 PM, Ian Campbell wrote: > diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c > index b4216ff..186d259 100644 > --- a/util/grub-mkimagexx.c > +++ b/util/grub-mkimagexx.c > @@ -378,6 +378,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, > Elf_Shdr *symtab_section, Elf_Addr *section_addresses, > Elf_Half section_entsize, Elf_Half num_sections, > void *jumpers, Elf_Addr jumpers_addr, > + Elf_Addr bss_addr, size_t bss_size, > const struct grub_install_image_target_desc *image_target) > { > Elf_Word symtab_size, sym_size, num_syms; > @@ -416,10 +417,14 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, > } > else if (cur_index == STN_UNDEF) > { > - if (sym->st_name) > + if (strcmp (name, "__bss_start") == 0 && bss_addr) > + sym->st_value = bss_addr; > + else if (strcmp (name, "_end") == 0 && bss_addr) > + sym->st_value = bss_addr + bss_size; > + else if (sym->st_name) > grub_util_error ("undefined symbol %s", name); > - else > - continue; > + > + continue; > } > else if (cur_index >= num_sections) > grub_util_error ("section %d does not exist", cur_index); > @@ -584,7 +589,7 @@ static void > SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, > Elf_Addr *section_addresses, > Elf_Half section_entsize, Elf_Half num_sections, > - const char *strtab, > + const char *strtab, grub_uint64_t target_address, > char *pe_target, Elf_Addr tramp_off, > Elf_Addr got_off, > const struct grub_install_image_target_desc *image_target) > @@ -867,6 +872,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, > { > case R_ARM_ABS32: > { > + sym_addr += target_address; > grub_util_info (" ABS32:\ttarget=0x%08lx\toffset=(0x%08x)", > (unsigned long) ((char *) target > - (char *) e), > @@ -928,7 +934,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, > grub_uint32_t tr_addr; > grub_int32_t new_offset; > tr_addr = (char *) tr - (char *) pe_target > - - target_section_addr; > + - (target_address - target_section_addr); target_section_addr was being subtracted from tr before, now it's being added; I guess this is not intentional. -- Francesco