From: Vladimir Serbinenko Date: Thu, 18 Feb 2016 19:58:38 +0000 (+0100) Subject: Allow _start == 0 with relocatable images X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=575c7a6e3c2daa84f40de5f7bdcaf2cedcaeb876;p=thirdparty%2Fgrub.git Allow _start == 0 with relocatable images --- diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c index 9459eb6cc..ea1d137da 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -495,7 +495,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, { Elf_Word symtab_size, sym_size, num_syms; Elf_Off symtab_offset; - Elf_Addr start_address = 0; + Elf_Addr start_address = (Elf_Addr) -1; Elf_Sym *sym; Elf_Word i; Elf_Shdr *strtab_section; @@ -560,7 +560,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections, (unsigned long long) sym->st_value, (unsigned long long) section_addresses[cur_index]); - if (! start_address) + if (start_address == (Elf_Addr)-1) if (strcmp (name, "_start") == 0 || strcmp (name, "start") == 0) start_address = sym->st_value; } @@ -1793,7 +1793,7 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path, layout->ia64jmp_off + image_target->vaddr_offset, image_target); - if (layout->start_address == 0) + if (layout->start_address == (Elf_Addr) -1) grub_util_error ("start symbol is not defined"); SUFFIX (entry_point) = (Elf_Addr) layout->start_address;