[U-Boot] [ARM] gap between _start and CONFIG_SYS_TEXT_BASE

Hi List. I am working on porting U-Boot to arm1176-based SoC. It works in general, but I had to cut off relocation because of a problem described below. In short: Looks like u-boot fails to link correctly with some CONFIG_SYS_TEXT_BASE values.
Board name: uemd Compiler: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2008q3-72) 4.3.2 -- I also tried a couple of other versions without difference. Text_base: 0x00100010
I've checked that compiler really uses -Ttext 0x00100010 option while building. But when I use nm to view actual address, I see:
u-boot-uemd % nm u-boot | grep -w _start 00100020 T _start
So there is 16-byte gap between TEXT_BASE and actual start of code. Another way to see it is
u-boot-uemd % hexdump -Cv u-boot.bin | head -n 4 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000010 1a 00 00 ea 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 |................| 00000020 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 |................| 00000030 00 02 10 00 60 02 10 00 c0 02 10 00 20 03 10 00 |....`....... ...|
This binary will blow up either while relocating code or while first call to malloc (probably due to invalid bss).
Does anybody knows what is going on? How can I tell the linker to eliminate those gap? Playing with . = ALIGN() in u-boot.lds didn't help.
Sergey.

Dear Sergey Mironov,
In message AANLkTikkL7iQVn-a8SxYM6=a0gqOSLza+Gtdhoq7dMFE@mail.gmail.com you wrote:
Compiler: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2008q3-72) 4.3.2 -- I also tried a couple of other versions without difference.
Did these include more recent versions? GCC 4.3.x is not exactly what I can recommend for ARM systems...
Text_base: 0x00100010
Is there a special reason for chosing such an odd address?
Why don't you use 0x00100000 ?
Does anybody knows what is going on? How can I tell the linker to eliminate those gap? Playing with . = ALIGN() in u-boot.lds didn't help.
We don't know your code, nor your linker script, nor your link command.
We don't even know which version of U-Boot you are talking about.
Thus we cannot even guess what you might be doing.
Best regards,
Wolfgang Denk

In message AANLkTikkL7iQVn-a8SxYM6=a0gqOSLza+Gtdhoq7dMFE@mail.gmail.com you wrote:
Compiler: arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2008q3-72) 4.3.2 -- I also tried a couple of other versions without difference.
Did these include more recent versions? GCC 4.3.x is not exactly what I can recommend for ARM systems...
Well, the newest one I've tried was arm-none-linux-gnueabi-gcc (Gentoo 4.4.4-r1 p1.1, pie-0.4.5) 4.4.4. But I found it broken since it messed up relocation-related sections for some reason. What compiler you think I should try?
Text_base: 0x00100010
Is there a special reason for chosing such an odd address?
Why don't you use 0x00100000 ?
Our SoC's bootloader expects this strange address. It is hardcoded into chip and can't be changed :(
We don't know your code, nor your linker script, nor your link command.
We don't even know which version of U-Boot you are talking about.
Thus we cannot even guess what you might be doing.
O, sorry. I branched out from commit # 227b7251554 and tried to stay default as much as possible. So I am using cpu/arm1176's default u-boot.lds and start.S
Best regards,
Wolfgang Denk
-- 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@denx.de A year spent in artificial intelligence is enough to make one believe in God.
Sergey

Dear Sergey Mironov,
In message AANLkTinFDxV85ENF9GLd3GjnD-ZUOEXsqCE1VdXd=5fo@mail.gmail.com you wrote:
Well, the newest one I've tried was arm-none-linux-gnueabi-gcc (Gentoo 4.4.4-r1 p1.1, pie-0.4.5) 4.4.4. But I found it broken since it messed up relocation-related sections for some reason. What compiler you think I should try?
I don't know and cannot comment on the gentoo compilers, but there is plenty of other options: Poky, Linaro, ELDK, CodeSourcery, OpenEmbedded, ...
Text_base: 0x00100010
Is there a special reason for chosing such an odd address?
Why don't you use 0x00100000 ?
Our SoC's bootloader expects this strange address. It is hardcoded into chip and can't be changed :(
This statement makes zero sense to me. Your "SoC's bootloader" cannot know or deman where you are linking your image to. It may expect a certain entry point address, that's all - but that is completely independent of TEXT_BASE.
I branched out from commit # 227b7251554 and tried to stay default as much as possible. So I am using cpu/arm1176's default u-boot.lds and start.S
OK. I recommend to adjust start.S for your entry point requirements, and leave CONFIG_SYS_TEXT_BASE at a sane value instead.
Best regards,
Wolfgang Denk
participants (2)
-
Sergey Mironov
-
Wolfgang Denk