mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] scripts: clang-runtime-dir.sh: cope with a wrapped compiler
@ 2026-09-09 10:34 Ahmad Fatoum
  2026-09-11 14:00 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-09-09 10:34 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] scripts: clang-runtime-dir.sh: cope with a wrapped compiler
  2026-09-09 10:34 [PATCH] scripts: clang-runtime-dir.sh: cope with a wrapped compiler Ahmad Fatoum
@ 2026-09-11 14:00 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-09-11 14:00 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Wed, 09 Sep 2026 12:34:05 +0200, Ahmad Fatoum wrote:
> 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
> 
> [...]

Applied, thanks!

[1/1] scripts: clang-runtime-dir.sh: cope with a wrapped compiler
      https://git.pengutronix.de/cgit/barebox/commit/?id=c7d0978d97b0 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-11 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09 10:34 [PATCH] scripts: clang-runtime-dir.sh: cope with a wrapped compiler Ahmad Fatoum
2026-09-11 14:00 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox