From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 1/2] Makefile: Extend noinline workarounds for LTO and -O2 to gcc 12 Date: Wed, 28 Sep 2022 21:00:29 +0200 Message-ID: <20220928190030.1379963-2-sbrivio@redhat.com> In-Reply-To: <20220928190030.1379963-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2755262074204584391==" --===============2755262074204584391== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Commit 1a563a0cbd49 ("passt: Address gcc 11 warnings") works around an issue where the remote address passed to hash functions is seen as uninitialised by gcc, with -flto and -O2. It turns out we get the same exact behaviour on gcc 12.1 and 12.2, so extend the applicability of the same workaround to gcc 12. Don't go further than that, though: should the issue reported at: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D78993 happen to be fixed in a later version of gcc, we won't need the noinline attributes anymore. Otherwise, we'll notice. Signed-off-by: Stefano Brivio --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7a0b829..1d45f17 100644 --- a/Makefile +++ b/Makefile @@ -45,12 +45,12 @@ PASST_HEADERS =3D arch.h arp.h checksum.h conf.h dhcp.h d= hcpv6.h icmp.h \ pcap.h port_fwd.h siphash.h tap.h tcp.h tcp_splice.h udp.h util.h HEADERS =3D $(PASST_HEADERS) seccomp.h =20 -# On gcc 11.2, with -O2 and -flto, tcp_hash() and siphash_20b(), if inlined, -# seem to be hitting something similar to: +# On gcc 11 and 12, with -O2 and -flto, tcp_hash() and siphash_20b(), if +# inlined, seem to be hitting something similar to: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D78993 # from the pointer arithmetic used from the tcp_tap_handler() path to get the # remote connection address. -ifeq ($(shell $(CC) -dumpversion),11) +ifeq (,$(filter-out 11 12, $(shell $(CC) -dumpversion))) ifneq (,$(filter -flto%,$(FLAGS) $(CFLAGS))) ifneq (,$(filter -O2,$(FLAGS) $(CFLAGS))) FLAGS +=3D -DTCP_HASH_NOINLINE --=20 2.35.1 --===============2755262074204584391==--