Repository navigation
fix(ct,eunit): add the build id to LLVM_PROFILE_FILE on Linux - #23
Open
TrapsterDK wants to merge 1 commit into
Open
TrapsterDK wants to merge 1 commit into
TrapsterDK wants to merge 1 commit into
Conversation
Two NIFs with the same profile layout share a %m signature and write to one profile, so the second fails to merge and both lose their counts. %b is the ELF build id, which differs per library. Assisted by Claude.
This was referenced Nov 21, 2026
TrapsterDK
added a commit
to devhusdk/rules_dx
that referenced
this pull request
Nov 21, 2026
…rlang#23 (closes #14151) (#14503) Claude-Session: https://claude.ai/code/session_01Xut2hzWDHEg9zNhhTJrJ7t Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22
Problem
Bazel sets
LLVM_PROFILE_FILEto a pattern with%m. Two NIFs with the same profile layout get the same%m, so they write to one.profraw. The second write fails with "Unable to merge profile data" and both NIFs report 0 hits.Change
On Linux, the bash scripts generated by
ct_testandeunitrewrite%minLLVM_PROFILE_FILEto%b-%mbefore starting the VM.%bis the ELF build id, so each library writes its own profile. macOS and Windows are unchanged.Notes:
%bneeds compiler-rt from LLVM 21 or later. Older runtimes drop the unknown%b, so nothing changes there.-Wl,--build-id). With LLVM 21 or later and a library that has no build id, the runtime warns and writes to its default file name, so that profile is not collected.Test
test/llvm_profile_filehas aneunitand act_testtarget that setLLVM_PROFILE_FILE=prof/%h-%p-%m.profrawand check the value the VM sees:prof/%h-%p-%b-%m.profrawon Linux, unchanged on macOS. Both fail without the change. Windows is left out because the.batscripts expand%inset.bazel test //...passes in the root and intest/with Bazel 9.2.0 and OTP 29 on Linux.Assisted by Claude.