From patchwork Mon Sep 11 23:09:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Burgess X-Patchwork-Id: 18983 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D9A5FBE080 for ; Mon, 11 Sep 2023 23:09:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2881D628F2; Tue, 12 Sep 2023 01:09:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1694473759; bh=j7r1fndHzVuZlj6VooC4IZqwEwAQ+wkoddemPJtR7VI=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=BE7F1O5IKQDDkyzxeSX22i6uJ0BDWklKSKaddAbua9/hWOYqO+6bsadB6ej5nX+SW ggBJf0wV+VbJWvOStVimzjF3naVMq7kyJULoIBiVt5HEWtItLoDGOitQDVKYKii8hS Dw3OC5JZDWkbYJd2gjpNELAvHPSw1iaYWunfyG7X0TyOmXWGz2PGScj+ntm5Pozehe XQrEEmybWVf4jm4t2OpR9U6werGhheGSZrrnkuyAmC8LF7Y321XHTRsvjxfpU3SLwA atQ84TXxteb1a1yoqG9Iwq/wZq9lR326ZqXgf63dYeH+ww5aXiJybigoELWf5c9/Bo 9h7wGHLY62FiA== Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C1DF61DF4 for ; Tue, 12 Sep 2023 01:09:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="ZzPYhVZJ"; dkim-atps=neutral Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d807e997f91so2111197276.3 for ; Mon, 11 Sep 2023 16:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694473756; x=1695078556; darn=lists.libcamera.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=LXSGmB1dX+lIWWKMojbf1lcaEpbumeMMG/bLOSHdU34=; b=ZzPYhVZJCAWxkbd1n15/IhgO4oAGuGOwfZNt1Ccrb9ffSIWWYRe3waL579OWMdE7d0 7JiG5TH/Er1Ah8XDssFQnPpdiW0uj4NJF6AOIgm6Ckio+3h+C4MBw0I4SglEm/JM3GFv do5vWEb/+72DpjbqBbT8PGmmX1pDaf/Spov4oV2+fwonDFKyv6t/AmS9z7vpEkqD2pNb XukhtM/SBa5Vbk0igrey78029+irys+mMnqAifOL8qBh+yU+M3cGdkecM8pnN7F3lfC9 oOl+DL0sm31UOHJ/D4KBmpplwOIHg7ISPna+nGC9EyERqhev8x+OVwmuqEr3MOgOc7AX kVKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694473756; x=1695078556; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LXSGmB1dX+lIWWKMojbf1lcaEpbumeMMG/bLOSHdU34=; b=NtcI98NUnZpnIxaZY78ElTUm52X2uMGbvXYQRnBkS/Wyh4nveUn40U7ICGCIUpXJ9x BBF+RFZp3QNmQHPsSXFJUm3F7Ql0M5RGMyUdCSkh+pBA/QTTi9g2goaY//PYUjGiFrC7 DnYCXprreIHccLRYOMxTW5vW/VK46h67HlGl0ye20lCZjgpOCy3k95lOSgkHwS0XmNca X7ObwnD6YHF0gNQojyO7WEsx4TTCELDvro2KqeWEu34j4BIiwi6xoXK70iU+fMIzK36W RgNmThpiewEhupKUi/oCJvBQ9ALoSkda5tVePlwD/uldxwe2MJBT3DiHb3aGtKsgJMXR LK6g== X-Gm-Message-State: AOJu0YwQFkhYKinuArfpXEXrap2JidK3wc9MsX6P9MAG5sfBC8hMICp0 RJka4+Hb/FX/MISxpFyZFEZdnBbddxJRjmOdV8qbQ/atfG9a4sMLSI5BY8X6isso2+g2TtGhymB VoQRB3AYFSK78LQmm2jbULJwk/gpelFsn6EtK59JW9PMKEg4e7jp1ma8Lsjpra4356bFqlnr3+A == X-Google-Smtp-Source: AGHT+IGHa7JD2qRYp68CEhsZ/i9QDpWU5VYXdxT0RuPyPFnoZ2lPDpW4prmSv494F3MaEgOq4XGzzkmM X-Received: from gbivco.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22d5]) (user=gbiv job=sendgmr) by 2002:a25:a1ca:0:b0:d78:2c3:e633 with SMTP id a68-20020a25a1ca000000b00d7802c3e633mr232327ybi.2.1694473755901; Mon, 11 Sep 2023 16:09:15 -0700 (PDT) Date: Mon, 11 Sep 2023 17:09:07 -0600 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog Message-ID: <20230911230909.1263308-1-gbiv@google.com> To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v2] meson: Don't set _FORTIFY_SOURCE for ChromeOS X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: George Burgess IV via libcamera-devel From: George Burgess Reply-To: George Burgess IV Cc: George Burgess IV Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" ChromeOS is moving to a platform default of `_FORTIFY_SOURCE=3`, and this definition conflicts with that: :4:9: error: '_FORTIFY_SOURCE' macro redefined [-Werror,-Wmacro-redefined] Rather than adding logic to keep up with their local configuration, it seems best to leave setting _FORTIFY_SOURCE on ChromeOS up to ChromeOS. Signed-off-by: George Burgess IV Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- meson.build | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 7959b538..2e834263 100644 --- a/meson.build +++ b/meson.build @@ -99,12 +99,26 @@ if cc.get_id() == 'clang' error('clang version is too old, libcamera requires 9.0 or newer') endif - # Turn _FORTIFY_SOURCE by default on optimised builds (as it requires -O1 - # or higher). This is needed on clang only as gcc enables it by default. + # Turn _FORTIFY_SOURCE by default on. This is needed on clang only as gcc + # enables it by default. FORTIFY will not work properly with `-O0`, and may + # result in macro redefinition errors if the user already has a setting for + # `-D_FORTIFY_SOURCE`. Do not enable FORTIFY in either of those cases. if get_option('optimization') != '0' - common_arguments += [ - '-D_FORTIFY_SOURCE=2', - ] + has_fortify_define = false + # Assume that if the user requests a FORTIFY level in cpp_args, they + # do the same for c_args. + foreach flag : get_option('cpp_args') + if flag == '-U_FORTIFY_SOURCE' + has_fortify_define = false + elif flag.startswith('-D_FORTIFY_SOURCE=') + has_fortify_define = true + endif + endforeach + if not has_fortify_define + common_arguments += [ + '-D_FORTIFY_SOURCE=2', + ] + endif endif # Use libc++ by default if available instead of libstdc++ when compiling