From: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Date: Thu, 13 Oct 2011 06:07:39 +0000 (+0000)
Subject: common: fix missing function pointer relocation in fixup_cmdtable()
X-Git-Tag: v2025.01-rc5-pxa1908~18806
X-Git-Url: http://git.dujemihanovic.xyz/img/static/html/index.html?a=commitdiff_plain;h=fa28bd2eef588ec2048ccafedb2b384d5a355858;p=u-boot.git

common: fix missing function pointer relocation in fixup_cmdtable()

The command auto-completion does not work on architectures relying
on CONFIG_NEEDS_MANUAL_RELOC like MIPS. Cause is the missing function
pointer fixup for cmd_tbl_t::complete function in fixup_cmdtable().

This patch adds the missing pointer fixup in case of CONFIG_AUTO_COMPLETE
is defined.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---

diff --git a/common/command.c b/common/command.c
index ddaed682d5..ed931d748c 100644
--- a/common/command.c
+++ b/common/command.c
@@ -474,6 +474,12 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
 			addr = (ulong)(cmdtp->help) + gd->reloc_off;
 			cmdtp->help = (char *)addr;
 		}
+#endif
+#ifdef CONFIG_AUTO_COMPLETE
+		if (cmdtp->complete) {
+			addr = (ulong)(cmdtp->complete) + gd->reloc_off;
+			cmdtp->complete = (char *)addr;
+		}
 #endif
 		cmdtp++;
 	}