On Wed, 20 Apr 2011, Shawn Guo wrote: > On Tue, Apr 19, 2011 at 04:23:09PM +0100, Dave Martin wrote: > > Hopefully this explains what's going on, but what are you trying > > to achieve exactly? > > > Thanks a ton, Dave. It does explain what I'm seeing, and your > explanation looks like a very good learning material. > > I'm running into a problem with John Bonies' append-dtb-to-zImage > patch. That is the header of dtb was overwritten by uart_base > value. John's patch did fix up .bss entries in .got to move them > behind dtb image. But as you explained, when uart_base is defined > as static one, its address is fixed up in pc-relative way at link > time, and John's patch does not help it, hence the write to > uart_base at runtime overwrites dtb image. > > What do you think is the right fix to this problem? Forbid the use > of static uninitialized variable? I'm afraid not. Is it possible > to fix up the cases like uart_base here at runtime?
You must not use static variable in the decompressor. For one thing, that breaks the ability to XIP the decompressor code and move writable data elsewhere. So the fix is indeed to _not_ declare any global variable as static in this case. Nicolas _______________________________________________ linaro-toolchain mailing list linaro-toolchain@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-toolchain