diff options
author | Scott Wood <scottwood@freescale.com> | 2009-04-02 16:15:10 -0500 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-04-04 23:33:12 +0200 |
commit | e3d1ac7bb1955d36980d267cb4cec40b0f7d30b5 (patch) | |
tree | 7988945221de50040acc1c785069a139a52f6c30 /common/image.c | |
parent | 3a671fc06ae1d9e8eba76600372317c75ae0eb3e (diff) | |
download | u-boot-imx-e3d1ac7bb1955d36980d267cb4cec40b0f7d30b5.zip u-boot-imx-e3d1ac7bb1955d36980d267cb4cec40b0f7d30b5.tar.gz u-boot-imx-e3d1ac7bb1955d36980d267cb4cec40b0f7d30b5.tar.bz2 |
common/image.c: Relocate strings in tables.
Without this, u-boot can crash or print garbage if the original link
address no longer points to a valid string.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'common/image.c')
-rw-r--r-- | common/image.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/image.c b/common/image.c index daa68bc..e22c974 100644 --- a/common/image.c +++ b/common/image.c @@ -518,7 +518,11 @@ static char *get_table_entry_name (table_entry_t *table, char *msg, int id) { for (; table->id >= 0; ++table) { if (table->id == id) - return (table->lname); +#ifdef USE_HOSTCC + return table->lname; +#else + return table->lname + gd->reloc_off; +#endif } return (msg); } @@ -579,7 +583,7 @@ static int get_table_entry_id (table_entry_t *table, fprintf (stderr, "\n"); #else for (t = table; t->id >= 0; ++t) { - if (t->sname && strcmp(t->sname, name) == 0) + if (t->sname && strcmp(t->sname + gd->reloc_off, name) == 0) return (t->id); } debug ("Invalid %s Type: %s\n", table_name, name); |