On 10 Aug 2015, at 21:05, Jan Sommer <soja-lists@xxxxxxxxxxxxxxxxxx> wrote: > Hi, > > I compiled gcc with the following options: > ../gcc-4.9.2/configure CFLAGS="-O0 -g" CXXFLAGS="-O0 -g" --enable-threads -with-gnu-as \ > --with-gnu-ld --with-newlib --verbose \ > --with-system-zlib --disable-nls \ > --enable-version-specific-runtime-libs \ > --enable-languages=c,c++,ada \ > --target=arm-rtems4.11 \ > --prefix=/opt/rtems-arm/ \ > --enable-checking=yes > > But although I set CFLAGS and CXXFLAGS still I can find a lot of places in the log where the optimization level is set to -O2. > This leads to the problem that when debugging of the Ada runtime a lot of variables are optimized out. > How can I enforce that the whole cross-compiler is built without any active optmizations? If you want to debug the Ada runtime you need to compile the runtime with appropriate flags. I think your flags affect the compiler itself. I think the relevant Makefile is in gcc/ada/gcc-interface. Looking at target gnatlib:, the useful-looking variables are GNATLIBCFLAGS_FOR_C, FORCE_DEBUG_ADAFLAGS, GNATLIBCFLAGS, GNATLIBFLAGS, and at the top of the file there are explicit settings GNATLIBFLAGS = -W -Wall -gnatpg -nostdinc GNATLIBCFLAGS = -g -O2 so I’d try setting GNATLIBCFLAGS.