From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B98CAC4345F for ; Wed, 17 Apr 2024 15:52:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38F956B008A; Wed, 17 Apr 2024 11:52:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3400B6B008C; Wed, 17 Apr 2024 11:52:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22E636B0092; Wed, 17 Apr 2024 11:52:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 061AA6B008A for ; Wed, 17 Apr 2024 11:52:42 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A7E31120ECC for ; Wed, 17 Apr 2024 15:52:42 +0000 (UTC) X-FDA: 82019466564.28.952F1C3 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf24.hostedemail.com (Postfix) with ESMTP id 8DF1A180015 for ; Wed, 17 Apr 2024 15:52:40 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713369161; a=rsa-sha256; cv=none; b=0Kv2CZYCBAjnA5hMiD3ha6vYvWPHRU99Mruncunbv21+2kOWBcxo9q1qk43npEniOUZ8sI 9fzdqQHhOBDjvlp/JQBe6LJd4rjPspPNtWLOdz2C7nA9H5MkGV2bOUopXb7UizMQ/jNP7a kznuy3J6LxKaEiJJJ/6T8oq0hGAN0Pw= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713369161; h=from:from:sender: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=5AoxUA4N7qNL4WCTj+4Dz+hsWzpr2cAhSAhYvutn/3I=; b=GavMkG7Cho3hY3q7KkialTikv1PXG1XLsH9hUWoz+t2GBZ+F6AZkTCpjHBHMpL3ECvunOK x3RqmkJb2S1c18x6upzXW7SG0YumkK3P4OndMMPEtwlVp3mMIAG4VCMNLQvFAmFoTxDjMQ /p8gIUiQfsmeg9StKSItqX7Hng8MAM8= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4185B339; Wed, 17 Apr 2024 08:53:07 -0700 (PDT) Received: from [10.1.37.181] (XHFQ2J9959.cambridge.arm.com [10.1.37.181]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 670BD3F792; Wed, 17 Apr 2024 08:52:38 -0700 (PDT) Message-ID: <28b20153-62d8-40f2-9305-60943696d4a1@arm.com> Date: Wed, 17 Apr 2024 16:52:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: clang: error: unknown argument '-static-libasan'; did you mean '-static-libsan'? Content-Language: en-GB To: Arnd Bergmann , kernel test robot Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Andrew Morton , llvm@lists.linux.dev, Linux Memory Management List References: <202404141807.LgsqXPY5-lkp@intel.com> <31b4e05d-62c6-44cd-8038-7ac8d21320c3@arm.com> <1f384d41-4c65-4efb-a171-26b54dacfb30@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8DF1A180015 X-Stat-Signature: 8x6a8y1h1tt4y1sxchq8in51t4ezd81x X-Rspam-User: X-HE-Tag: 1713369160-539879 X-HE-Meta: U2FsdGVkX19CzhmxXwImZuC+TEHcnTKVgsG6PIan7NouAHxvmZRBy/UNqN5lp8j0JuqihtUKQz4k5Muh8Gn/oqn1I1wXz6NHRGFVAAf0kcYh/E5Q8WQWGIigl2LBXP5z4XjU+8LDnwmCyc1e9AJhwpTIJe6UHC3Aiyntx3arOPsJMWfS/lpUmpxb0W+RQpiSijf5ZmCIPPivybwquCghL2mRuPgzGFpXlaBovjQxRLKYKseZi9K3DoIO7em6+1GKWUfEV/1zvb6hCwm+shhz5xu8r3UgGey8xZbfGfFMwKOzJZN4ra1aD/VTlWOg6M2aeGVnLeGOAPRh9B/12+oExp7pPD93UilzNgPVjFvtZHifipnoQmmUmYJk+BZwX8Kfqs804Vj2xPZKx7JS/X3N1RMuQTerr+mCKDhXr8jLaPAeXkTLncx+UjISBaBvawU6v/ekDmRW0hCQuKZR2k97ZOmzycHD6ceByVdGQ3ewz8FIBEKKE47Wr1xe/ocVVSMd87YC3P/HuRHC1b2D3qPbYTKHyaHjXUa1gjInJKK4MzsItZw6IAWiytgpIqV8GJhHuyMdJhhIHtiEnSjJ2IcWl5PNCgLAuWVcpG6Cr4E3Rdm53ZB3rhEowMy2a9S/Md4v9RGjgT2FghB6g7JB3CjvudarhYWJ2jk9S0XAVaJB86jd8wJnvT7bzzFiBlNYy11M/jYJZ/ugaXcC73aktC47iEPVxR83dwUuV33KcG5r/o+PxyGZwKD6FKH7iYo7eAlcScir8JcnMViBmH1Qz01E6kRiFNIY6JOalS/hw1eDkdITOx60+V+gUxc4d4PvLToPB6du2DOs7MfS6wo7N6ByRf2U1oOMGKTlyf2xbcrcLJMMaRN2qi3AfqR6Xbj9MfTrWsVlzLycUQNWge7GkBRSHoI949eR4Klw6ldC+AOIyrKtR+k6fCw7URoQNHuFk8ST8V1/d7vQW7ELeuYe3yy MGU2DX8b Q1cs2wlGXh95TCMtomKoSTfAoKp+YTpRWgrIgKjxbhGAGlymEJuBc/WS1e/e+SC1sTVqTskSYNYFAbyiiO/wmqX50TxMAK5S+lOHhKnTIveEASg5sdioVSTB8X2chjANg8fn50OM2kxAbK5fSoPhU3Ec/7TX59oWqdOiTJpEiCSANpTiHX89svzbfPhjYWwXNgdi+ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 17/04/2024 16:23, Arnd Bergmann wrote: > On Wed, Apr 17, 2024, at 17:11, Ryan Roberts wrote: >> On 16/04/2024 15:42, Arnd Bergmann wrote: >>> On Tue, Apr 16, 2024, at 16:33, Ryan Roberts wrote: >>> >>> I'm not entirely sure how much of the Kbuild infrastructure we >>> can rely on here. If the .config file gets included, this should >>> work: >> >> Thanks for the pointers. Unfortunately neither don't works as we don't have any >> of the Kbuild infrastructure. >> >> I'm not really sure what to do here. The best I've come up with so far is to >> just remove asan from these binaries. They are pretty simple selftests. I'm not >> sure its adding a whole lot of value anyway. >> >> Does anyone have any advice? >> > >>> Alternatively, if the cc-option macro is available, you could >>> try this one >>> >>> CFLAGS += $(call cc-option, -static-libasan) $(call cc-option, -static-libsan) > > I had another look at this and found example code in > tools/thermal/tmon/Makefile that you should be able to adapt. > Apparently the cc-option macro is not provided by default, but > there is a copy you can include: > > # We need this for the "cc-option" macro. > include ../../build/Build.include > WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int > override CFLAGS+= $(call cc-option,-O3,-O1) ${WARNFLAGS} > # Add "-fstack-protector" only if toolchain supports it. > override CFLAGS+= $(call cc-option,-fstack-protector-strong) Ahh thanks! That sorted it: diff --git a/tools/testing/selftests/fchmodat2/Makefile b/tools/testing/selftests/fchmodat2/Makefile index 71ec34bf1501..a68bb5a00797 100644 --- a/tools/testing/selftests/fchmodat2/Makefile +++ b/tools/testing/selftests/fchmodat2/Makefile @@ -1,6 +1,9 @@ # SPDX-License-Identifier: GPL-2.0-or-later +# We need this for the "cc-option" macro. +include ../../../build/Build.include -CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan $(KHDR_INCLUDES) +CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined $(KHDR_INCLUDES) +CFLAGS += $(call cc-option, -static-libasan) $(call cc-option, -static-libsan) TEST_GEN_PROGS := fchmodat2_test include ../lib.mk diff --git a/tools/testing/selftests/openat2/Makefile b/tools/testing/selftests/openat2/Makefile index 254d676a2689..02af9b6ca5eb 100644 --- a/tools/testing/selftests/openat2/Makefile +++ b/tools/testing/selftests/openat2/Makefile @@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-2.0-or-later +# We need this for the "cc-option" macro. +include ../../../build/Build.include -CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan +CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined +CFLAGS += $(call cc-option, -static-libasan) $(call cc-option, -static-libsan) TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test include ../lib.mk -$(TEST_GEN_PROGS): helpers.c helpers.h +$(TEST_GEN_PROGS): helpers.c I'll tidy this up and send it out. Thanks, Ryan