Specifying cross-compile flags for newlib

Robert Cragie rcc@jennic.com
Tue Sep 18 20:10:00 GMT 2007


It looks like I've managed to do it using MULTILIB:

MULTILIB_OPTIONS = mopt1 mopt2
MULTILIB_DIRNAMES = opt1 opt2

but of course this spends ages building all 4 options ((!mopt1,!mopt2),
(mopt1,!mopt2),(!mopt1,mopt2),(mopt1,mopt2)) whereas I only really want
(mopt1,mopt2). However, I guess this may be useful as the two options I need
will be the most likely to be switched about in application building so the
multilibs may actually be useful.

I did try:

CFLAGS_FOR_TARGET += -mopt1 -mopt2

in the t-default Makefile segment but that only compiled 4 files
(crtstuff.c -DCRT_BEGIN, crtstuff.c -DCRT_END, crti.S and crtn.S) with these
flags. I didn't want to start messing about with actual Makefiles as
configure will change these anyway. So I would still appreciate it if anyone
can tell me the proper way of doing it - there must be one, surely?

Robert Cragie, Design Engineer
_______________________________________________________________
Jennic Ltd, Furnival Street, Sheffield, S1 4QT,  UK
http://www.jennic.com  Tel: +44 (0) 114 281 2655
_______________________________________________________________


> -----Original Message-----
> From: Kai Ruottu [mailto:karuottu@mbnet.fi]
> Sent: 18 September 2007 12:30
> To: rcc@jennic.com
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: Specifying cross-compile flags for newlib
>
>
> Robert Cragie wrote:
> > I am building a cross compiler and automatically building in newlib
> > with --with-newlib in the configure options. I need to pass additional
> > compiler flags to the just-build cross-compiler when compiling
> libgcc2 and
> > newlib. I can figure out what to do for libgcc2 - specify
> > TARGET_LIBGCC2_CFLAGS in the t-default Makefile segment in the
> > gcc/contrib/<arch> subdir. However, these flags don't get
> passed to newlib -
> > how do I do the same for newlib?
> >
> What about browsing the main 'Makefile' and searching for 'CFLAGS' ?
>
> After the $build ('*_FOR_BUILD' and  $host settings, there will be
> settings '_FOR_TARGET' like :
>
> CC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/
> $(FLAGS_FOR_TARGET)
> # During gcc bootstrap, if we use some random cc for stage1 then
> # CFLAGS will be just -g.  We want to ensure that TARGET libraries
> # (which we know are built with gcc) are built with optimizations so
> # prepend -O2 when setting CFLAGS_FOR_TARGET.
> CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
> # If GCC_FOR_TARGET is not overriden on the command line, then this
> # variable is passed down to the gcc Makefile, where it is used to
> # build libgcc2.a.  We define it here so that it can itself be
> # overridden on the command line.
> GCC_FOR_TARGET=$(USUAL_GCC_FOR_TARGET)
>
> The 'CFLAGS_FOR_TARGET' most probably would be the setting you should
> customize!  This should
> be possible already when configuring, for instance :
>
> CFLAGS_FOR_TARGET="-Os -omit-frame-pointer" \
> $GCC_SRC/configure ......
>
> but the previous comments don't tell about "overriding" this, so maybe
> it will not be looked
> in the 'environment settings'....
>
> > Thanks in advance
> >
> > Robert Cragie, Design Engineer
> > _______________________________________________________________
> > Jennic Ltd, Furnival Street, Sheffield, S1 4QT,  UK
> > http://www.jennic.com  Tel: +44 (0) 114 281 2655
> > _______________________________________________________________
> >
> >
> >
> >
> >
>



More information about the Gcc-help mailing list