From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=edp2Nf/r; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id D45C15A0271 for ; Wed, 13 May 2026 09:11:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778656265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QXOVDiDTtLB4ACeJ/1uauN7bBVVfpVhy//JN+ZbooBA=; b=edp2Nf/rzorkm1WbTMlej+5xawAZ3x30vwfQYVwsrGP6j2aMIN4hMjnPbaQF4kMV1d5oVb LrRKDlHJaRua17tl+vOHQc6oplNYBQbRuszzl3B9ZepOF/KDuXdVquysanfitbHSeyZpuy ASV6lpzB97p9HV4fW7nAE4kFZHZQM4Y= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-373-eY9J9NAjNE6778DFQIlD6Q-1; Wed, 13 May 2026 03:11:03 -0400 X-MC-Unique: eY9J9NAjNE6778DFQIlD6Q-1 X-Mimecast-MFC-AGG-ID: eY9J9NAjNE6778DFQIlD6Q_1778656262 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-4411a2c034fso5786837f8f.3 for ; Wed, 13 May 2026 00:11:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778656262; x=1779261062; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QXOVDiDTtLB4ACeJ/1uauN7bBVVfpVhy//JN+ZbooBA=; b=D2a+LUyXqqFbJ4c/Echw3ByFY5l7rk6OL8J1nk1io1sTEtBEHhpuZk36ivCPZ77p+T Tn1yBiSZ9Nqr8J8Ms5wJsR3vFARWbLHFjJPD7cX//PJTDNBp1oQVAQgrFekZUuS1DNxi phbXMlvLYT84uzgZUL1HAWffvOpdpsl5dmZp+C0sktMExIcdI4ppXGlbI09Dx2hIStKL jPtdC7Ysxl+vYi/F/psDDR6gIRgoqCiFOMrOCnraHiWIyeMujn38UipYCDY6fwkTzwbf rRiPsaMA7isBz2Y9LNf/vdpeUZ3X1tmEUenC0GL8DKeoQRYJtgLzurGpIp5YLF5Cg/yR 9YvA== X-Gm-Message-State: AOJu0YxSXbXVPrykQyqwd4i5MMFASBWtJixBt0DzOXfhTrYzJxJjfgmc FgTMpE4bgVLkSdZ1dvwCu20Q3ofiKWHarOQ6LTOPrAZmHCHXlp6esupI/WEOErST4uu2AdRigKN cmHfWfLhKw3erYGnnVAfL+F1mbyBXln+m7KOJ3NGjS+gWTyU6gxcgPCFBu7uK7w== X-Gm-Gg: Acq92OEBDJci6xHQcmqAEpVO/E7CkF3BAcTcbxFC6ggn7hKVSq9Pn+0HMgkKSlBtTOP 9lwlnUskO3ugRstEl3CIlBoSAa6lJ4O85hjajANVqLjwgxOiUZGU6ykhL9FEKUe2PSZwETr8oNB KVn5mKa9yikEbsy1O9eSiGcrO6yXx71e8IPDXrB8PPX9J4c9chbK5gOyw5FUre7E6CWD42SCxw3 rlCBMbJ3xxtxKT+5ysu93kQJSWYhm8jgtnbUPGl+vUqJ2rfgs5koquoLHDMIsl5Z9gAZt+Rq/Qc EqvO3WURnrHtN3u/Gi6S2nf1eONPFeETMLuTFeZ2ZJCo/FK3FlqjTLDh2HVk8RR5ukyZnZAmkMj jpr5TFGl7QN5SplfVTE+iyFmEt83226jj/NShYPUPri93bWpQyQ== X-Received: by 2002:a05:6000:1847:b0:455:4288:6c34 with SMTP id ffacd0b85a97d-45c5a0b17bfmr2765868f8f.24.1778656261791; Wed, 13 May 2026 00:11:01 -0700 (PDT) X-Received: by 2002:a05:6000:1847:b0:455:4288:6c34 with SMTP id ffacd0b85a97d-45c5a0b17bfmr2765778f8f.24.1778656261196; Wed, 13 May 2026 00:11:01 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45491304505sm38519102f8f.22.2026.05.13.00.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 00:11:00 -0700 (PDT) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v3 06/12] Makefile: Split $(FLAGS) into cpp and cc components Message-ID: <20260513091059.051d41c5@elisabeth> In-Reply-To: <20260512055256.1800449-7-david@gibson.dropbear.id.au> References: <20260512055256.1800449-1-david@gibson.dropbear.id.au> <20260512055256.1800449-7-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Wed, 13 May 2026 09:11:00 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: azlL_yTmHPJz4D1uQCKPgOwKbh6DmoLFNVJKrhz3BN4_1778656262 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 5JUMIZKE6BPQB4AYZ5CRZLGTDCXGK2NA X-Message-ID-Hash: 5JUMIZKE6BPQB4AYZ5CRZLGTDCXGK2NA X-MailFrom: sbrivio@redhat.com 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: On Tue, 12 May 2026 15:52:50 +1000 David Gibson wrote: > The $(FLAGS) variable contains mandatory compiler flags that should not be > overridden. However, it contains a mixture of flags for the preprocessor > and for the compiler proper. That's causing some inconvenience for other > Makefile cleanups, so split it into $(BASE_CPPFLAGS) and $(BASE_CFLAGS) > variables. > > Signed-off-by: David Gibson > --- > Makefile | 40 ++++++++++++++++++++++++---------------- > 1 file changed, 24 insertions(+), 16 deletions(-) > > diff --git a/Makefile b/Makefile > index a8f8d06e..697f229f 100644 > --- a/Makefile > +++ b/Makefile > @@ -30,12 +30,17 @@ ifeq ($(shell $(CC) -O2 -dM -E - < /dev/null 2>&1 | grep ' _FORTIFY_SOURCE ' > / > FORTIFY_FLAG := -D_FORTIFY_SOURCE=2 > endif > > -FLAGS := -Wall -Wextra -Wno-format-zero-length -Wformat-security > -FLAGS += -pedantic -std=c11 -D_XOPEN_SOURCE=700 -D_GNU_SOURCE > -FLAGS += $(FORTIFY_FLAG) -O2 -pie -fPIE > -FLAGS += -DPAGE_SIZE=$(shell getconf PAGE_SIZE) > -FLAGS += -DVERSION=\"$(VERSION)\" > -FLAGS += -DDUAL_STACK_SOCKETS=$(DUAL_STACK_SOCKETS) > +# Mandatory preprocessor flags that won't be overridden with $(CPPFLAGS) > +# FIXME: Could some of these be default, rather than required? > +BASE_CPPFLAGS := -D_XOPEN_SOURCE=700 -D_GNU_SOURCE $(FORTIFY_FLAG) > +BASE_CPPFLAGS += -DPAGE_SIZE=$(shell getconf PAGE_SIZE) > +BASE_CPPFLAGS += -DVERSION=\"$(VERSION)\" > +BASE_CPPFLAGS += -DDUAL_STACK_SOCKETS=$(DUAL_STACK_SOCKETS) > + > +# Mandatory compiler flags that won't be overridden with $(CFLAGS) > +# FIXME: Could some of these be default, rather than required? > +BASE_CFLAGS := -std=c11 -pie -fPIE -O2 > +BASE_CFLAGS += -pedantic -Wall -Wextra -Wno-format-zero-length -Wformat-security This new version of the series looks good to me in general (minus potential concern reported below), and everything seems to work on Debian and Fedora, but I would still like to try things out on Alpine or Void Linux because musl might cause surprises. I haven't got to it yet. Meanwhile, regarding these FIXME comments: I think it *is* currently possible to override those flags (with different values for the same options), and overriding -D_FORTIFY_SOURCE on openSUSE (I haven't tried right now) was the initial motivation behind FLAGS. That is, the overriding role of CFLAGS seems to be preserved for these BASE_* flags as well, because $CFLAGS is given to the compiler after $BASE_CPPFLAGS, $CPPFLAGS, and $BASE_CFLAGS. So, in this sense, I would already call them "default" flags. If that's the case, I think it's fine. Otherwise we need to find another solution at least for the short term. By the way, if it helps addressing those comments at some point (I would apply anyway this series meanwhile if I don't find breakages, because not being able to run static checkers automatically on pesto is pretty nasty), out of those flags: * -D_XOPEN_SOURCE, -D_GNU_SOURCE, and -DPAGE_SIZE are strictly required to build (at least in some environments) * -D_FORTIFY_SOURCE, -pie, -fPIE are not required to build but they are critical for security * -DVERSION is not required to build but makes things confusing and issues hard to debug because the version (usually supplied by the distribution) isn't reported in logs and logs of other tools - -DDUAL_STACK_SOCKETS doesn't seem to be used anymore starting from commit b8d4fac6a2e7 ("util, pif: Replace sock_l4() with pif_sock_l4()")... was it intended, actually? - -std=c11 is strictly required to ensure we build things correctly - -O2 is optional, but dropping it (by default) might require annoying adjustments in distributions - -pedantic, -Wall, -Wextra, -Wno-format-zero-length, -Wformat-security are all optional and useful for development (including distribution development), and might be security relevant in some cases -- Stefano