From mboxrd@z Thu Jan 1 00:00:00 1970 From: brino Date: Tue, 11 Dec 2007 14:50:47 -0800 (PST) Subject: [U-Boot-Users] [PATCH] Fix linker scripts: add NOLOAD atribute to .bss/.sbss sections In-Reply-To: <20071207072815.4be2a59c@weaponx> References: <1197026214-31034-1-git-send-email-wd@denx.de> <20071207072815.4be2a59c@weaponx> Message-ID: <14285357.post@talk.nabble.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 All, This fix doesn't work with binutils-2.18. I'm building u-boot for the amcc yosemite board using cygwin and cross binutils-2.18/gcc-4.2.2 for a powerpc-eabi target. The linker complains that "section .text can't be allocated in segment 0." The .bss section is by default a NOLOAD section with binutils-2.18 meaning it occupies no space in the file. However, the .bss section is an ALLOC section meaning it does occupy space in target memory. The linker runs an error check to make sure all sections will fit within the file and all sections will fit within target memory. All sections do fit within the file, however the sections do not fit within target memory because of the wrap around end of memory. We could definitely drop the TEXT_BASE address lower which would fix the problem, but isn't ideal since the image would take up more flash for no reason. We could link with TEXT_BASE=0 and then burn it to flash at address 0xFFF80000 (this is where the current TEXT_BASE is for the yosemite board). Whats the reason it's linked at 0xFFF80000 anyway? Is there an elf loader which burns it into flash? There's also the 'AT' attribute in the linker script which may help, however, I don't quite understand the use of it yet. Any suggestions on how to approach this? Thanks, Brian Josh Boyer-3 wrote: > > On Fri, 7 Dec 2007 12:16:54 +0100 > Wolfgang Denk wrote: > >> With recent toolchain versions, some boards would not build because >> or errors like this one (here for ocotea board when building with >> ELDK 4.2): >> ppc_4xx-ld: section .bootpg [fffff000 -> fffff23b] overlaps section .bss >> [fffee900 -> fffff8ab] >> >> For many boards, the .bss section is big enough that it wraps around >> at the end of the address space (0xFFFFFFFF), so the problem will not >> be visible unless you use a 64 bit tool chain for development. On >> some boards however, changes to the code size (due to different >> optimizations) we bail out with section overlaps like above. >> >> The fix is to add the NOLOAD attribute to the .bss and .sbss >> sections, telling the linker that .bss does not consume any space in >> the image. > > YAY! I've been having to work around this for a while now. Looking > forward to trying it out. > > josh > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > U-Boot-Users mailing list > U-Boot-Users at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/u-boot-users > > -- View this message in context: http://www.nabble.com/-PATCH--Fix-linker-scripts%3A-add-NOLOAD-atribute-to-.bss-.sbss-sections-tp14210775p14285357.html Sent from the Uboot - Users mailing list archive at Nabble.com.