"R. Diez" <rdiezmail-gcc@xxxxxxxx> 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