kexec-tools-2.0.1 and CFLAGS

Simon Horman horms at verge.net.au
Wed Aug 26 06:50:30 EDT 2009


On Wed, Aug 26, 2009 at 04:56:49PM +0900, Magnus Damm wrote:
> Hi Simon!
> 
> On Wed, Aug 26, 2009 at 3:31 PM, Simon Horman<horms at verge.net.au> wrote:
> > On Thu, Aug 20, 2009 at 10:14:19PM +0900, Magnus Damm wrote:
> >> Kexec-tools 2.0.1 seems to build only with optimization enabled. If I
> >> set CFLAGS before calling configure and remove the "-O2" then the code
> >> won't link properly. I found it while cross compiling for SuperH, but
> >> it's most likely an issue on other platforms as well. Have a look at
> >> the "-O0" below:
> >>
> >>  $ AR=_ar CC=_gcc CFLAGS="-O0" LDFLAGS="-static" ./configure
> >> --prefix=/ --host="sh3-linux" --without-zlib --without-xen
> 
> [snip]
> 
> >> This issue is most likely related to get_unaligned() and
> >> put_unaligned() having bad_unaligned_access_length() in their default
> >> case that never gets optimized away.
> >>
> >> Anyway, not very important. But at least you know now. =)
> >
> > Hi Magnus,
> >
> > I'm some what dubious about this, but it appears to be intentional that
> > get_unaligned() doesn't exist:
> >
> > ---- From kexec/kexec.h ----
> >
> > /*
> >  * This function doesn't actually exist.  The idea is that when someone
> >  * uses the macros below with an unsupported size (datatype), the linker
> >  * will alert us to the problem via an unresolved reference error.
> >  */
> 
> Yes, I understand the purpose of the code and it makes sense. But the
> data size in this case _is_ correct. The issue here seems to be that
> the compiler is not optimizing away the default case reference unless
> optimization is enabled. I'd suggest moving away from automatic type
> size detection to have separate functions for each size. That would
> make it possible to comple the code both with and without optimization
> enabled.
> 
> Or may I'm misunderstanding the issue? =)

I think you are understanding it right, that the current code fails
with no optimisation enabled because the unused function isn't optimised
away. Is there a reason you need -O0? It seems that fixing this is probably
more effort than its worth.




More information about the kexec mailing list