Skip to content

Commit

Permalink
Mark gcc-<version/triplet> as gcc in Unix CC toolchain
Browse files Browse the repository at this point in the history
Previously only gcc-binaries named exactly `gcc` were marked as `gcc`,
with the others being marked as `compiler`.

Fixes #17794
  • Loading branch information
robinlinden committed Nov 29, 2023
1 parent af4d29e commit de64050
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/test/tools/bzlmod/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion tools/cpp/unix_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,15 @@ def _is_clang(repository_ctx, cc):
def _is_gcc(repository_ctx, cc):
# GCC's version output uses the basename of argv[0] as the program name:
# https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=158461167951c1b9540322fb19be6a89d6da07fc;hb=HEAD#l8728
return repository_ctx.execute([cc, "--version"]).stdout.startswith("gcc ")
cc_argv0 = repository_ctx.execute([cc, "--version"]).stdout.partition(" ")[0]
if cc_argv0 == "gcc":
return True

# Program names like gcc-11 and gcc-arm-non-eabi.
if cc_argv0.startswith("gcc-"):
return True

return False

def _get_compiler_name(repository_ctx, cc):
if _is_clang(repository_ctx, cc):
Expand Down

0 comments on commit de64050

Please sign in to comment.