From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Robert_Deli=EBn?= Date: Thu, 14 Dec 2006 17:52:21 +0100 Subject: [U-Boot-Users] Bug in MIPS linker scripts? Message-ID: <000c01c71fa0$38e775f0$dfdd9182@code1.emi.philips.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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.