mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] scripts: clang-runtime-dir.sh: cope with a wrapped compiler
Date: Wed,  9 Sep 2026 12:34:05 +0200	[thread overview]
Message-ID: <20260909103408.3311496-1-a.fatoum@pengutronix.de> (raw)

The script takes only its first argument as the compiler, so a $(CC) that
carries a wrapper, e.g. "sccache clang-21", makes it probe the wrapper
instead.

This leads to CLANG_RUNTIME_DIR ending up up empty and the sandbox
fuzzer link then fails with

  ld.lld: error: undefined symbol: LLVMFuzzerRunDriver

because -L"" no longer finds libclang_rt.fuzzer_no_main.

Pass all arguments through instead.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/clang-runtime-dir.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/clang-runtime-dir.sh b/scripts/clang-runtime-dir.sh
index 65b3028ad04d..7a3899d16ee2 100755
--- a/scripts/clang-runtime-dir.sh
+++ b/scripts/clang-runtime-dir.sh
@@ -1,14 +1,17 @@
 #!/bin/sh
 
-CC=${1:-${CC}}
+if [ $# -eq 0 ]; then
+	# unquoted on purpose: $CC may carry a wrapper, e.g. "sccache clang-21"
+	set -- ${CC}
+fi
 
-if [ "${CC}" = "" ]; then
+if [ $# -eq 0 ]; then
 	echo "Error: No compiler specified." >&2
 	printf "Usage:\n\t$0 <clang-command>\n" >&2
 	exit 1
 fi
 
-rundir=$("${CC}" --print-runtime-dir 2>/dev/null)
+rundir=$("$@" --print-runtime-dir 2>/dev/null)
 if [ ! -e "$rundir" ]; then
 	# Workaround https://github.com/llvm/llvm-project/issues/112458
 	guess=$(dirname "$rundir")/linux
-- 
2.47.3




                 reply	other threads:[~2026-09-09 10:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260909103408.3311496-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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