[ClangLinkerWrapper] Fix -v for newer CMake passing it directly (#188883)

Summary:
Normally `-v` is version for tools, but it's also verbose for the
linker. CMake tries to identify the linker by passing `-Wl,-v` which
goes to the linker wrapper instead. Make this only print version on
`--version` and forward the other one to the linker so it appears
transparent to the host ABI. A bit of a hack, but it should work.
This commit is contained in:
Joseph Huber
2026-03-26 21:08:49 -05:00
committed by GitHub
parent 2c0a67d6d7
commit 80b1fbecf4
2 changed files with 2 additions and 3 deletions

View File

@@ -1332,7 +1332,7 @@ int main(int Argc, char **Argv) {
Args.hasArg(OPT_help_hidden), Args.hasArg(OPT_help_hidden));
return EXIT_SUCCESS;
}
if (Args.hasArg(OPT_v)) {
if (Args.hasArg(OPT_version)) {
printVersion(outs());
return EXIT_SUCCESS;
}

View File

@@ -127,8 +127,7 @@ def library_EQ : Joined<["--", "-"], "library=">, Flags<[HelpHidden]>,
def rpath : Separate<["--", "-"], "rpath">;
def rpath_EQ : Joined<["--", "-"], "rpath=">, Flags<[HelpHidden]>, Alias<rpath>;
def v : Flag<["--", "-"], "v">, HelpText<"Display the version number and exit">;
def version : Flag<["--", "-"], "version">, Flags<[HelpHidden]>, Alias<v>;
def version : Flag<["--", "-"], "version">, Flags<[HelpHidden]>;
def whole_archive : Flag<["--", "-"], "whole-archive">, Flags<[HelpHidden]>;
def no_whole_archive : Flag<["--", "-"], "no-whole-archive">, Flags<[HelpHidden]>;