Skip to contentSkip to conversation

common: fix missing function pointer relocation in fixup_cmdtable()

PATCH Superseded Daniel Schwierzeck 2 participants 7 messages Oct 13, 2011 – Oct 23, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 common/command.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
common/command.c +6 -0
index ddaed68..ed931d7 100644
@@ -475,6 +475,12 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
 			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++;
 	}
 }
Signature · 1 line
1.7.7
#1 lore raw

PATCH v2 1/1 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.

---
changes for v2:
use correct type cast

One checkpatch.pl false positive:
WARNING: line over 80 characters
#31: FILE: common/command.c:482:
+ (int (*)(int, char * const [], char, int, char * []))addr;

 common/command.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
common/command.c +7 -0
index ddaed68..8023576 100644
@@ -475,6 +475,13 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
 			cmdtp->help = (char *)addr;
 		}
 #endif
+#ifdef CONFIG_AUTO_COMPLETE
+		if (cmdtp->complete) {
+			addr = (ulong)(cmdtp->complete) + gd->reloc_off;
+			cmdtp->complete =
+				(int (*)(int, char * const [], char, int, char * []))addr;
+		}
+#endif
 		cmdtp++;
 	}
 }
Signature · 1 line
1.7.7
#2 lore raw

PATCH v3 1/1 common: fix missing function pointer relocation in fixup_cmdtable()

In commit fa28bd2eef588ec2048ccafedb2b384d5a355858 patch v1 was applied instead of v2. This is an incremental patch to update that commit to version 2.

---
changes for v2:
use correct type cast

changes for v3:
rebased against current master
incremental patch from v1 to v2

one checkpatch.pl warning:
WARNING: line over 80 characters
#38: FILE: common/command.c:483:
+ (int (*)(int, char * const [], char, int, char * []))addr;

 common/command.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
common/command.c +2 -1
index 2c0bf53..c5cecd3 100644
@@ -479,7 +479,8 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
 #ifdef CONFIG_AUTO_COMPLETE
 		if (cmdtp->complete) {
 			addr = (ulong)(cmdtp->complete) + gd->reloc_off;
-			cmdtp->complete = (char *)addr;
+			cmdtp->complete =
+				(int (*)(int, char * const [], char, int, char * []))addr;
 		}
 #endif
 		cmdtp++;
Signature · 1 line
1.7.7
#3 lore raw

PATCH v3 1/1 common: fix missing function pointer relocation in fixup_cmdtable()

Dear Daniel Schwierzeck,

Quoted 13 lines · In message <1318972342-3801-1-git-send-email-daniel.schwierzeck@googlemail.com>…

In commit fa28bd2eef588ec2048ccafedb2b384d5a355858 patch v1 was applied instead of v2. This is an incremental patch to update that commit to version 2.

---
changes for v2:
use correct type cast

changes for v3:
rebased against current master
incremental patch from v1 to v2

Quoted 7 lines

one checkpatch.pl warning:
WARNING: line over 80 characters
#38: FILE: common/command.c:483:
+ (int (*)(int, char * const [], char, int, char * []))addr;

 common/command.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 8 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The people of Gideon have always believed that life is  sacred.  That
the  love  of  life  is  the  greatest  gift  ... We are incapable of
destroying or interfering with the creation of that which we love  so
deeply -- life in every form from fetus to developed being.
	-- Hodin of Gideon, "The Mark of Gideon", stardate 5423.4
#4 lore raw

PATCH 1/1 common: fix missing function pointer relocation in fixup_cmdtable()

In reply to Daniel Schwierzeck

Dear Daniel Schwierzeck,

Quoted 11 lines · In message <1318522059-16182-1-git-send-email-daniel.schwierzeck@googlemail.com…

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.

---
 common/command.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"It is easier to port a shell than a shell script."      - Larry Wall
#5 lore raw

PATCH 1/1 common: fix missing function pointer relocation in fixup_cmdtable()

Dear Wolfgang,

Quoted 4 lines · Wolfgang Denk

Dear Daniel Schwierzeck,

Quoted 1 line · In message <1318522059-16182-1-git-send-email-daniel.schwierzeck@googlemail.com…

The command auto-completion does not work on architectures relying

...

Quoted 2 lines

Applied, thanks.

you have missed v2 of the patch.
See also http://patchwork.ozlabs.org/patch/119777/

Maybe because I forgot to cc you in the second mail, sorry for that.

Shall I send an updated patch?

Best regards,
Daniel

#6 lore raw

PATCH 1/1 common: fix missing function pointer relocation in fixup_cmdtable()

Dear Daniel Schwierzeck,

Quoted 5 lines · In message <CACUy__VcnaeQMcTzv1KAK7LDdBfqBj=vXYWpK081M3AW2HQ3tg@mail.gmail.com>…

you have missed v2 of the patch.
See also http://patchwork.ozlabs.org/patch/119777/

Maybe because I forgot to cc you in the second mail, sorry for that.

No, this was my fault. I have to be sorry.

Quoted 1 line

Shall I send an updated patch?

Yes, please (an incremental one against current master).

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When the ax entered the forest, the trees said, "The handle is one of
us!"                                               -- Turkish proverb