From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74A872FE579 for ; Mon, 18 May 2026 09:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779095123; cv=none; b=unfA59POBkmofwE1Cmy9TS8ayChtOD8uxccvsU6I02fDRGgHJVlzmdeUe6t+UU2HLHIRgbG7RvSc4ckB4XV+FZRTdwNmtdLKgwztVavip4kcIQIy587E5vtsDhQJ6kbZ8gEO93NWc26+5Ixodul+s5nTdQAAxO+ctOviDzUcmHo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779095123; c=relaxed/simple; bh=N+mBa9Qop2DRXCEJaXykcTUTNPqJPKjVhuTJzDs3+Ds=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KkdW8BPU1HnWJCw7J1xOsSNnHP+NZPZe1bepOCAOMWId8DpU6iCKfu3lIpa/iN3XGdNmZAYaxJqZOHgsdzNPq+LEjHnTYHSV7joawmAaXbWG+q/VEB8Yzzov1KMmt63xJollA3xsmjnF10vCfmWx0Hkx8sTi/UiF68jaM44n6zU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=vtiNbayr; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vtiNbayr" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-43d76dd4ee8so1700157f8f.2 for ; Mon, 18 May 2026 02:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1779095119; x=1779699919; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=b5p4hero2Con2BmKZIS8vOF61ZHN0e7aAbx1KJsO8hg=; b=vtiNbayrVhfvPUlg45HCUIOWCBpzFDwIkRu/o37TrMurtMPtutoJzBZHyRqaHQJDvD t6G4JkhrVrq0ijH+q8RG875GTJFF+TXc4Zi4CEQEvK0YSrp71FOlVmkDIveOEG5iiZa/ s0b1eKzsP7+XduTsuzvEPu2I5XPlRz0S0IhtZ3L2quQlGRQ7kmFQL+14GTPZmswJOAdd O2YRM85mlcKjMZJHEuPRLJGCmzprVPGyG6gzdPgkjmoIWDZGm2jY/462fL96EDhJWGFQ Rpku9+hNTOo1DoE7shodoL2tXiVbwSf6gyChnh76jq/sYaxRXACvvkj3h8ruYjw3rApu Vd7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779095119; x=1779699919; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b5p4hero2Con2BmKZIS8vOF61ZHN0e7aAbx1KJsO8hg=; b=r0gxF3w75G3+YAnkFZLWnaz37NkH/kqwdlcw92Uiv2YbWguV2g8o5cV7xqHwSOXjmI /Fzw4A5bBTyGj3qQ2LrWywJomxiFbsajpqSvZjBNIqAnJSe4tPyWfV0IhOHtUz5ttHwY qMFVLv2PdCS09co5qgZEJyYXUw6qISWawV9xAcDYwIV6tSV/IEsPxE0TeUMMbelDDsof sN1t66b1f/JwctO5dmZ4lrgLpyiMJzWzC7kXESG2CDrNRFa+pepgUklNyon81g4suUWa Ucv9wdiBADlSOAJVflgD+gdyB5G0tpeqrVxzddwIocCgbd0vDScp4BWhynydODPaVQeT 83Qw== X-Gm-Message-State: AOJu0Yy6CwrqtfRWbRWEPH9nSbVjse0PcW4LqfCA2cLI5D/DfIAi4ZIk 8HbqtEf/wPzJ2ZXMSEdtjenIXKL12mjfZWyhWUb1DeiNOjqw88dTr4ok82ZV7W+QwDc= X-Gm-Gg: Acq92OHqXByjkPYdxGkCs4f5hEDDVxrIukxKOVqKI+fHcMXntoa+kyGMEKV+HZDhmN5 u9yLjGXw4xCzceAbBra8wW3u0yyiKzhl1rtHVWuFJCGiq4NzpYoTQ1oeq3hYXqOWbalKx+s9JDJ miGD22I0QvEp+rjUc3MWLFAbsFuXWBjsUQXhpGMYUPVdWCF65j+dh8f9ie+3RM9VLKtEFd+KbbT DfrepThoHPcOzUQgEFTvN1VhxUhuKydt6cvE+KJ1ltRV8/ijp9r7spDy1RO16e6yi+I4SrGAuD+ ZL5NWege/bTHJRC2FNem1VT+mTmlMTOx8f+G53mqipaUuUoHg+lvVfY26UW2Lc+poUE6RLIdqgo yC9QoHgARWUMDxS9oHzssemUyJOxjwJD/AK/e7uw6j71XDCxz4+0dKvbEEZADoNpEd4ULOaQWiU 2npi6KR6HnbFamk5lb7JlDkj0mmPSY X-Received: by 2002:a5d:44d2:0:b0:45e:739b:3e3c with SMTP id ffacd0b85a97d-45e739b3f89mr5942873f8f.0.1779095118902; Mon, 18 May 2026 02:05:18 -0700 (PDT) Received: from [192.168.1.3] ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45da0fe0f72sm38419068f8f.25.2026.05.18.02.05.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2026 02:05:18 -0700 (PDT) Message-ID: Date: Mon, 18 May 2026 10:05:16 +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: [PATCH 5/6] tools/build: selftests: Allow versioning LLVM lld To: Ihor Solodrai Cc: linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, leo.yan@arm.com, Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Jiri Kosina , Benjamin Tissoires , Shuah Khan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Andrii Nakryiko , Eduard Zingerman , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song References: <20260514-james-perf-llvm-version-v1-0-6cac1a9a4c8d@linaro.org> <20260514-james-perf-llvm-version-v1-5-6cac1a9a4c8d@linaro.org> Content-Language: en-US From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 15/05/2026 11:58 pm, Ihor Solodrai wrote: > On 5/14/26 2:32 AM, James Clark wrote: >> Building with LLVM=... could result in a different version of lld being >> used than the main toolchain for liburandom_read.so because it's >> hardcoded to "lld" in this makefile. >> >> Make it consistent with the rest of the LLVM toolchain by adding an LLD >> variable to Makefile.include. Keep the fallback for other architectures >> in tools/testing/selftests/bpf/Makefile as it seems like it's something >> specific to this make rule and shouldn't be global. >> >> Clang accepts either a full path or "ld.lld-15" style inputs to >> -fuse-ld= so this will work with LLD defined the same way as the other >> LLVM tools. However, for full paths, we need to use ".../ld.lld" instead >> of the generic driver "lld", but I don't think the original use of "lld" >> was significant as this is always a linux build. >> >> Signed-off-by: James Clark >> --- >> tools/scripts/Makefile.include | 2 ++ >> tools/testing/selftests/bpf/Makefile | 8 ++++---- >> 2 files changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include >> index 380ad84ac51e..5c2d505cba62 100644 >> --- a/tools/scripts/Makefile.include >> +++ b/tools/scripts/Makefile.include >> @@ -67,6 +67,7 @@ ifneq ($(LLVM),) >> $(call allow-override,HOSTAR,$(LLVM_PREFIX)llvm-ar$(LLVM_SUFFIX)) >> $(call allow-override,LD,$(LLVM_PREFIX)ld.lld$(LLVM_SUFFIX)) >> $(call allow-override,HOSTLD,$(LLVM_PREFIX)ld.lld$(LLVM_SUFFIX)) >> + $(call allow-override,LLD,$(LLVM_PREFIX)ld.lld$(LLVM_SUFFIX)) >> $(call allow-override,CXX,$(LLVM_PREFIX)clang++$(LLVM_SUFFIX)) >> $(call allow-override,STRIP,$(LLVM_PREFIX)llvm-strip$(LLVM_SUFFIX)) >> $(call allow-override,LLVM_STRIP,$(LLVM_PREFIX)llvm-strip$(LLVM_SUFFIX)) >> @@ -91,6 +92,7 @@ else >> # Some tools still require Clang, LLC and/or LLVM utils >> $(call allow-override,CLANG,clang) >> $(call allow-override,LLC,llc) >> + $(call allow-override,LLD,ld.lld) >> $(call allow-override,LLVM_CONFIG,llvm-config) >> $(call allow-override,LLVM_OBJCOPY,llvm-objcopy) >> $(call allow-override,LLVM_STRIP,llvm-strip) >> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile >> index 6ef6872adbc3..44ba829e5d4d 100644 >> --- a/tools/testing/selftests/bpf/Makefile >> +++ b/tools/testing/selftests/bpf/Makefile >> @@ -245,9 +245,9 @@ $(OUTPUT)/%:%.c >> >> # LLVM's ld.lld doesn't support all the architectures, so use it only on x86 >> ifeq ($(SRCARCH),$(filter $(SRCARCH),x86 riscv)) >> -LLD := lld >> +USE_LD := $(LLD) >> else >> -LLD := $(shell command -v $(LD)) >> +USE_LD := $(shell command -v $(LD)) >> endif >> >> # Filter out -static for liburandom_read.so and its dependent targets so that static builds >> @@ -258,7 +258,7 @@ $(OUTPUT)/liburandom_read.so: urandom_read_lib1.c urandom_read_lib2.c liburandom >> $(filter-out -static,$(CFLAGS) $(LDFLAGS)) \ >> $(filter %.c,$^) $(filter-out -static,$(LDLIBS)) \ >> -Wno-unused-command-line-argument \ >> - -fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \ >> + -fuse-ld=$(USE_LD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \ > > Hi James, > > This patch breaks the selftests/bpf build: > > $ clang --version > clang version 22.1.3 (CentOS 22.1.3-1.el9) > Target: x86_64-redhat-linux-gnu > Thread model: posix > InstalledDir: /usr/bin > Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang.cfg > > $ make LLVM=1 -j$(nproc) > [...] # ok > > $ make LLVM=1 -C tools/testing/selftests/bpf -j$(nproc) > > [...] # somewhere in the middle > > LIB liburandom_read.so > clang: error: invalid linker name in argument '-fuse-ld=ld.lld' > make: *** [Makefile:256: /home/isolodrai/workspace/review/linux/tools/testing/selftests/bpf/liburandom_read.so] Error 1 > make: Leaving directory '/home/isolodrai/workspace/review/linux/tools/testing/selftests/bpf' > > [...] > > Or a simpler reproducer: > > $ make LLVM=1 OUTPUT=/tmp/out /tmp/out/liburandom_read.so > LIB liburandom_read.so > clang: error: invalid linker name in argument '-fuse-ld=ld.lld' > make: *** [Makefile:256: /tmp/out/liburandom_read.so] Error 1 > > $ make LLVM=-22 OUTPUT=/tmp/out /tmp/out/liburandom_read.so > LIB liburandom_read.so > clang-22: error: invalid linker name in argument '-fuse-ld=ld.lld-22' > make: *** [Makefile:256: /tmp/out/liburandom_read.so] Error 1 > > I tried your patches, and only then noticed BPF CI caught this too: > https://github.com/kernel-patches/bpf/actions/runs/25943477658/job/76267174885?pr=12082 > Thanks for testing. Yeah looks like I made a mistake here testing the various different formats of LLD. Converting it to a full path works with both prefixed and postfixed versions, and that's what's already done for non x86/riscv so I'll do that. >> -Wl,--version-script=liburandom_read.map \ >> -fPIC -shared -o $@ >> >> @@ -268,7 +268,7 @@ $(OUTPUT)/urandom_read: urandom_read.c urandom_read_aux.c $(OUTPUT)/liburandom_r >> $(filter-out -static,$(CFLAGS) $(LDFLAGS)) $(filter %.c,$^) \ >> -Wno-unused-command-line-argument \ >> -lurandom_read $(filter-out -static,$(LDLIBS)) -L$(OUTPUT) \ >> - -fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \ >> + -fuse-ld=$(USE_LD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \ >> -Wl,-rpath=. -o $@ >> >> $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c >> >