We enable -D_FORTIFY_SOURCE=2 by default, but with 4.9.0 we're encountering an error while building libitm. It can be reproduced without modifying the compiler by configuring with: CXXFLAGS="-O2 -g -D_FORTIFY_SOURCE=2" ../dist/gcc/gcc-4.9.0/configure --enable-languages=c,c++ --disable-werror --disable-bootstrap The error is: libtool: compile: /home/dirtyepic/build/./gcc/xg++ -B/home/dirtyepic/build/./gcc/ -nostdinc++ -nostdinc++ -I/home/dirtyepic/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu -I/home/dirtyepic/build/x86_64-unknown-linux-gnu/libstdc++-v3/include -I/home/dirtyepic/dist/gcc/gcc-4.9.0/libstdc++-v3/libsupc++ -I/home/dirtyepic/dist/gcc/gcc-4.9.0/libstdc++-v3/include/backward -I/home/dirtyepic/dist/gcc/gcc-4.9.0/libstdc++-v3/testsuite/util -L/home/dirtyepic/build/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/home/dirtyepic/build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/home/dirtyepic/build/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I../../../dist/gcc/gcc-4.9.0/libitm -I../../../dist/gcc/gcc-4.9.0/libitm/config/linux/x86 -I../../../dist/gcc/gcc-4.9.0/libitm/config/linux -I../../../dist/gcc/gcc-4.9.0/libitm/config/x86 -I../../../dist/gcc/gcc-4.9.0/libitm/config/posix -I../../../dist/gcc/gcc-4.9.0/libitm/config/generic -I../../../dist/gcc/gcc-4.9.0/libitm -mrtm -Wall -pthread -Werror -std=gnu++0x -funwind-tables -fno-exceptions -fno-rtti -fabi-version=4 -O2 -g -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -MT util.lo -MD -MP -MF .deps/util.Tpo -c ../../../dist/gcc/gcc-4.9.0/libitm/util.cc -fPIC -DPIC -o .libs/util.o In file included from /usr/include/stdio.h:937:0, from ../../../dist/gcc/gcc-4.9.0/libitm/util.cc:27: /usr/include/bits/stdio2.h: In function ‘void GTM::gtm_verror(const char*, __va_list_tag*)’: /usr/include/bits/stdio2.h:124:1: error: inlining failed in call to always_inline ‘int vfprintf(FILE*, const char*, __va_list_tag*)’: function body can be overwritten at link time vfprintf (FILE *__restrict __stream, ^ ../../../dist/gcc/gcc-4.9.0/libitm/util.cc:35:31: error: called from here vfprintf (stderr, fmt, list); ^ Comparing the preprocessor output for util.cc and a couple other C++ files that use vfprintf the most obvious difference is the declaration is missing __inline, ie. extern __attribute__((always_inline)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) int vfprintf instead of extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) int vfprintf
I have the same build error. The build error is reproduced with Linaro GCC 4.9 2014.06 release. Also switching off -D_FORTIFY_SOURCE=2 helps.
Patch: https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02460.html
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02469.html Sorry, previous patch is incomplete.
Seems to be fixed with: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=227040
assuming that fixes things (for gcc-6). will re-open if it doesn't.
Hi, This issue has been reported recently on gcc 5.5.0 [1] Is it safe to backport the patch to gcc 4.9 and 5.5.0? Best regards, Romain [1] https://bugs.busybox.net/show_bug.cgi?id=11476
(In reply to Romain Naour from comment #6) GCC 4 and 5 (and even 6) branches are no longer being maintained so the changes cannot be backported to them.