src: add -Wno-error=stack-usage= to AM_LDFLAGS
Commit Message
While -Wstack-usage= is already excluded from AM_CFLAGS for various
tools in src using *_no_Wstack_usage variables, this obviously does not
help when LTO is enabled, so add -Wno-error=stack-usage= to AM_LDFLAGS
for linking tools in src.
References: https://sourceware.org/bugzilla/show_bug.cgi?id=24498
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
config/ChangeLog | 4 ++++
config/eu.am | 2 ++
src/ChangeLog | 4 ++++
src/Makefile.am | 2 +-
4 files changed, 11 insertions(+), 1 deletion(-)
Comments
Hi Dmitry,
On Mon, Sep 06, 2021 at 03:59:05AM +0300, Dmitry V. Levin wrote:
> While -Wstack-usage= is already excluded from AM_CFLAGS for various
> tools in src using *_no_Wstack_usage variables, this obviously does not
> help when LTO is enabled, so add -Wno-error=stack-usage= to AM_LDFLAGS
> for linking tools in src.
I didn't know it worked to pass warning flags to the compiler during
linking for lto. That is really useful in this case. Of course maybe
we really should get rid of the unbounded stack allocations in the
first place. But till we do, we need this to build with lto enabled.
Please apply.
Thanks,
Mark
@@ -1,3 +1,7 @@
+2021-09-05 Dmitry V. Levin <ldv@altlinux.org>
+
+ * eu.am (STACK_USAGE_NO_ERROR): New variable.
+
2021-07-06 Alice Zhang <alizhang@redhat.com>
* debuginfod.sysconfig: Introduce default retry limit.
@@ -39,8 +39,10 @@ ARFLAGS = cr
# Warn about stack usage of more than 256K = 262144 bytes.
if ADD_STACK_USAGE_WARNING
STACK_USAGE_WARNING=-Wstack-usage=262144
+STACK_USAGE_NO_ERROR=-Wno-error=stack-usage=
else
STACK_USAGE_WARNING=
+STACK_USAGE_NO_ERROR=
endif
if SANE_LOGICAL_OP_WARNING
@@ -1,3 +1,7 @@
+2021-09-05 Dmitry V. Levin <ldv@altlinux.org>
+
+ * Makefile.am (AM_LDFLAGS): Add $(STACK_USAGE_NO_ERROR).
+
2021-08-20 Saleem Abdulrasool <abdulras@google.com>
* elfclassify.c: Remove error.h include.
@@ -23,7 +23,7 @@ AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
-I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \
-I$(srcdir)/../libdwfl -I$(srcdir)/../libasm
-AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw
+AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw $(STACK_USAGE_NO_ERROR)
bin_PROGRAMS = readelf nm size strip elflint findtextrel addr2line \
elfcmp objdump ranlib strings ar unstrip stack elfcompress \