public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Bug in MIPS linker scripts?
@ 2006-12-14 16:52 Robert Deliën
  0 siblings, 0 replies; only message in thread
From: Robert Deliën @ 2006-12-14 16:52 UTC (permalink / raw)
  To: u-boot

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-14 16:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14 16:52 [U-Boot-Users] Bug in MIPS linker scripts? Robert Deliën

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox