From ef85dff5b3247fd4078ad12a23b32682faf693fa Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 27 Sep 2023 11:17:12 -0700 Subject: [PATCH] Fix the profiler runtime with compiler-rt-17 --- rust.spec | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/rust.spec b/rust.spec index 8a25fdd..a993b13 100644 --- a/rust.spec +++ b/rust.spec @@ -773,9 +773,14 @@ end} %endif %if 0%{?fedora} || 0%{?rhel} >= 8 -# The exact profiler path is version dependent, and uses LLVM-specific -# arch names in the filename, but this find is good enough for now... -PROFILER=$(find %{_libdir}/clang -type f -name 'libclang_rt.profile-*.a') +# Find the compiler-rt library for the Rust profiler_builtins crate. +%if 0%{?clang_major_version} >= 17 +PROFILER='%{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a' +%else +# The exact profiler path is version dependent.. +PROFILER=$(echo %{_libdir}/clang/*/lib/libclang_rt.profile-%{_arch}.a) +%endif +test -r "$PROFILER" %endif %configure --disable-option-checking \ @@ -919,16 +924,23 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* # Sanity-check the installed binaries, debuginfo-stripped and all. %{buildroot}%{_bindir}/cargo new build/hello-world -env RUSTC=%{buildroot}%{_bindir}/rustc \ - LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ - %{buildroot}%{_bindir}/cargo run --manifest-path build/hello-world/Cargo.toml +( + cd build/hello-world + export RUSTC=%{buildroot}%{_bindir}/rustc \ + LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" + %{buildroot}%{_bindir}/cargo run --verbose -# Try a build sanity-check for other targets -for triple in %{?mingw_targets} %{?wasm_targets}; do - env RUSTC=%{buildroot}%{_bindir}/rustc \ - LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ - %{buildroot}%{_bindir}/cargo build --manifest-path build/hello-world/Cargo.toml --target=$triple -done +%if 0%{?fedora} || 0%{?rhel} >= 8 + # Sanity-check that code-coverage builds and runs + env RUSTFLAGS="-Cinstrument-coverage" %{buildroot}%{_bindir}/cargo run --verbose + test -r default_*.profraw +%endif + + # Try a build sanity-check for other std-enabled targets + for triple in %{?mingw_targets} %{?wasm_targets}; do + %{buildroot}%{_bindir}/cargo build --verbose --target=$triple + done +) # The results are not stable on koji, so mask errors and just log it. # Some of the larger test artifacts are manually cleaned to save space.