Skip to content

toolchain: avoid broad substring replacement in get_toolchain_binary#1637

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

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.

@bjorn3
Copy link
Copy Markdown
Member

bjorn3 commented Apr 2, 2026

As explained in #1636 (comment) I don't think this is worth it as it only gets used when CG_CLIF_FORCE_GNU_AS is set.

@bjorn3 bjorn3 closed this Apr 2, 2026
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

2 participants