From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id C01F7384A01D for ; Mon, 19 Oct 2020 15:55:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C01F7384A01D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sebastian.huber@embedded-brains.de Received: from sslproxy02.your-server.de ([78.47.166.47]) by dedi548.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1kUXVb-0003oY-2x for newlib@sourceware.org; Mon, 19 Oct 2020 17:55:39 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy02.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1kUXVb-000Xhc-0i for newlib@sourceware.org; Mon, 19 Oct 2020 17:55:39 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id B78E92A1686 for ; Mon, 19 Oct 2020 17:54:26 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ivW4BpFToAm2 for ; Mon, 19 Oct 2020 17:54:26 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 590622A165B for ; Mon, 19 Oct 2020 17:54:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 2JLAtPc7Rz-x for ; Mon, 19 Oct 2020 17:54:26 +0200 (CEST) Received: from linux-diu0.suse (unknown [192.168.96.161]) by mail.embedded-brains.de (Postfix) with ESMTP id 3E2E32A1682 for ; Mon, 19 Oct 2020 17:54:26 +0200 (CEST) From: Sebastian Huber To: newlib@sourceware.org Subject: [PATCH 3/5] gcc: quiet Wattribute for no_sanitize("address") Date: Mon, 19 Oct 2020 17:55:35 +0200 Message-Id: <20201019155537.15290-4-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201019155537.15290-1-sebastian.huber@embedded-brains.de> References: <20201019155537.15290-1-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.102.4/25962/Mon Oct 19 15:57:02 2020) X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2020 15:55:43 -0000 From: rlibby This is an unfortunate instance where the __has_attribute check does not function usefully. Gcc does have the attribute, but for gcc it only applies to functions, not variables, and trying to apply it to a variable generates Wattribute. So far we only apply the attribute to variables. Only enable the attribute for clang, for now. Reviewed by: Anton Rang Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22875 --- newlib/libc/include/sys/cdefs.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cd= efs.h index 1f2ce063d..1be994ffd 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -709,8 +709,12 @@ /* Function should not be analyzed. */ #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) =20 -/* Function or variable should not be sanitized, ie. by AddressSanitizer= */ -#if __has_attribute(no_sanitize) +/* + * Function or variable should not be sanitized, i.e. by AddressSanitize= r. + * GCC has the nosanitize attribute, but as a function attribute only, a= nd + * warns on use as a variable attribute. + */ +#if __has_attribute(no_sanitize) && defined(__clang__) #define __nosanitizeaddress __attribute__((no_sanitize("address"))) #else #define __nosanitizeaddress --=20 2.26.2