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
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel