From: Ryan Roberts <ryan.roberts@arm.com>
To: Arnd Bergmann <arnd@arndb.de>, kernel test robot <yujie.liu@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
llvm@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: clang: error: unknown argument '-static-libasan'; did you mean '-static-libsan'?
Date: Wed, 17 Apr 2024 16:52:36 +0100 [thread overview]
Message-ID: <28b20153-62d8-40f2-9305-60943696d4a1@arm.com> (raw)
In-Reply-To: <e95bb670-7c20-496f-80e1-8b1891816764@app.fastmail.com>
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
prev parent reply other threads:[~2024-04-17 15:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 7:42 kernel test robot
2024-04-16 14:33 ` Ryan Roberts
2024-04-16 14:42 ` Arnd Bergmann
2024-04-16 14:55 ` Ryan Roberts
2024-04-17 15:11 ` Ryan Roberts
2024-04-17 15:23 ` Arnd Bergmann
2024-04-17 15:52 ` Ryan Roberts [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28b20153-62d8-40f2-9305-60943696d4a1@arm.com \
--to=ryan.roberts@arm.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=yujie.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox