From mboxrd@z Thu Jan 1 00:00:00 1970 From: Graeme Russ Date: Thu, 04 Dec 2008 20:10:29 +1100 Subject: [U-Boot] u-boot.lds i686-pc-linux-gnu-ld section .start16 overlapssection .text In-Reply-To: <49EF8B38CAABF74C8FFEA1405FDFBE9241E99F@suzexch01.taihootech.com> References: <49EF8B38CAABF74C8FFEA1405FDFBE9241E99F@suzexch01.taihootech.com> Message-ID: <49379E85.3040105@gmail.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 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 - 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