This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: CFLAGS for the target libgcc and so on when building a cross-compiler
- From: Ian Lance Taylor <iant at google dot com>
- To: rdiezmail-gcc at yahoo dot de
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 14 Jul 2011 11:47:52 -0700
- Subject: Re: CFLAGS for the target libgcc and so on when building a cross-compiler
- References: <1310635877.91599.YahooMailClassic@web25401.mail.ukl.yahoo.com>
"R. Diez" <rdiezmail-gcc@yahoo.de> writes:
> I am building a GCC 4.5.3 cross-compiler for an embedded PowerPC target, together with binutils-2.21 and newlib 1.19.0 .
>
> I have been careful to use the same CFLAGS for both the embedded application and for newlib, as they can change the ABI. I recently realised that some components from GCC (ligbcc, libstdc++) are also linked to the embedded application, so I should be using the same CFLAGS there too.
>
> I searched a little and found variables like LIBGCC2_CFLAGS, MULTILIB_EXTRA_OPTS and CRTSTUFF_T_CFLAGS, but I'm confused about which ones I should use. Can anybody help?
>
> I also wanted to compile all GCC's target components without optimisation, as I need to debug some problems I'm having between my crt0.asm and GCC's crtstuff.c , and the optimised code makes it rather difficult. I wonder how I could prevent GCC from adding -O2 to the code, or whether I could somehow specify -O0 at the end of the target flags for all GCC target components.
For target libraries written in C, set CFLAGS_FOR_TARGET when you run
make. That will provide options which are passed to the compiler when
compiling all target libraries. The default value for CFLAGS_FOR_TARGET
is CFLAGS, and the default for CFLAGS is (usually) "-g -O2".
Ian