building in dedicated directory; binutils -Wstack-usage and -flto

Дилян Палаузов dpa-binutils@aegee.org
Sun Apr 23 14:33:00 GMT 2017


Hello,

searching for "binutils build dedicated directory" the answers is "the 
binutils documentation recommends building binutils in a dedicated build 
directory",

What is the reasoning for this, except that "make distclean" does not 
clean everything, as it should?

Compiling with

CFLAGS="-pipe -O3 -flto -fno-fat-lto-objects" CXXFLAGS="-O3 -flto 
-fno-fat-lto-objects" LDFLAGS="-Wl,-O1,-s -flto=8" 
/git/binutils-gdb/configure --enable-plugins --enable-threads 
--with-system-zlib --enable-compressed-debug-sections=all --enable-gold

fails with:

make[2]: Entering directory 'binutils/binutils'
/bin/sh ./libtool --tag=CC   --mode=link gcc -W -Wall 
-Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 
-Werror  -pipe -O3 -flto -fno-fat-lto-objects  -Wl,-O1,-s -flto=8 -o 
size size.o bucomm.o version.o filemode.o ../bfd/libbfd.la 
../libiberty/libiberty.a  -ldl
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes 
-Wshadow -Wstack-usage=262144 -Werror -pipe -O3 -flto 
-fno-fat-lto-objects -Wl,-O1 -Wl,-s -flto=8 -o size size.o bucomm.o 
version.o filemode.o  ../bfd/.libs/libbfd.a -lz ../libiberty/libiberty.a 
-ldl
/git/binutils-gdb/libiberty/make-relative-prefix.c: In function 
'make_relative_prefix_1.constprop':
/git/binutils-gdb/libiberty/make-relative-prefix.c:227:1: error: stack 
usage might be unbounded [-Werror=stack-usage=]
  make_relative_prefix_1 (const char *progname, const char *bin_prefix,
  ^
lto1: all warnings being treated as errors
make[3]: *** [/tmp/ccyh6w05.mk:50: /tmp/cc64cFyz.ltrans16.ltrans.o] Error 1
make[3]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../x86_64-pc-linux-gnu/bin/ld: 
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:829: size] Error 1
make[2]: Leaving directory '/binutils/binutils'

But compiling with CFLAGS="-pipe -O3" CXXFLAGS="-O3" 
LDFLAGS="-Wl,-O1,-s" does work.

I use gcc 6.3.1 20170421, with both ld.bfd 2.28.51.20170422 and gold 
2.28.51.20170422) 1.14.

Does LTO increase the stack size; does it calculate the stack size 
wrong; does it calculate the stack size more precisely, or does it fail 
for another reason?

Please make binutils build with -flto?

Regards
   Дилян



More information about the Binutils mailing list