On Thu, 17 Oct 2024 at 15:06, Richard Sandiford
<richard.sandif...@arm.com> wrote:
>
> Richard Sandiford <richard.sandif...@arm.com> writes:
> > Christophe Lyon <christophe.l...@linaro.org> writes:
> >> When --enable-werror is enabled when running the top-level configure,
> >> it passes --enable-werror-always to subdirs.  Some of them, like
> >> libgcc, ignore it.
> >>
> >> This patch adds support for it, enabled only for aarch64, to avoid
> >> breaking bootstrap for other targets.
> >>
> >> The patch also adds -Wno-prio-ctor-dtor to avoid a warning when compiling 
> >> lse_init.c
> >>
> >>      libgcc/
> >>      * Makefile.in (WERROR): New.
> >>      * config/aarch64/t-aarch64: Handle WERROR. Always use
> >>      -Wno-prio-ctor-dtor.
> >>      * configure.ac: Add support for --enable-werror-always.
> >>      * configure: Regenerate.
> >> ---
> >>  libgcc/Makefile.in              |  1 +
> >>  libgcc/config/aarch64/t-aarch64 |  1 +
> >>  libgcc/configure                | 31 +++++++++++++++++++++++++++++++
> >>  libgcc/configure.ac             |  5 +++++
> >>  4 files changed, 38 insertions(+)
> >>
> >> [...]
> >> diff --git a/libgcc/configure.ac b/libgcc/configure.ac
> >> index 4e8c036990f..6b3ea2aea5c 100644
> >> --- a/libgcc/configure.ac
> >> +++ b/libgcc/configure.ac
> >> @@ -13,6 +13,7 @@ sinclude(../config/unwind_ipinfo.m4)
> >>  sinclude(../config/gthr.m4)
> >>  sinclude(../config/sjlj.m4)
> >>  sinclude(../config/cet.m4)
> >> +sinclude(../config/warnings.m4)
> >>
> >>  AC_INIT([GNU C Runtime Library], 1.0,,[libgcc])
> >>  AC_CONFIG_SRCDIR([static-object.mk])
> >> @@ -746,6 +747,10 @@ AC_SUBST(HAVE_STRUB_SUPPORT)
> >>  # Determine what GCC version number to use in filesystem paths.
> >>  GCC_BASE_VER
> >>
> >> +# Only enable with --enable-werror-always until existing warnings are
> >> +# corrected.
> >> +ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
> >
> > It looks like this is borrowed from libcpp and/or libdecnumber.
> > Those are a bit different from libgcc in that they're host libraries
> > that can be built with any supported compiler (including non-GCC ones).
> > In constrast, libgcc can only be built with the corresponding version
> > of GCC.  The usual restrictions on -Werror -- only use it during stages
> > 2 and 3, or if the user explicitly passes --enable-werror -- don't apply
> > in libgcc's case.  We should always be building with the "right" version
> > of GCC (even for Canadian crosses) and so should always be able to use
> > -Werror.
> >
> > So personally, I think we should just go with:
> >
> > diff --git a/libgcc/config/aarch64/t-aarch64 
> > b/libgcc/config/aarch64/t-aarch64
> > index b70e7b94edd..ae1588ce307 100644
> > --- a/libgcc/config/aarch64/t-aarch64
> > +++ b/libgcc/config/aarch64/t-aarch64
> > @@ -30,3 +30,4 @@ LIB2ADDEH += \
> >       $(srcdir)/config/aarch64/__arm_za_disable.S
> >
> >  SHLIB_MAPFILES += $(srcdir)/config/aarch64/libgcc-sme.ver
> > +LIBGCC2_CFLAGS += $(WERROR) -Wno-prio-ctor-dtor
> >
> > ...this, but with $(WERROR) replaced by -Werror.
> >
> > At least, it would be a good way of finding out if there's a case
> > I've forgotten :)
> >
> > Let's see what others think though.
>
> As per the later discussion, the t-aarch64 change described above is OK
> for trunk, but anyone with commit access should feel free to revert it
> if it breaks their build.  (Although please post a description of what
> went wrong as well :))
>
> Thanks for doing this.
>

Thanks, find attached what I'm pushing.

Christophe

> Richard
From 71c7b446b98aa51294d79c45e37f1564668a1f3a Mon Sep 17 00:00:00 2001
From: Christophe Lyon <christophe.l...@linaro.org>
Date: Thu, 3 Oct 2024 16:02:55 +0000
Subject: [PATCH v2 3/3] aarch64: libgcc: Use -Werror

This patch adds -Werror to LIBGCC2_CFLAGS so that aarch64 can catch
warnings during bootstrap, while not impacting other targets.

The patch also adds -Wno-prio-ctor-dtor to avoid a warning when
compiling lse_init.c

	libgcc/
	* config/aarch64/t-aarch64: Always use -Werror
	-Wno-prio-ctor-dtor.
---
 libgcc/config/aarch64/t-aarch64 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libgcc/config/aarch64/t-aarch64 b/libgcc/config/aarch64/t-aarch64
index b70e7b94edd..d500bd0de67 100644
--- a/libgcc/config/aarch64/t-aarch64
+++ b/libgcc/config/aarch64/t-aarch64
@@ -30,3 +30,4 @@ LIB2ADDEH += \
 	$(srcdir)/config/aarch64/__arm_za_disable.S
 
 SHLIB_MAPFILES += $(srcdir)/config/aarch64/libgcc-sme.ver
+LIBGCC2_CFLAGS += -Werror -Wno-prio-ctor-dtor
-- 
2.34.1

Reply via email to