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 407DCC4345F for ; Tue, 16 Apr 2024 14:55:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9CA86B0087; Tue, 16 Apr 2024 10:55:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A4D526B0089; Tue, 16 Apr 2024 10:55:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93BEE6B008C; Tue, 16 Apr 2024 10:55:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 748D46B0087 for ; Tue, 16 Apr 2024 10:55:31 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 40C791C0946 for ; Tue, 16 Apr 2024 14:55:31 +0000 (UTC) X-FDA: 82015693662.27.CF71A2A Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf07.hostedemail.com (Postfix) with ESMTP id 4780740014 for ; Tue, 16 Apr 2024 14:55:29 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf07.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713279329; 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=YiOIX34UNwbTxqhmV9a7jHmATq2HoOeLuPC8CG4Oi08=; b=cJhYOIQXVhuIDYA0pX6h2S5jTtTs1vE6MQrBBrSnQmQUR+p6IgW+tL7//+7gdInmDMicN8 LsswQ96WEg8xZpyc1U9o3Yf8sb9RPXhZ0aNhvtmLnZOr3KVOeWnKLFEqT22Ett9f/+YlvF +ZOc0BqMIjMzj6itpuKZbeCL7jxtBIg= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf07.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713279329; a=rsa-sha256; cv=none; b=id8paKj/8lQeYfz6gUc98PCteAILQ2UiT3rB6TEOGGT/DFH9BJ+dpR18TI0jgssMHubiCJ dCF3/LbXRse8ii6I3xlQXlguUcSnapW5zKXpYEkbgWUcOz5l7IK7sINWtGVoOOKZWrl43a llcBTaEPnhE7iU5T/uRbsY7DuogXhnc= 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 315B1339; Tue, 16 Apr 2024 07:55:56 -0700 (PDT) Received: from [10.1.39.189] (XHFQ2J9959.cambridge.arm.com [10.1.39.189]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2444D3F792; Tue, 16 Apr 2024 07:55:27 -0700 (PDT) Message-ID: <50ff8268-7c9f-4493-a733-f24801e19da9@arm.com> Date: Tue, 16 Apr 2024 15:55:25 +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> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 4780740014 X-Stat-Signature: yhr6b1omnrhd5md9m66ngxkg1aabbh75 X-HE-Tag: 1713279329-703135 X-HE-Meta: U2FsdGVkX18yL07qNS5NHyX8pm6qUHg4SfSLLK3r/d9ChQ01u1PswEddVnkgaW4rilIXn6UvNJK2IhL/519+Ne+bKmtPQ4zPqhUcR7FqgAEDJFsttoToA4s2zCq0dw9yoAXiEWfDgG57v08x+5K4S2gVoI2yCYdtvIA6SvFFMCVS1e2oMg38F85oxOYtm7LtFfRZ3U8sFlLetx3m1WCLtj9wfvShqYua0oMyYiVNIFzQ6aXV22NzI+mkO4DP/PZ9FLGMCRcbr8fh4V8okEJKH/wjouykDmGtYg94gsS6JUslE5wz4+yxbJt8RNYMEJDCIc1l+GA9NfkB+LxDv45YYjswxJ1sus+ZZn3Jp0IijUuLgWvYh5jMxW5b+DjFVFamJte4uESfWDtDUIQVmHO914/SqGErkNpxdMRq/YLD7KRsKpA+x50x/yDbymGhKHOy+f8WC1t8cF3Oxv8aCA5CswmrFbIbvcw55Z72VUIt34GuEHtWR7OtGIIXJ6RERSRos+yxmhrNnV+MkK2T94vlKpWVhQLMTu5SrE8dn0a5RXTBgGEx+aVmike+e/OnKfiBbkWnmXsOvPl51mRWyTw1zYnchDJpKDgR2ulA2TJZN5ychVU0DQyrpA8DWX9ijM+6vve4Q223Kou0PrACkPA3aktfsnjn1M7LxRTDxhXhnhPNI9OK/aC7whbdo+WXoZUfqUxUNO+KrZhLuPQ0nP15CYqchEwnc8apbr4dFdr0oh+VwAr5v3PwRUEywh+A9CynMb24/VYrScIL4kuo24jo2dNSRTU14kiXf+qgGEA2Hi2rJtwjmWwgmSqloQ2G+eQ9+2Gu+V8yhWIDOjz+Qcj6Tmdw2GODCBzvoJmVUylwJoot6iK9yO9DRgbgIlTaSHM429Ak3Pwy+dXbxYyxaP87BewTbpJh6t9oU3uwyzxgpaB+hj9mKEkTU0+/ur8LUDgUeOBxw0kLfR3cNPK8Rhf JwaAyBqZ 5Jb5iZjhv1t291kwYaP67GnpfuvWv5Fi+zl8bix4PziUlwytTr9Db5A38bMjMQcnKQZzJjL4iaf7w3/27Z9v3NkIzUc2PT9HdTedQJFqthcjpXfGGP9xJ6mFVTr8T1aUQkaszkx1nm5fAF0GU6USf1y5hKKMwG+IIFQpDfbsGGXFGsWT58naYAoV0KV5wTHJhVkBw1fusEDeWXINZfOjF9Yywv3SHZhthkZYyw9puTeDhfNt8LFiU8WnBTr4dxagN6QJtIYPsXMh52ERBit1uH1++jVK1O/4iCINIYzr+WgfI2v4= 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 16/04/2024 15:42, Arnd Bergmann wrote: > On Tue, Apr 16, 2024, at 16:33, Ryan Roberts wrote: >> On 16/04/2024 08:42, kernel test robot wrote: >>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master >>> head: 7efd0a74039fb6b584be2cb91c1d0ef0bd796ee1 >>> commit: c652df8a4a9d7853fa1100b244024fd6f1a9c18a selftests: link libasan statically for tests with -fsanitize=address >>> compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) >>> >>> If you fix the issue in a separate patch/commit (i.e. not just a new version of >>> the same patch/commit), kindly add following tags >>> | Reported-by: kernel test robot >>> | Closes: https://lore.kernel.org/r/202404141807.LgsqXPY5-lkp@intel.com/ >>> >>> All errors (new ones prefixed by >>): >>> >>> # tools/testing/selftests/fchmodat2$ make CC=clang >>> clang -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan -isystem usr/include fchmodat2_test.c -o tools/testing/selftests/fchmodat2/fchmodat2_test >>> clang: error: unknown argument '-static-libasan'; did you mean '-static-libsan'? >>> make: *** [../lib.mk:181: tools/testing/selftests/fchmodat2/fchmodat2_test] Error 1 >>> >>> # tools/testing/selftests/openat2$ make CC=clang >>> clang -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan openat2_test.c helpers.c helpers.h -o tools/testing/selftests/openat2/openat2_test >>> clang: error: unknown argument '-static-libasan'; did you mean '-static-libsan'? >>> clang: error: cannot specify -o when generating multiple output files >>> make: *** [../lib.mk:181: tools/testing/selftests/openat2/openat2_test] Error 1 >>> >> >> Hi Arnd, >> >> This change went in quite a while ago and is on;y just blowing up. I saw your >> comment in another thread [1] that Andrew merged your change to set -Wextra. >> Perhaps that's what has caused this to show up only now? *although I don't >> actually see -Wextra in the command line). >> >> I guess the problem is that `-static-libasan` is only supported by gcc. But I'm >> Makefile-illiterate. Can anyone advise on what's the best way to make this >> argument gcc-only? > > Thanks for letting me know about the problem, I had indeed missed > build-testing any of tools/testing, so this might not be > the only problem there. > > 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: > > --- a/tools/testing/selftests/fchmodat2/Makefile > +++ b/tools/testing/selftests/fchmodat2/Makefile > @@ -1,6 +1,12 @@ > # 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) > +ifdef CONFIG_CC_IS_GCC > +CFLAGS += -static-libasan > +else > +CFLAGS += -static-libsan > +endif > + > TEST_GEN_PROGS := fchmodat2_test > > include ../lib.mk > > Alternatively, if the cc-option macro is available, you could > try this one > > CFLAGS += $(call cc-option, -static-libasan) $(call cc-option, -static-libsan) > > Arnd Thanks! I'll give this a try. Although I can't actually find any mention of -static-libsan in the clang manual. I believe I read somewhere that static linking is default for clang, so worst case, I guess we just leave it out (presumably that's effectively been the case so far anyway).