From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=hQn+K2o/; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 8D43C5A0262 for ; Wed, 29 Apr 2026 07:01:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1777438903; bh=AbrlRoegKP4dWeDI5uRsLbxSP4Xz85fzNpjnf/JZTuU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hQn+K2o/P+iVE13xlciOOdZ5uLdmM30SJcCckWB5ofKzE/bvJFH9mbDnBXe75Pozy 1228YHgnKz05kxZ8LWSgoXdt/6Og+3C+VLui94M8OSBRerG+3Y0DsZR5ZfTDzHysH0 xhyFU9wmAkmROHHQ0Ta267zF1wQLUTTvlT1zfa2wRza6x35th6Kvghi/RxTO5onUZe BFLhZEY0hUHxZRC0GR1FsFIuTXPQsm6m10CQiLHFOFLH/ab3Rg6P51kOTgnd4fblEB nTY+e2mTMCUxGEi9l2jYutWhu4DJ2y/Mtt8e2fwsIMYCPUAvfmzpvk7BFcOSQs93rQ OShIQtxkkn59Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4g54sM660Qz4wSc; Wed, 29 Apr 2026 15:01:43 +1000 (AEST) Date: Wed, 29 Apr 2026 15:01:39 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v2 04/13] Makefile: Remove non-standard $(FLAGS) variable Message-ID: References: <20260421032338.1909084-1-david@gibson.dropbear.id.au> <20260421032338.1909084-5-david@gibson.dropbear.id.au> <20260428091728.3b00b5be@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BfT6hq74NK974V/A" Content-Disposition: inline In-Reply-To: Message-ID-Hash: 6LRKHLGKKF7DAEYWGCHUIIDI6Y573UKR X-Message-ID-Hash: 6LRKHLGKKF7DAEYWGCHUIIDI6Y573UKR X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --BfT6hq74NK974V/A Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 29, 2026 at 01:47:13PM +1000, David Gibson wrote: > On Tue, Apr 28, 2026 at 09:17:31AM +0200, Stefano Brivio wrote: > > On Tue, 21 Apr 2026 13:23:29 +1000 > > David Gibson wrote: > >=20 > > > FLAGS was introduced over the more standard CFLAGS, because there are= some > > > options we can't compile without, so overriding CFLAGS from the comma= nd > > > line wasn't practical. We've now better dealt with that using > > > BASE_CPPFLAGS, so there's no real need for FLAGS any more. Replace it > > > with the more conventional CFLAGS, which now *can* be reasonable over= ridden > > > from the command line. > > >=20 > > > Signed-off-by: David Gibson > > > --- > > > Makefile | 21 ++++++++++----------- > > > test/build/build.py | 4 ++-- > > > 2 files changed, 12 insertions(+), 13 deletions(-) > > >=20 > > > diff --git a/Makefile b/Makefile > > > index e89e5556..1e5f0282 100644 > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -36,8 +36,8 @@ BASE_CPPFLAGS :=3D -D_XOPEN_SOURCE=3D700 -D_GNU_SOU= RCE \ > > > -DVERSION=3D\"$(VERSION)\" > > > CPPFLAGS :=3D $(FORTIFY_FLAG) -DDUAL_STACK_SOCKETS=3D$(DUAL_STACK_SO= CKETS) > > > =20 > > > -FLAGS :=3D -Wall -Wextra -Wno-format-zero-length -Wformat-security > > > -FLAGS +=3D -pedantic -std=3Dc11 -O2 -pie -fPIE > > > +WARNINGS =3D -Wall -Wextra -Wno-format-zero-length -Wformat-security > > > +CFLAGS =3D -pedantic -std=3Dc11 -O2 -pie -fPIE $(WARNINGS) > > > =20 > > > PASST_SRCS =3D arch.c arp.c bitmap.c checksum.c conf.c dhcp.c dhcpv6= =2Ec \ > > > epoll_ctl.c flow.c fwd.c fwd_rule.c icmp.c igmp.c inany.c iov.c ip.= c \ > > > @@ -66,7 +66,7 @@ ifeq ($(shell printf "$(C)" | $(CC) -S -xc - -o - >= /dev/null 2>&1; echo $$?),0) > > > endif > > > =20 > > > ifeq ($(shell :|$(CC) -fstack-protector-strong -S -xc - -o - >/dev/n= ull 2>&1; echo $$?),0) > > > - FLAGS +=3D -fstack-protector-strong > > > + CFLAGS +=3D -fstack-protector-strong > > > endif > > > =20 > > > prefix ?=3D /usr/local > > > @@ -85,7 +85,7 @@ endif > > > =20 > > > all: $(BIN) $(MANPAGES) docs > > > =20 > > > -static: FLAGS +=3D -static > > > +static: CFLAGS +=3D -static > > > static: CPPFLAGS +=3D -DGLIBC_NO_STATIC_NSS > > > static: clean all > > > =20 > > > @@ -96,12 +96,11 @@ seccomp_repair.h: seccomp.sh $(PASST_REPAIR_SRCS) > > > @ ARCH=3D"$(TARGET_ARCH)" CC=3D"$(CC)" ./seccomp.sh seccomp_repair.= h $(PASST_REPAIR_SRCS) > > > =20 > > > passt: $(PASST_SRCS) $(HEADERS) > > > - $(CC) $(FLAGS) $(CFLAGS) $(BASE_CPPFLAGS) $(CPPFLAGS) $(PASST_SRCS)= -o passt $(LDFLAGS) > > > + $(CC) $(CFLAGS) $(BASE_CPPFLAGS) $(CPPFLAGS) $(PASST_SRCS) -o passt= $(LDFLAGS) > > > =20 > > > -passt.avx2: FLAGS +=3D -Ofast -mavx2 -ftree-vectorize -funroll-loops > > > +passt.avx2: CFLAGS +=3D -Ofast -mavx2 -ftree-vectorize -funroll-loops > > > passt.avx2: $(PASST_SRCS) $(HEADERS) > > > - $(CC) $(filter-out -O2,$(FLAGS)) $(CFLAGS) $(BASE_CPPFLAGS) $(CPPFL= AGS) \ > > > - $(PASST_SRCS) -o passt.avx2 $(LDFLAGS) > > > + $(CC) $(CFLAGS) $(BASE_CPPFLAGS) $(CPPFLAGS) $(PASST_SRCS) -o passt= =2Eavx2 $(LDFLAGS) > > > =20 > > > passt.avx2: passt > > > =20 > > > @@ -109,16 +108,16 @@ pasta.avx2 pasta.1 pasta: pasta%: passt% > > > ln -sf $< $@ > > > =20 > > > qrap: $(QRAP_SRCS) passt.h > > > - $(CC) $(FLAGS) $(CFLAGS) $(BASE_CPPFLAGS) $(CPPFLAGS) -DARCH=3D\"$(= TARGET_ARCH)\" $(QRAP_SRCS) -o qrap $(LDFLAGS) > > > + $(CC) $(CFLAGS) $(BASE_CPPFLAGS) $(CPPFLAGS) -DARCH=3D\"$(TARGET_AR= CH)\" $(QRAP_SRCS) -o qrap $(LDFLAGS) > > > =20 > > > passt-repair: $(PASST_REPAIR_SRCS) seccomp_repair.h > > > - $(CC) $(FLAGS) $(CFLAGS) $(BASE_CPPFLAGS) $(CPPFLAGS) $(PASST_REPAI= R_SRCS) -o passt-repair $(LDFLAGS) > > > + $(CC) $(CFLAGS) $(BASE_CPPFLAGS) $(CPPFLAGS) $(PASST_REPAIR_SRCS) -= o passt-repair $(LDFLAGS) > > > =20 > > > valgrind: EXTRA_SYSCALLS +=3D rt_sigprocmask rt_sigtimedwait rt_siga= ction \ > > > rt_sigreturn getpid gettid kill clock_gettime \ > > > mmap|mmap2 munmap open unlink gettimeofday futex \ > > > statx readlink > > > -valgrind: FLAGS +=3D -g > > > +valgrind: CFLAGS +=3D -g > > > valgrind: CPPFLAGS +=3D -DVALGRIND > > > valgrind: all > > > =20 > > > diff --git a/test/build/build.py b/test/build/build.py > > > index e3de8305..7c9cbb44 100755 > > > --- a/test/build/build.py > > > +++ b/test/build/build.py > > > @@ -60,7 +60,7 @@ def test_make(target: str, expected_files: list[str= ]) -> None: > > > with clone_sources(): > > > for p in ex_paths: > > > assert not p.exists(), f"{p} existed before make" > > > - sh(f'make {target} CFLAGS=3D"-Werror"') > > > + sh(f'make {target}') > > > for p in ex_paths: > > > assert p.exists(), f"{p} wasn't made" > > > sh('make clean') > > > @@ -90,7 +90,7 @@ def test_install_uninstall() -> None: > > > progs =3D ['passt', 'pasta', 'qrap'] > > > =20 > > > # Install > > > - sh(f'make install CFLAGS=3D"-Werror" prefix=3D{prefix}') > > > + sh(f'make install prefix=3D{prefix}') > >=20 > > Here, and above: I don't understand what (if anything) implies -Werror > > now. >=20 > Ah, oops. I misread the -Werror in test/Makefile, thinking it was in > Makefile and applied to everything. I think the right fix is to put > -Werror in the default CFLAGS and remove it from here. Sorry, to cclarify. Just leaving build.py as is doesn't work because with the other changes in thie patch, setting CFLAGS here now replaces the default CFLAGS. That removes -O, but the default CPPFLAGS still has -D_FORTIFY_SOURCE, which causes warnings if optimization is off. So, we could also fix this by adding -O to the build.py options or in several other ways. I think using -Werror by default is useful in other ways, and I think it makes some sense for build.py to check that things build using the default options. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --BfT6hq74NK974V/A Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmnxkKUACgkQzQJF27ox 2GeWWA/8CqG/VIbUfk9jDi1zZiHDl20bSc/Uv8W1jhvNU34Fg0qQz0L0z01crPV2 GDsNwt+xTVUmvGgZ5Nah6dmSTCIg0GawPGxikmboqvhdtb97Aodova5rUbpGR2X7 XUDAyhOwzVE+CNxZU03hYRPxysckvUKYV2aXaQZWtaJU96o/RHYx7dUyA7FATVLc aye/iaPe4+ybYYXYXDgZrQKufDFTlaA39WePPdHGIrEFDBg1Wk25JP2JPT5Kpn/h NHPOHhYk7Oi3fQByi5wDAo4d3zEG16PFPwMg8qEDPMtLgbTtfkHTW+S99+krYKdI AJrqCPuXsxxiamtK35hHQZ0n0D5jSgJMAIJZw65IkIENCwk89Pu73jIB636g63sV v88F+UxS2d4Ov0QJR4GLwchj1p7PEc0YS5QqwlTDYopjCm8jOAapQmtaBAwZO2XL bJPPCFc8x6usQoZ8cD2eCoSeq0L42ALJbFLXbhXbwy2x3pxAdGzdYqSmhJwRFFzr 8hm0JMkzFeBLYbQwnHyc+dBWK673BrlriClfZWRPXbbFa8Kvxhavponua7McIfOM osba54REkkA73xG/RMKljNEObITtbKUjT3huYqRRRDNEDwVoH26lvw5gyjgBLzeW n7jbZVvWnTc7q+Pt3BHmNDab2mIyAlvoSs4uCA2kMpY26Q2r5fQ= =c/NC -----END PGP SIGNATURE----- --BfT6hq74NK974V/A--