Skip to content

toolchain: avoid broad substring replacement in get_toolchain_binary#1637

Open
AayushMainali-Github wants to merge 1 commit intorust-lang:mainfrom
AayushMainali-Github:get_toolchain_binary
Open

toolchain: avoid broad substring replacement in get_toolchain_binary#1637
AayushMainali-Github wants to merge 1 commit intorust-lang:mainfrom
AayushMainali-Github:get_toolchain_binary

Conversation

@AayushMainali-Github
Copy link
Copy Markdown

@AayushMainali-Github AayushMainali-Github commented Mar 26, 2026

Fixes #1636

Summary

Make get_toolchain_binary() only rewrite recognized linker suffixes instead of doing broad substring replacement on the whole linker filename.

Details

The old code chained .replace("ld", ...), .replace("gcc", ...), .replace("clang", ...), and .replace("cc", ...), which could rewrite unrelated parts of the linker name.

This changes the logic to only handle known endings:

  • gcc
  • clang
  • cc
  • ld

The existing ld.lld special case is kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_toolchain_binary can derive the wrong tool name by doing plain substring replacement

1 participant