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
_______________________________________________________________