Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1256160lqj; Mon, 3 Jun 2024 15:43:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7VhadI3/mgQ6cIlNjriTDoI375HdLZxXeFxaiykRyBLXakF6wvStUWJhmRZkMvHcKKNklx/eIXUAKyn05ErMnmYg1xwYxAp11TzISzA== X-Google-Smtp-Source: AGHT+IFrglYwTcMge4n+2DdXmQRYiC3zrPYuNaZVGMIapLhchasQ17rv6qpBFtXa+qEEvHb5vrFj X-Received: by 2002:a05:6a21:9993:b0:1b2:2893:4c2a with SMTP id adf61e73a8af0-1b26f17dbbdmr11596162637.5.1717454620219; Mon, 03 Jun 2024 15:43:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717454620; cv=pass; d=google.com; s=arc-20160816; b=GiHdQ+mIIAjaU7s9ExMWYEM3UP6otLAWw9SSar/bCr07IC3EuoZaYKvO1vngCjaMTd 5xsTgRTmykzRIeyotAQ4gnd1zY750J/fH5fkucTn2poIuDCfkbOqh7ZFpiy8ZOlBoThg oVMAN4DZC9XbEaC0Em+ZIAn7j4YGf92mybCJFagLq6+MwX7XTaEHBSwBRXFRizfoJO5C uufoFrIceioPBw2mmPx3CZy5u+YZ4z05kQOMgSnRIqYJyggxd62T9aEubR31pggNH8Oz rbt/7q5UqN4hiffYaFub+dWE3vv0iolQOGXNAEes57F4aSdt4JKPFgIFzkJ97vNIGgfJ 6Svw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+ItzxCc7dxxlj0OiqX1nFa5IK+6fcMZ3EVnNMWL4mpo=; fh=n3d9c0DAe079qv40NmUfVNZ6k80Is2VpzgjHO/i/jzs=; b=Ca+KgGAvotBHzqBVFfAMmS3/GQ+s+B9YXNvhO+iRONS1EKaQG4ktKbtmKRpPkB9SYg 8+xC3hfe7yiX5hjpmTp6d1yQzpr2jQakWlBfiJsdO63F3o9+J+e2XkgkYu1GWUeZx/tE tgX4WIRDTol8ENmfeePhxaLRaGRLrBb1MmysLVUx/9ty8a/uOwDgLbRj8HTP39Z4R0xh ZN7SyzUxs7UqD6hTbu5GVkVRZw6SVIX+VU0exZuuHoPBe/WaQIYJHNpLSzrXg5Q5XkHY rjBWRwRPj9zsOsQZ06ESOYfs+La3ZglfoFntOKYVnRuP1zCrunOqzRVb0B+FfPrS7mU7 1CFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aoepBxpF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-199783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199783-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70242c62adasi655497b3a.304.2024.06.03.15.43.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 15:43:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aoepBxpF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-199783-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199783-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 26BB2284FFD for ; Mon, 3 Jun 2024 22:42:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7224B13D533; Mon, 3 Jun 2024 22:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aoepBxpF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9464A13D24F; Mon, 3 Jun 2024 22:39:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717454379; cv=none; b=VH3na866c1goF+J0OkNDAZxQFZXTSCg7oYNCKrSdamwRLrvhlgVRAVS6y54kHVJwxEY7CKdTWIKfrzIGJG1ZPpxhZFcHVx8eujosdbc1DGXIMtgutRBLoZ97YYspbC8xQmD9hs9JxmHH+bRr534JUv1AYworB1FNOo7AiNhIN5g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717454379; c=relaxed/simple; bh=0LLQ5lJZ6hnYFLe6WYRyFDFSE/8SfEOMOLofPf58dFA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PPCQ2kedPEV7ANqFSjqldetKMqFg8ANSxLaJwZcXgBH/bWM9/2t1dOFpDXU1GRyURr58GDaGgu8E6v9dD6wsdFQ4cdOgCZ4yuKNOm/BLhmiPmR5wAjAF3gRCjojr12crRTrGg5HXb091zgY9VlCoqDMJr0HHQTbWCczAExtMD/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aoepBxpF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6542DC2BD10; Mon, 3 Jun 2024 22:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717454379; bh=0LLQ5lJZ6hnYFLe6WYRyFDFSE/8SfEOMOLofPf58dFA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aoepBxpFjr2LAhAoJKoYel6/6PvGXzK1S4ag/igyDvx9vH8rCGE7IIXvv73xV+uzp 78Kp9vASY84ZpXhgyxj2YjVTCJSiUnK0WHS0i4IsZZp9ch5KQN1dLdTTR2EGDVT5Ic VM7xTk6hHPbWh0mUhNCk3ufK6IeeT3Xvc+okI/W+zTWpKVq51kaz6vI5LUAMGjg4VT 2KDFb3SQBZmUOZzKv+1sDOe8Cbu2kfgws9rpaHGKJuQv7RQPmAvdcEbrqWX15uxS2c PPYC3f4dYDy3tecrIeaN0DgGoNsUxkKUZaRvXzTaXqqLyxarf6iXxqYQZNGxOtpJKW 7oup501SAYyog== Date: Mon, 3 Jun 2024 15:39:36 -0700 From: Nathan Chancellor To: John Hubbard Cc: Shuah Khan , Andrew Morton , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Maciej Wieczor-Retman , Ryan Roberts , Christian Brauner , Muhammad Usama Anjum , Alexey Gladkov , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev Subject: Re: [PATCH v2 2/2] selftests/fchmodat2: fix clang build failure due to -static-libasan Message-ID: <20240603223936.GF1802995@thelio-3990X> References: <20240601014534.268360-1-jhubbard@nvidia.com> <20240601014534.268360-3-jhubbard@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240601014534.268360-3-jhubbard@nvidia.com> On Fri, May 31, 2024 at 06:45:34PM -0700, John Hubbard wrote: > gcc requires -static-libasan in order to ensure that Address Sanitizer's > library is the first one loaded. However, this leads to build failures > on clang, when building via: > > make LLVM=1 -C tools/testing/selftests > > However, clang already does the right thing by default: it statically > links the Address Sanitizer if -fsanitize is specified. Therefore, > simply omit -static-libasan for clang builds. And leave behind a > comment, because the whole reason for static linking might not be > obvious. > > Cc: Ryan Roberts > Signed-off-by: John Hubbard Assuming that $(LLVM) is the correct conditional to test for: Reviewed-by: Nathan Chancellor > --- > tools/testing/selftests/fchmodat2/Makefile | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/fchmodat2/Makefile b/tools/testing/selftests/fchmodat2/Makefile > index 71ec34bf1501..4373cea79b79 100644 > --- a/tools/testing/selftests/fchmodat2/Makefile > +++ b/tools/testing/selftests/fchmodat2/Makefile > @@ -1,6 +1,15 @@ > # SPDX-License-Identifier: GPL-2.0-or-later > > -CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan $(KHDR_INCLUDES) > +CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined $(KHDR_INCLUDES) > + > +# gcc requires -static-libasan in order to ensure that Address Sanitizer's > +# library is the first one loaded. However, clang already statically links the > +# Address Sanitizer if -fsanitize is specified. Therefore, simply omit > +# -static-libasan for clang builds. > +ifeq ($(LLVM),) > + CFLAGS += -static-libasan > +endif > + > TEST_GEN_PROGS := fchmodat2_test > > include ../lib.mk > -- > 2.45.1 > >