From 9d742bd431bb43c01208c9349b797d5ada4c5dc4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 29 Feb 2012 18:57:43 +0100 Subject: [PATCH] * util/grub-mkimagexx.c (locate_sections): Support non-standard ELF section gap. (load_image): Likewise. --- ChangeLog | 6 ++++++ util/grub-mkimagexx.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9478b2241..dc34c7077 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-02-29 Vladimir Serbinenko + + * util/grub-mkimagexx.c (locate_sections): Support non-standard + ELF section gap. + (load_image): Likewise. + 2012-02-29 Vladimir Serbinenko * configure.ac: Fix a typo in previous commit. diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c index 2d0176aca..476d05eeb 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -871,6 +871,9 @@ SUFFIX (locate_sections) (Elf_Shdr *sections, Elf_Half section_entsize, align) - image_target->vaddr_offset; grub_util_info ("locating the section %s at 0x%llx", name, (unsigned long long) current_address); + if (image_target->id != IMAGE_EFI) + current_address = grub_host_to_target_addr (s->sh_addr) + - image_target->link_addr; section_addresses[i] = current_address; current_address += grub_host_to_target_addr (s->sh_size); } @@ -896,6 +899,9 @@ SUFFIX (locate_sections) (Elf_Shdr *sections, Elf_Half section_entsize, grub_util_info ("locating the section %s at 0x%llx", name, (unsigned long long) current_address); + if (image_target->id != IMAGE_EFI) + current_address = grub_host_to_target_addr (s->sh_addr) + - image_target->link_addr; section_addresses[i] = current_address; current_address += grub_host_to_target_addr (s->sh_size); } @@ -985,6 +991,10 @@ SUFFIX (load_image) (const char *kernel_path, grub_size_t *exec_size, grub_util_info ("locating the section %s at 0x%llx", name, (unsigned long long) current_address); + if (image_target->id != IMAGE_EFI) + current_address = grub_host_to_target_addr (s->sh_addr) + - image_target->link_addr; + section_vaddresses[i] = current_address + image_target->vaddr_offset; current_address += grub_host_to_target_addr (s->sh_size);