From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 5BD845A005E for ; Tue, 15 Nov 2022 10:22:12 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4NBLKr3VW5z4xZ3; Tue, 15 Nov 2022 20:22:08 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1668504128; bh=ai9M/IlzSYzJ2WRREQ6UaU2K9Oh/1eObsdt8qOIdWaU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k7VS8jUQZrYvWhWEtO0gFy/UxX8HcCl80Mi4/etDn3V1GZeImdGaXbBq2eJkPlvY+ j8FZkBEkpcwR6h59/Loj8Wx0qRFcGHL04YnTZSDI1YpL+dT82alDrzSBlMZLnJIhO7 Zr6jhNgD998rSMQiWkDFBBhFq8WpOeimwoOUhM1U= Date: Tue, 15 Nov 2022 16:00:24 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 1/8] Makefile: Honour passed CPPFLAGS, not just CFLAGS Message-ID: References: <20221115012349.2240096-1-sbrivio@redhat.com> <20221115012349.2240096-2-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="44j7OPRt1aC4c11q" Content-Disposition: inline In-Reply-To: <20221115012349.2240096-2-sbrivio@redhat.com> Message-ID-Hash: X6L6IQJCTQTIJ46L6I3CFWECPIJN3Q2Q X-Message-ID-Hash: X6L6IQJCTQTIJ46L6I3CFWECPIJN3Q2Q 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.3 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: --44j7OPRt1aC4c11q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 15, 2022 at 02:23:42AM +0100, Stefano Brivio wrote: > CPPFLAGS allow the user to pass pre-processor flags. This is unlikely > to be needed at the moment, but the Debian Hardening Walkthrough > reasonably requests it to be handled in order to fully support > hardened build flags: > https://wiki.debian.org/HardeningWalkthrough#Handling_dpkg-buildflags_i= n_your_upstream_build_system >=20 > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson Possible refinement, though: if we moved our own flags which are really for the preprocessor (-D*) to CPPFLAGS, then we can probably pass just CPPFLAGS, not CFLAGS to the static checkers and avoid the ugly filter/filter-out expressions. > --- > Makefile | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) >=20 > diff --git a/Makefile b/Makefile > index 6b22408..a6e3164 100644 > --- a/Makefile > +++ b/Makefile > @@ -60,8 +60,8 @@ HEADERS =3D $(PASST_HEADERS) seccomp.h > # csum_unaligned(). Mark csum_unaligned() as "noipa" as a quick work-aro= und, > # while we figure out if a corresponding gcc issue has already been repo= rted. > ifeq (,$(filter-out 11 12, $(shell $(CC) -dumpversion))) > -ifneq (,$(filter -flto%,$(FLAGS) $(CFLAGS))) > -ifneq (,$(filter -O2,$(FLAGS) $(CFLAGS))) > +ifneq (,$(filter -flto%,$(FLAGS) $(CFLAGS) $(CPPFLAGS))) > +ifneq (,$(filter -O2,$(FLAGS) $(CFLAGS) $(CPPFLAGS))) > FLAGS +=3D -DTCP_HASH_NOINLINE > FLAGS +=3D -DSIPHASH_20B_NOINLINE > FLAGS +=3D -DCSUM_UNALIGNED_NO_IPA > @@ -121,11 +121,11 @@ seccomp.h: seccomp.sh $(PASST_SRCS) $(PASST_HEADERS) > @ EXTRA_SYSCALLS=3D"$(EXTRA_SYSCALLS)" ./seccomp.sh $(PASST_SRCS) $(PAS= ST_HEADERS) > =20 > passt: $(PASST_SRCS) $(HEADERS) > - $(CC) $(FLAGS) $(CFLAGS) $(PASST_SRCS) -o passt $(LDFLAGS) > + $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(PASST_SRCS) -o passt $(LDFLAGS) > =20 > passt.avx2: FLAGS +=3D -Ofast -mavx2 -ftree-vectorize -funroll-loops > passt.avx2: $(PASST_SRCS) $(HEADERS) > - $(CC) $(filter-out -O2,$(FLAGS) $(CFLAGS)) \ > + $(CC) $(filter-out -O2,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \ > $(PASST_SRCS) -o passt.avx2 $(LDFLAGS) > =20 > passt.avx2: passt > @@ -134,7 +134,7 @@ pasta.avx2 pasta.1 pasta: pasta%: passt% > ln -s $< $@ > =20 > qrap: $(QRAP_SRCS) passt.h > - $(CC) $(FLAGS) $(CFLAGS) $(QRAP_SRCS) -o qrap $(LDFLAGS) > + $(CC) $(FLAGS) $(CFLAGS) $(CPPFLAGS) $(QRAP_SRCS) -o qrap $(LDFLAGS) > =20 > valgrind: EXTRA_SYSCALLS +=3D rt_sigprocmask rt_sigtimedwait rt_sigactio= n \ > getpid gettid kill clock_gettime mmap \ > @@ -283,7 +283,7 @@ clang-tidy: $(SRCS) $(HEADERS) > -concurrency-mt-unsafe,\ > -readability-identifier-length \ > -config=3D'{CheckOptions: [{key: bugprone-suspicious-string-compare.War= nOnImplicitComparison, value: "false"}]}' \ > - --warnings-as-errors=3D* $(SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS= )) > + --warnings-as-errors=3D* $(SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS= ) $(CPPFLAGS)) > =20 > SYSTEM_INCLUDES :=3D /usr/include $(wildcard /usr/include/$(TARGET)) > ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"),1) > @@ -299,5 +299,5 @@ cppcheck: $(SRCS) $(HEADERS) > $(SYSTEM_INCLUDES:%=3D--suppress=3DunmatchedSuppression:%/*) \ > --inline-suppr \ > --suppress=3DunusedStructMember \ > - $(filter -D%,$(FLAGS) $(CFLAGS)) \ > + $(filter -D%,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \ > . --=20 David Gibson | 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 --44j7OPRt1aC4c11q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoULxWu4/Ws0dB+XtgypY4gEwYSIFAmNzHOEACgkQgypY4gEw YSKPcg//e0p18cqBsm5KMAu8o8cNj0V9Yvwui0z60eSOyUMNTiT7+KTjoKetokF/ NT0YEcoOI92SbjzYba6kbv67HVLKAgd6SpNR4auYZq6o1x+tqNA/x3qm4OfsROgT KcYHudCjv5UYbBoW6lQuX+U7EBjgTBq5cixF4Yid5JrH7DyPArqRcyFLoKelTolw tnFzgq4dENZJRMUxUODOhT5QOqOvV5QwFpwQzYXZG8vsvsmIbMTU4pb+MG6d7h3x M8NBgIbQGv1B/w7jhYMevQUvDnEv31VBU8VSnP+2jocxmsaZn9oZPmvHcemq3yko s/DQVrfFl/pBO4vUOCz8E3cC96xoK13h4DBK+8SXDKDFMlVC1aMOYIp+eTMDT7yv dH+J7QBsr09eyexd+sLVdglHqmfX8TwG5CO0iz4Wrqf1xn2U62IBr0KPHVgHyDgB bwlYq4GGk5MN+2qru5z11uPREf/Cxghu7lCMGVYAMWn1sz2iOC8xprWMZ+0g8OKJ PNpNF5h73LkBogAJt7hUTTRDQ6tM7PyhgFOI9gpFIA4/A40ii4+1eB8sW+WcEq2k 7sDgO/WQdRQzVbRT0YgdRBXDEsvB4Qn+JqSTxaLR3kAbX+Ymb6URMbkd9HyG1U7U u7fejrTGMpzw3yT5KljaUvx+qX8v7Y4f5eHHzRU2NEvoDCeYgwk= =EYgP -----END PGP SIGNATURE----- --44j7OPRt1aC4c11q--