[PATCH 1/1] powerpc: crtsaveres.o needed only when -Os flag is enabled

Ram Pai linuxram at us.ibm.com
Sat May 3 03:47:36 EST 2014


On Fri, May 02, 2014 at 11:09:17AM +0530, Aneesh Kumar K.V wrote:
> Ram Pai <linuxram at us.ibm.com> writes:
> 
> >     powerpc: crtsaveres.o needed only when -Os flag is enabled
> >     
> >     Currently on powerpc arch, out-of-tree module fails to build without
> >     crtsaveres.o, even when the module has no dependency on the symbols
> >     provided by the file; when built without the -Os flag.
> >     
> >     BTW: '-Os' flag is enabled when CONFIG_CC_OPTIMIZE_FOR_SIZE is
> >     configured.
> >     
> >     This patch fixes that problem.
> >     
> > Signed-off-by: Ram Pai <linuxram at us.ibm.com>
> >
> > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> > index 4c0cedf..cf12f38 100644
> > --- a/arch/powerpc/Makefile
> > +++ b/arch/powerpc/Makefile
> > @@ -157,7 +157,10 @@ CPP		= $(CC) -E $(KBUILD_CFLAGS)
> >  
> >  CHECKFLAGS	+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
> >  
> > +ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> >  KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
> > +endif
> > +
> >  
> >  # No AltiVec or VSX instructions when building kernel
> >  KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
> >
> 
> So if we enable CONFIG_CC_OPTIMIZE_FOR_SIZE can we build out-of-tree
> module with this patch ?

	Yes, provided crtsaveres.o is available.


If crtsaveres.o is not available; some distro dont ship it, than
out-of-tree module linking will fail.

Some distro don't ship crtsaveres.o since they do not want
kernel and modules to be built with space optimization. In such cases
requiring crtsaveres.o to be available during module building, even
when the module is not built for space optimization is wrong.

This patch fixes that issue.

RP



More information about the Linuxppc-dev mailing list