[llvm] [llvm-driver] Add driver aliases for c++filt and gcov-tool (PR #92803)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 11:37:52 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-pgo
Author: Jordan Rupprecht (rupprecht)
<details>
<summary>Changes</summary>
Similar to 9d955a63c7b0d2d547a63d4074e03cd5ebd1f162, this allows the driver to respond to `c++filt` and `gcov-tool`.
* `c++filt` is a common alias that `llvm-cxxfilt` acts as
* `gcov-tool` usage as an alias that `llvm-profdata` acts as is less common, but is used in practice. See https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov-tool.html vs https://llvm.org/docs/CommandGuide/llvm-profdata.html: both implement similar `merge` and `overlap` subcommands, even if there is not full compatibility.
---
Full diff: https://github.com/llvm/llvm-project/pull/92803.diff
4 Files Affected:
- (modified) llvm/test/tools/llvm-driver/symlink-call.test (+2)
- (modified) llvm/tools/llvm-cxxfilt/CMakeLists.txt (+4)
- (modified) llvm/tools/llvm-profdata/CMakeLists.txt (+4)
- (modified) utils/bazel/llvm-project-overlay/llvm/driver.bzl (+2)
``````````diff
diff --git a/llvm/test/tools/llvm-driver/symlink-call.test b/llvm/test/tools/llvm-driver/symlink-call.test
index eeedf9edc73f2..ca6098216b13a 100644
--- a/llvm/test/tools/llvm-driver/symlink-call.test
+++ b/llvm/test/tools/llvm-driver/symlink-call.test
@@ -14,6 +14,8 @@
# RUN: %t/cxxfilt-15 --help | FileCheck %s
# RUN: ln -s %llvm %t/cxxfilt-15.exe
# RUN: %t/cxxfilt-15.exe --help | FileCheck %s
+# RUN: ln -s %llvm %t/c++filt
+# RUN: %t/c++filt --help | FileCheck %s
# RUN: ln -s %llvm %t/llvm-15
# RUN: %t/llvm-15 cxxfilt --help | FileCheck %s
diff --git a/llvm/tools/llvm-cxxfilt/CMakeLists.txt b/llvm/tools/llvm-cxxfilt/CMakeLists.txt
index cbc4c2db61543..a644baffdd90e 100644
--- a/llvm/tools/llvm-cxxfilt/CMakeLists.txt
+++ b/llvm/tools/llvm-cxxfilt/CMakeLists.txt
@@ -17,6 +17,10 @@ add_llvm_tool(llvm-cxxfilt
GENERATE_DRIVER
)
+if(LLVM_TOOL_LLVM_DRIVER_BUILD)
+ set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_HIDDEN_TOOL_ALIASES_llvm-cxxfilt c++filt)
+endif()
+
if(LLVM_INSTALL_BINUTILS_SYMLINKS)
add_llvm_tool_symlink(c++filt llvm-cxxfilt)
endif()
diff --git a/llvm/tools/llvm-profdata/CMakeLists.txt b/llvm/tools/llvm-profdata/CMakeLists.txt
index 25cf143337ad4..40731b8fe2532 100644
--- a/llvm/tools/llvm-profdata/CMakeLists.txt
+++ b/llvm/tools/llvm-profdata/CMakeLists.txt
@@ -12,3 +12,7 @@ add_llvm_tool(llvm-profdata
intrinsics_gen
GENERATE_DRIVER
)
+
+if(LLVM_TOOL_LLVM_DRIVER_BUILD)
+ set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_HIDDEN_TOOL_ALIASES_llvm-profdata gcov-tool)
+endif()
diff --git a/utils/bazel/llvm-project-overlay/llvm/driver.bzl b/utils/bazel/llvm-project-overlay/llvm/driver.bzl
index 10796d9198343..0d568ebf5a91e 100644
--- a/utils/bazel/llvm-project-overlay/llvm/driver.bzl
+++ b/utils/bazel/llvm-project-overlay/llvm/driver.bzl
@@ -39,8 +39,10 @@ _EXTRA_ALIASES = {
"clang": ["clang++", "clang-cl", "clang-cpp"],
"lld": ["ld", "lld-link", "ld.lld", "ld64.lld", "wasm-ld"],
"llvm-ar": ["ranlib", "lib", "dlltool"],
+ "llvm-cxxfilt": ["c++filt"],
"llvm-objcopy": ["bitcode-strip", "install-name-tool", "strip"],
"llvm-objdump": ["otool"],
+ "llvm-profdata": ["gcov-tool"],
"llvm-rc": ["windres"],
"llvm-readobj": ["readelf"],
"llvm-symbolizer": ["addr2line"],
``````````
</details>
https://github.com/llvm/llvm-project/pull/92803
More information about the llvm-commits
mailing list