Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp736667lqb; Wed, 17 Apr 2024 09:16:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZYbIvwazG/lIKjNDl/Z59Di1cpQLbH8g/M4VMoxeZDY72KPxpidkTvJomQP9UKfIgP+3f4XC4+NOH+YdCdHC+1fUWLYbUabswSyuyTQ== X-Google-Smtp-Source: AGHT+IF1mDB6zfxTz4wbFGg0D4e6Gxb2HCiaezabano6wQAohQvvfLVDEji9SH7jXzCMe8cC2UJo X-Received: by 2002:a05:6a20:100b:b0:1a1:878d:d3f6 with SMTP id gs11-20020a056a20100b00b001a1878dd3f6mr101157pzc.26.1713370567970; Wed, 17 Apr 2024 09:16:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713370567; cv=pass; d=google.com; s=arc-20160816; b=TAb4Uup7LJHhlIvrkraP8WOUSZ8JRZw8wbsoyujo1/Brl5f0ICHGap6GNTcK5penO7 JjBsQKfIDYi1GFpdQ5CKCkr7JZM+4InL7g8hBmKbJt8+eIukmasyJ19Fq9l+0iUVBcaS 8khAmUEi0OHLtjI4m3zw5a2skqcObEPS2Qt1g9g5JvPookaXI+moOHtJFzv9urxt/kWt 25Id/iMgpxRUulcupci26EkfhY3VrLUM8Tmvt/yxRz0a89xw2Z1cftM3nywZA9tC621B 5+sO6veVI9yr2l9sE8ESHkn1uI6rkonRUvAeHhvFGGuEbi8zncrj2+FFcEQyNughLa2v aDJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=5AoxUA4N7qNL4WCTj+4Dz+hsWzpr2cAhSAhYvutn/3I=; fh=CmNV61HHbh+zsl31Q01rctrTDOyl014EDTMWHrjC1pE=; b=acd5CjQcO0WP487E+/mLUTaH5PkZRCa4P7P3dmumberKGxBVkLuDlDTfjsz1rpHHOD LJ0RCx5sWpRoFwy3/IjpwTLRO7/MD5j98s/Rs2jvYP6flLTtDdEGhWZBP7wMmGRiDrEI tug2ccF9Lrh78qY+6ZpQsXN+5y0/pyEzpHMCfdrAnF7xoG3GU61ynDcAsUFfijOphQRt 2ABktYxyRM7cxEHuRBRJ7vgYZ5gez7YqgWMTtQlw+KWacXdK73nIEymgqc7ep5jn5Zis iSA+HDGcKNxckEoutjasOkoB0QOi/jYOcsm3/pHl2ELVfvjeoo/jIeHVxnkIcF15Y2Fk G9cQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-148857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id gr25-20020a056a004d1900b006ed188b5381si11715011pfb.130.2024.04.17.09.16.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 09:16:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-148857-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 71846B25964 for ; Wed, 17 Apr 2024 15:53:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6C1A148FF9; Wed, 17 Apr 2024 15:52:42 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3070414884B for ; Wed, 17 Apr 2024 15:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713369162; cv=none; b=fiCftHYmLFPvWlW7dkK1WyfP2dG+JAT4ccpT4e09V6ydmqT3qOlSbAg0Wz2da82Q6MZ/0bdamsNDIRguxeI3K/wf1hU0jR6mG41WZH3A6QtYt5oqNsINLT2sjxoNrdaRn2Zh5KMwEhZ4ydUNCUtTbeCzhvxuT51osjt00SVY78c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713369162; c=relaxed/simple; bh=kuX3OcKWgILgSLAxfzh2AQyYp1j6PjeGzoP26JTex64=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OkKNw97dM/9Ngs1zpoNV2Nxe+r1euwGeNndojTwyHkaUmDp+Me458TNxWr49hiYE+bJKfPuQS/3bChokUAUoJUMxTpg9LPbrFm6P95lrnhPDnrpctEGwcPhNCh8mNfhGncJ0/G0StMCPeaowRYM9+L0AKA6mLunSFcTSjzRMvoY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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