binutils: keep colons in tool paths that are not name separators - #1025
Merged
aalexand merged 2 commits intoAug 30, 2026
Merged
Conversation
SetTools reads each comma separated entry as "<name>:<path>", splitting on the first colon. Every absolute Windows path carries a colon after the drive letter, so -tools 'C:\tools\bin' was filed under a tool named "C" and the directory was never searched. pprof then behaved as though -tools had not been passed, with no warning. PPROF_TOOLS reads the same option and was affected the same way. An entry is now read as a pair only when the prefix is one of the tool names initTools looks up: llvm-symbolizer, addr2line, nm and objdump. Anything else stays a path, so a colon inside a path is preserved. This changes one existing behaviour. A misspelled tool name such as "objdunp:/path" used to be filed under "objdunp" and ignored; it now becomes a path that is searched for every tool.
aalexand
approved these changes
Aug 30, 2026
aalexand
enabled auto-merge (squash)
August 30, 2026 19:10
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1025 +/- ##
==========================================
+ Coverage 67.38% 67.44% +0.05%
==========================================
Files 45 45
Lines 7849 7857 +8
==========================================
+ Hits 5289 5299 +10
+ Misses 2115 2114 -1
+ Partials 445 444 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 #1024.
What is broken
-toolstakes either a bare directory to search for every object tool, or<name>:<path>pairs. On Windows the bare form never works with an absolutepath:
initToolssplits each entry on the first colon, soC:\tools\binisfiled under a tool named
Cand the directory is never searched. pprof behavesas though
-toolshad not been passed, without a warning.PPROF_TOOLSreadsthe same option and fails the same way, and the Go toolchain vendors this file,
so
go tool pprof -toolshas the same problem.Root cause
internal/binutils/binutils.go:137-143treats any prefix before a colon as atool name:
paths["C"]is never looked up, sopaths[""]stays empty.What changed
An entry is read as a pair only when the prefix is one of the four names
initToolslooks up:llvm-symbolizer,addr2line,nm,objdump. Anythingelse stays a path, so a colon inside a path survives, drive letter or not.
Parsing moved into
toolPathsso it can be tested without the filesystem.A misspelled tool name changes meaning:
objdunp:/pathwas filed underobjdunpand ignored, and now becomes a path searched for every tool. That isthe caveat you raised on the issue, and the only behaviour difference I found.
Test plan
TestToolPathscovers the bare Windows path, thename:pathform, all fourtool names, a non-Windows path containing a colon, a misspelled name and a mixed
entry. Four of its six cases fail without the change:
On Windows 10 with GNU binutils in
C:\mingw64\bin, that directory removed fromPATH, built from67a7179before and after:-tools 'C:\mingw64\bin'PPROF_TOOLS='C:\mingw64\bin'-tools 'objdump:C:\mingw64\bin,nm:...'-tools, tools onPATHgofmt -d -s .,go vet -all ./...,staticcheck ./...andgolangci-lint run -D errcheckare clean, and-racepasses for the new tests. The full suitematches the pre-change baseline, where
TestPEFilefails in both runs becausethis machine has no
llvm-symbolizer.