public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* building in dedicated directory; binutils -Wstack-usage and -flto
@ 2017-04-23 14:33 Дилян Палаузов
  2017-04-24  6:59 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Дилян Палаузов @ 2017-04-23 14:33 UTC (permalink / raw)
  To: binutils

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
   Дилян

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: building in dedicated directory; binutils -Wstack-usage and -flto
  2017-04-23 14:33 building in dedicated directory; binutils -Wstack-usage and -flto Дилян Палаузов
@ 2017-04-24  6:59 ` Alan Modra
  2017-04-26 21:21   ` Дилян Палаузов
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2017-04-24  6:59 UTC (permalink / raw)
  To: Дилян
	Палаузов
  Cc: binutils

On Sun, Apr 23, 2017 at 04:33:16PM +0200, Дилян Палаузов wrote:
> 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?

If we did a poll of binutils developers, I'd guess that most use a
separate build directory.  It's likely that builds in the source
directory are not so well tested..

> lto1: all warnings being treated as errors
[snip]
> Please make binutils build with -flto?

configure with --disable-werror.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: building in dedicated directory; binutils -Wstack-usage and -flto
  2017-04-24  6:59 ` Alan Modra
@ 2017-04-26 21:21   ` Дилян Палаузов
  2017-04-26 21:27     ` Andrew Pinski
  0 siblings, 1 reply; 4+ messages in thread
From: Дилян Палаузов @ 2017-04-26 21:21 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

Hello,

I guess most binutils developers use separate build directory, because 
they were told to do so.  This a chicken-egg-problem.

Can you ensure that "make distclean" cleans everything created by "make" 
(e.g. in the separate build directory)?

Is the message "error: stack usage might be unbounded 
[-Werror=stack-usage=]", when binutils is -flto built, correct (lto uses 
more stack), or wrong (liblto_plugin or ld handle it wrong).

Regards
   Дилян

On 04/24/2017 08:58 AM, Alan Modra wrote:
> On Sun, Apr 23, 2017 at 04:33:16PM +0200, Дилян Палаузов wrote:
>> 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?
>
> If we did a poll of binutils developers, I'd guess that most use a
> separate build directory.  It's likely that builds in the source
> directory are not so well tested..
>
>> lto1: all warnings being treated as errors
> [snip]
>> Please make binutils build with -flto?
>
> configure with --disable-werror.
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: building in dedicated directory; binutils -Wstack-usage and -flto
  2017-04-26 21:21   ` Дилян Палаузов
@ 2017-04-26 21:27     ` Andrew Pinski
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Pinski @ 2017-04-26 21:27 UTC (permalink / raw)
  To: Дилян
	Палаузов
  Cc: Alan Modra, binutils

On Wed, Apr 26, 2017 at 2:21 PM, Дилян Палаузов <dpa-binutils@aegee.org> wrote:
> Hello,
>
> I guess most binutils developers use separate build directory, because they
> were told to do so.  This a chicken-egg-problem.

One reason why people using separate build directories to build a few
different targets and versions of binutils (cross, native, candian
cross).

Thanks,
Andrew

>
> Can you ensure that "make distclean" cleans everything created by "make"
> (e.g. in the separate build directory)?
>
> Is the message "error: stack usage might be unbounded
> [-Werror=stack-usage=]", when binutils is -flto built, correct (lto uses
> more stack), or wrong (liblto_plugin or ld handle it wrong).
>
> Regards
>   Дилян
>
>
> On 04/24/2017 08:58 AM, Alan Modra wrote:
>>
>> On Sun, Apr 23, 2017 at 04:33:16PM +0200, Дилян Палаузов wrote:
>>>
>>> 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?
>>
>>
>> If we did a poll of binutils developers, I'd guess that most use a
>> separate build directory.  It's likely that builds in the source
>> directory are not so well tested..
>>
>>> lto1: all warnings being treated as errors
>>
>> [snip]
>>>
>>> Please make binutils build with -flto?
>>
>>
>> configure with --disable-werror.
>>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-26 21:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-23 14:33 building in dedicated directory; binutils -Wstack-usage and -flto Дилян Палаузов
2017-04-24  6:59 ` Alan Modra
2017-04-26 21:21   ` Дилян Палаузов
2017-04-26 21:27     ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).