mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 06:26:08 +00:00

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
40 lines
783 B
CMake
40 lines
783 B
CMake
set(LLVM_LINK_COMPONENTS
|
|
BinaryFormat
|
|
DebugInfoCodeView
|
|
DebugInfoDWARF
|
|
Demangle
|
|
Object
|
|
Option
|
|
Support
|
|
TargetParser
|
|
)
|
|
|
|
set(LLVM_TARGET_DEFINITIONS Opts.td)
|
|
tablegen(LLVM Opts.inc -gen-opt-parser-defs)
|
|
add_public_tablegen_target(ReadobjOptsTableGen)
|
|
|
|
add_llvm_tool(llvm-readobj
|
|
ARMWinEHPrinter.cpp
|
|
COFFDumper.cpp
|
|
COFFImportDumper.cpp
|
|
ELFDumper.cpp
|
|
llvm-readobj.cpp
|
|
MachODumper.cpp
|
|
ObjDumper.cpp
|
|
WasmDumper.cpp
|
|
Win64EHDumper.cpp
|
|
WindowsResourceDumper.cpp
|
|
XCOFFDumper.cpp
|
|
DEPENDS
|
|
ReadobjOptsTableGen
|
|
GENERATE_DRIVER
|
|
)
|
|
|
|
setup_host_tool(llvm-readobj LLVM_READOBJ llvm_readobj_exe llvm_readobj_target)
|
|
|
|
add_llvm_tool_symlink(llvm-readelf llvm-readobj)
|
|
|
|
if(LLVM_INSTALL_BINUTILS_SYMLINKS)
|
|
add_llvm_tool_symlink(readelf llvm-readobj)
|
|
endif()
|