From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Tue, 20 Mar 2012 09:21:07 +0100 Subject: [U-Boot] [PATCH V2] i.MX28: Drop __naked function from spl_mem_init In-Reply-To: <4F683862.4030709@denx.de> References: <1331933563-5865-1-git-send-email-marex@denx.de> <4F683862.4030709@denx.de> Message-ID: <201203200921.07634.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Stefano Babic, > 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 > > Cc: Stefano Babic > > Cc: Tom Rini > > --- > > 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. I have an idea -- patch GCC >:-) Which is exactly what I'm gonna do when I have time ^H^H^H^H^H^H^H^H^H completely loose it :) > > 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. Sadly, yes. > > Should we really fix such as warnings even if we generate some obscured > code ? Wolfgang, what do you think about ? It generates warnings in our jenkins CI. > > Regards, > Stefano Best regards, Marek Vasut