[U-Boot-Users] _gp and __got_start alignment problem in u-boot.lds

Burch, John T. John.Burch at tellabs.com
Fri May 26 17:03:09 CEST 2006


There seems to be a problem common to several of the mips targets
u-boot.lds files.  I've found that if any code results in data falling
into the .sdata section, there's a good possibility that _gp and
__got_start will not be equal, resulting in u_boot_cmds not being
relocated properly (and ultimately, some/all commands not functioning
properly or at all).

Modifications to the u-boot.lds file appears to have corrected the
problem.
diff -u -r1.1 u-boot.lds
--- u-boot.lds  22 Mar 2006 15:09:07 -0000  1.1
+++ u-boot.lds  26 May 2006 14:30:00 -0000
@@ -46,7 +46,9 @@
    . = ALIGN(4);
    .sdata  : { *(.sdata) }

-   _gp = ALIGN(16);
+   . = ALIGN(16);
+   . = .;
+   _gp = .;

    __got_start = .;
    .got  : { *(.got) }


Here are before and after fragments of u-boot map files:

...before...
.sdata      0x00000000bfc3dd00   0x4
 *(.sdata)
 .sdata     0x00000000bfc3dd00   0x4 common/libcommon.a(main.o)
            0x00000000bfc3dd00           dummy
 *(.sdata)
            0x00000000bfc3dd10           _gp = ALIGN (0x10)
            0x00000000bfc3dd04           __got_start = .   <<<

.got        0x00000000bfc3dd10  0x734
 *(.got)
 .got       0x00000000bfc3dd10  0x734 cpu/mips/start.o
            0x00000000bfc3dd10           _GLOBAL_OFFSET_TABLE_


...after...
.sdata      0x00000000bfc3dd00   0x4
 *(.sdata)
 .sdata     0x00000000bfc3dd00   0x4 common/libcommon.a(main.o)
            0x00000000bfc3dd00           dummy
 *(.sdata)
            0x00000000bfc3dd10           . = ALIGN (0x10)
            0x00000000bfc3dd10           . = .
            0x00000000bfc3dd10           _gp = .
            0x00000000bfc3dd10           __got_start = .   <<<

.got        0x00000000bfc3dd10  0x734
 *(.got)
 .got       0x00000000bfc3dd10  0x734 cpu/mips/start.o
            0x00000000bfc3dd10           _GLOBAL_OFFSET_TABLE_


Has anyone run into this problem?

John
============================================================
The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader
of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the
intended recipient, you are hereby notified that any reproduction,
dissemination or distribution of this communication is strictly
prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and
deleting it from your computer. Thank you. Tellabs
============================================================




More information about the U-Boot mailing list