[all-commits] [llvm/llvm-project] f64959: [CMake] Use LLVM own tools in extract_symbols.py

Igor Kudrin via All-commits all-commits at lists.llvm.org
Mon May 15 16:22:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f649599ea93301bd0d0a2b8e450d1f77425ea92e
      https://github.com/llvm/llvm-project/commit/f649599ea93301bd0d0a2b8e450d1f77425ea92e
  Author: Igor Kudrin <ikudrin at accesssoftek.com>
  Date:   2023-05-15 (Mon, 15 May 2023)

  Changed paths:
    M llvm/CMakeLists.txt
    M llvm/cmake/modules/AddLLVM.cmake
    M llvm/cmake/modules/CrossCompile.cmake
    M llvm/tools/llvm-nm/CMakeLists.txt
    M llvm/tools/llvm-readobj/CMakeLists.txt
    M llvm/tools/llvm-shlib/CMakeLists.txt
    M llvm/utils/extract_symbols.py

  Log Message:
  -----------
  [CMake] Use LLVM own tools in extract_symbols.py

As for now, 'extract_symbols.py' can use several tools to extract
symbols from object files and libraries and to guess if the target is
32-bit Windows. The tools are being found via PATH, so in most cases,
they are just system tools. This approach has a number of limitations,
in particular:

* System tools may not be able to handle the target format in case of
  cross-platform builds,
* They cannot read symbols from LLVM bitcode files, so the staged LTO
  build with plugins is not supported,
* The auto-selected tools may be suboptimal (see D113557),
* Support for multiple tools for a single task increases the complexity
  of the script code.

The patch proposes using LLVM's own tools to solve these issues.
Specifically, 'llvm-readobj' detects the target platform, and 'llvm-nm'
reads symbols from all supported formats, including bitcode files. The
tools can be built in Release mode for the host platform or overridden
using CMake settings 'LLVM_READOBJ' and 'LLVM_NM' respectively. The
implementation also supports using precompiled tools via
'LLVM_NATIVE_TOOL_DIR'.

Differential Revision: https://reviews.llvm.org/D149119




More information about the All-commits mailing list