[PATCH] D109977: LLVM Driver Multicall tool

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 17 09:36:09 PDT 2021


beanz created this revision.
beanz added reviewers: leonardchan, phosek, MaskRay, compnerd, mehdi_amini.
Herald added subscribers: rupprecht, mgorny.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
beanz requested review of this revision.
Herald added projects: clang, LLVM.
Herald added a subscriber: cfe-commits.

This patch adds an llvm-driver multicall tool that can combine multiple
LLVM-based tools. The build infrastructure is enabled for a tool by
adding the `GENERATE_DRIVER` option to the `add_llvm_executable` CMake
call, and changing the tool's `main` function to a canonicalized
`tool_name_main` format (i.e. llvm_ar_main, clang_main, etc...).

As currently implemented llvm-driver contains dsymutil, llvm-ar,
llvm-cxxfilt, llvm-objcopy, and clang (if clang is included in the
build).

llvm-driver can be disabled from builds by setting
LLVM_TOOL_LLVM_DRIVER_BUILD=Off.

There are several limitations in the current implementation, which can
be addressed in subsequent patches:

(1) the multicall binary cannot currently properly handle
multi-dispatch tools. This means symlinking llvm-ranlib to llvm-driver
will not properly result in llvm-ar's main being called.
(2) the multicall binary cannot be comprised of tools containing
conflicting cl::opt options as the global cl::opt option list cannot
contain duplicates.

These limitations can be addressed in subsequent patches.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109977

Files:
  clang/cmake/modules/AddClang.cmake
  clang/tools/driver/CMakeLists.txt
  clang/tools/driver/driver.cpp
  llvm/cmake/driver-template.cpp
  llvm/cmake/modules/AddLLVM.cmake
  llvm/test/CMakeLists.txt
  llvm/test/lit.cfg.py
  llvm/test/lit.site.cfg.py.in
  llvm/test/tools/llvm-driver/help-passthrough.test
  llvm/test/tools/llvm-driver/help.test
  llvm/test/tools/llvm-driver/symlink-call.test
  llvm/tools/CMakeLists.txt
  llvm/tools/dsymutil/CMakeLists.txt
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llvm-ar/CMakeLists.txt
  llvm/tools/llvm-ar/llvm-ar.cpp
  llvm/tools/llvm-cxxfilt/CMakeLists.txt
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
  llvm/tools/llvm-driver/CMakeLists.txt
  llvm/tools/llvm-driver/llvm-driver.cpp
  llvm/tools/llvm-objcopy/CMakeLists.txt
  llvm/tools/llvm-objcopy/llvm-objcopy.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109977.373256.patch
Type: text/x-patch
Size: 14292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210917/f3dc0476/attachment-0001.bin>


More information about the cfe-commits mailing list