[U-Boot-Users] Bug in MIPS linker scripts?
Robert Deliën
robert.delien at nxp.com
Thu Dec 14 17:52:21 CET 2006
Hi,
I believe I have found a nasty bug in my target's linker script. And since
all MIPS targets use copies of more-or-less the same linker script, I think
all MIPS targets suffer from this bug.
It's alignment dependent whether the bug will cause a problem or not. The
symptoms can vary from hang-ups in find_cmd for any command to a hang-up if
the first command in the command table is used (usually bdinfo).
The cause of this problem is the 'Update GOT' part in the function relocate
in cpu/mips/start.S. Depending on alignment, this update part will update a
number of entries too many, corrupting whatever is next in memory: The
command table.
The cause of the problem is a misalignment between the _gp linker variable
and the actual '.'. This is what's in board/mipstarget/u-boot.lds now:
. = ALIGN(4);
.sdata : { *(.sdata) }
_gp = ALIGN(16);
__got_start = .;
.got : { *(.got) }
__got_end = .;
.sdata : { *(.sdata) }
__u_boot_cmd_start = .;
And this is what it's supposed to be:
. = ALIGN(4);
.sdata : { *(.sdata) }
. = ALIGN(16);
_gp = .;
__got_start = .;
.got : { *(.got) }
__got_end = .;
.sdata : { *(.sdata) }
__u_boot_cmd_start = .;
Who can give me any comments?
With kind regards,
Robert.
More information about the U-Boot
mailing list