From 5bcb7d394c26d212cebf59c9b70a42a11f90d2bc Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Thu, 18 Feb 2016 20:58:38 +0100 Subject: [PATCH] Allow _start == 0 with relocatable images --- util/grub-mkimagexx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c index 433322d85..fff811266 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; } @@ -1797,7 +1797,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;