On 16/03/2012 22:32, Marek Vasut wrote: > Instead of compiling the function and using the result as a constant, simply > use > the constant. > > NOTE: This patch works around bug: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52546 > > Signed-off-by: Marek Vasut <ma...@denx.de> > Cc: Stefano Babic <sba...@denx.de> > Cc: Tom Rini <tr...@ti.com> > ---
Hi Marek, > arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c | 10 +++------- > 1 files changed, 3 insertions(+), 7 deletions(-) > > V2: Add comment that this works around bug in GCC > > diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c > b/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c > index 43a90ff..911bbef 100644 > --- a/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c > +++ b/arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c > @@ -173,22 +173,18 @@ void mx28_mem_setup_vddd(void) > &power_regs->hw_power_vdddctrl); > } > > -void data_abort_memdetect_handler(void) __attribute__((naked)); > -void data_abort_memdetect_handler(void) > -{ > - asm volatile("subs pc, r14, #4"); > -} > - > void mx28_mem_get_size(void) > { > struct mx28_digctl_regs *digctl_regs = > (struct mx28_digctl_regs *)MXS_DIGCTL_BASE; > uint32_t sz, da; > uint32_t *vt = (uint32_t *)0x20; > + /* The following is "subs pc, r14, #4", used as return from DABT. */ > + const uint32_t data_abort_memdetect_handler = 0xe25ef004; Are we maybe becoming warning addicted ? I know the reason for this (GCC raises a warning "-fstack-usage not supported for this target"), you have already asked the gcc people about this issue, and I do not have an idea how to fix this warning in a different way as you did. This is a sort of self-modifying code. However, the original code is quite easy to understand - I cannot say the same after the patch, we rely on the comment to understand something. Should we really fix such as warnings even if we generate some obscured code ? Wolfgang, what do you think about ? Regards, Stefano -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: off...@denx.de ===================================================================== _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot