public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] u-boot.lds i686-pc-linux-gnu-ld section .start16 overlapssection .text
Date: Thu, 04 Dec 2008 20:10:29 +1100	[thread overview]
Message-ID: <49379E85.3040105@gmail.com> (raw)
In-Reply-To: <49EF8B38CAABF74C8FFEA1405FDFBE9241E99F@suzexch01.taihootech.com>

Hi Lance,

I've been working on the i386 build for a while now and have some knowledge
 of the linker script for this particular port so hopefully I can give some
meaningful advice....

Lance Zhang wrote:
> Vignesh, Thank you very much.
> 
>> Try to change the boundary limits for the sections to prevent
> conflicts,
>> this is due to the new addition of the driver code.

There should have been a fair amount of space left in the binary. For
example, my current build has a gap from 0x14cca to 0x3f7ff (~170kB) in a
256kB binary so there should be plenty of room to add an Ethernet driver

> I am not familiar with the liker script.
> Can I simplely modify the following codes in u-boot.lds
> 	. = 0xff00;
>  	.start16 : AT (0x05ffff00) { *(.start16); }
>  
>  	. = 0xfff0;
>  	.reset : AT (0x05fffff0) { *(.reset); }
> 
> To 
> 	. = 0xff00;
>  	.start16 : AT (0x06ffff00) { *(.start16); }
>  
>  	. = 0xfff0;
>  	.reset : AT (0x06fffff0) { *(.reset); }

Probably not. The locations of .start16 and .reset must be very carefully
set. .reset must occupy the last 16 bytes of your binary image. The i386
starts executing code 16 bytes before the very end if its (real mode)
address space. Other CPUs start at 0x0000000 which makes life a lot easier

.start16 is the code that switches the CPU into protected mode. Until then,
branch distances are (fairly) short, so .start16 needs to be close to .reset

> 
> The compilation is Ok, but the file size is 26M, it is very large.
> 
> Can you told me how to change the lds file. Thanks very much
> 
> The errors outputted by ld
> i686-pc-linux-gnu-ld:
>  section .start16 [05ffff00 -> 05ffffba] overlaps section .text
> [05fe0000 -> 06011b85]

If you look at the layout of the various sections in the binary now, .text
occupies 0x05fe0000 -> 0x06011b85 and .reset occupies 0x06fffff0 -> 0x06ffffff

0x06ffffff (end of .reset) - 0x05fe0000 (start of .text) = 0x101ffff
(~16MB) and most of this is just empty space (0x06011b86 -> 0x06fffeff -
end of .text to start of .start16) - The extra 10M is a bit of a mystery -
maybe more space between sections

Have a look at u-boot.map - This file is generated by the linker and it
will tell you exactly where it put everything

Also, .text section (the one that holds all the code) looks to be very big:

0x06011b85 - 0x05fe0000 = 0x31b85 (~200kB)

You bootloader image will be bigger than this still after all the .data
sections are added (printf strings etc)

> i686-pc-linux-gnu-ld:
>  section .reset [05fffff0 -> 05ffffff] overlaps section .text [05fe0000
> -> 06011b85]
> make: *** [u-boot] Error 1
> 
> The lds contents:
> OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
>  OUTPUT_ARCH(i386)
>  ENTRY(_start)
>  
>  SECTIONS
>  {
>  	/* here is where we are in flash: last 128k */

This looks like a problem - Your flash is only 128k, but you code is at
least 200k

<snip> - Remainder of script looks OK

I would stick to the original linker script and try to figure out why .text
 grew so much. Have a look at u-boot.map and try to figure out what is
using all the space

Regards,

Graeme

  reply	other threads:[~2008-12-04  9:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04  7:07 [U-Boot] u-boot.lds i686-pc-linux-gnu-ld section .start16 overlaps section .text LanceZ
2008-12-04  7:47 ` [U-Boot] u-boot.lds i686-pc-linux-gnu-ld section .start16 overlapssection .text Vignesh Kumar B
2008-12-04  8:07   ` Lance Zhang
2008-12-04  9:10     ` Graeme Russ [this message]
2008-12-04  9:48       ` Lance Zhang
2008-12-04 10:06         ` Graeme Russ
2008-12-12  2:37           ` LanceZ

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49379E85.3040105@gmail.com \
    --to=graeme.russ@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox