From: Ian Campbell <ijc@hellion.org.uk>
To: grub-devel@gnu.org
Cc: Vladimir Serbinenko <phcoder@gmail.com>,
Leif Lindholm <leif.lindholm@linaro.org>,
Ian Campbell <ijc@hellion.org.uk>
Subject: [PATCH 5/7] mkimage: allow linking at address 0
Date: Sun, 29 Dec 2013 18:47:34 +0000 [thread overview]
Message-ID: <1388342856-18317-5-git-send-email-ijc@hellion.org.uk> (raw)
In-Reply-To: <1388342839.32105.25.camel@hastur.hellion.org.uk>
Running from address 0 is plausible at least in principal. Use the maximum
possible address as a sentinal instead.
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
---
util/grub-mkimagexx.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index 759e838..b4216ff 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -64,6 +64,8 @@
static Elf_Addr SUFFIX (entry_point);
+#define INVALID_START_ADDR (~((Elf_Addr)0))
+
static void
SUFFIX (generate_elf) (const struct grub_install_image_target_desc *image_target,
int note, char **core_img, size_t *core_size,
@@ -380,7 +382,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 = INVALID_START_ADDR;
Elf_Sym *sym;
Elf_Word i;
Elf_Shdr *strtab_section;
@@ -439,7 +441,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 == INVALID_START_ADDR)
if (strcmp (name, "_start") == 0 || strcmp (name, "start") == 0)
start_address = sym->st_value;
}
@@ -1602,7 +1604,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
ia64jmp_off
+ image_target->vaddr_offset,
image_target);
- if (*start == 0)
+ if (*start == INVALID_START_ADDR)
grub_util_error ("start symbol is not defined");
SUFFIX (entry_point) = (Elf_Addr) *start;
@@ -1664,3 +1666,4 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
#undef Elf_Section
#undef ELF_ST_TYPE
#undef XEN_NOTE_SIZE
+#undef INVALID_START_ADDR
--
1.8.4.rc3
next prev parent reply other threads:[~2013-12-29 18:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-29 18:47 [PATCH 0/7] arm-uboot: support for different RAM bases Ian Campbell
2013-12-29 18:47 ` [PATCH 1/7] mkimage: Refactor IMAGE_EFI checks into a function grub_image_needs_reloc Ian Campbell
2013-12-29 18:47 ` [PATCH 2/7] mkimage: Replace hardcoded 0x400 in R_ARM_ABS32 relocation Ian Campbell
2013-12-29 18:47 ` [PATCH 3/7] mkimage: account for space for trampolines earlier Ian Campbell
2013-12-29 18:47 ` [PATCH 4/7] mkimage: make R_ARM_ABS32 debug output more consistent Ian Campbell
2013-12-29 18:47 ` Ian Campbell [this message]
2013-12-29 18:47 ` [PATCH 6/7] mkimage: support images which require full relocation at mkimage time Ian Campbell
2013-12-29 22:53 ` Leif Lindholm
2013-12-30 3:49 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-30 10:54 ` Ian Campbell
2013-12-30 15:46 ` Andrey Borzenkov
2013-12-31 14:19 ` Francesco Lavra
2013-12-31 16:44 ` Ian Campbell
2013-12-29 18:47 ` [PATCH 7/7] arm-uboot: support relocation at installation time Ian Campbell
2013-12-29 19:10 ` [PATCH 0/7] arm-uboot: support for different RAM bases Ian Campbell
2013-12-29 23:04 ` Leif Lindholm
2013-12-30 1:55 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-30 10:48 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388342856-18317-5-git-send-email-ijc@hellion.org.uk \
--to=ijc@hellion.org.uk \
--cc=grub-devel@gnu.org \
--cc=leif.lindholm@linaro.org \
--cc=phcoder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).