[llvm-{debuginfod,ml,objdump,symbolizer}, dsymutil] Enable multicall driver

Differential Revision: https://reviews.llvm.org/D157670
This commit is contained in:
Andrés Villegas 2023-08-11 01:32:31 +00:00
parent c296c35e9e
commit d5ca900414
11 changed files with 35 additions and 10 deletions

View File

@ -36,9 +36,10 @@ add_llvm_tool(dsymutil
intrinsics_gen
${tablegen_deps}
DsymutilTableGen
GENERATE_DRIVER
)
if(APPLE)
if(APPLE AND NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
target_link_libraries(dsymutil PRIVATE "-framework CoreFoundation")
endif(APPLE)

View File

@ -595,7 +595,7 @@ getOutputFileName(StringRef InputFile, const DsymutilOptions &Options) {
return OutputLocation(std::string(Path.str()), ResourceDir);
}
int main(int argc, char **argv) {
int dsymutil_main(int argc, char **argv, const llvm::ToolContext &) {
InitLLVM X(argc, argv);
// Parse arguments.

View File

@ -11,8 +11,13 @@ add_llvm_tool(llvm-debuginfod
DEPENDS
DebugInfodOptsTableGen
GENERATE_DRIVER
)
target_link_libraries(llvm-debuginfod PRIVATE LLVMDebuginfod)
if(NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
target_link_libraries(llvm-debuginfod PRIVATE LLVMDebuginfod)
endif()
if(LLVM_INSTALL_BINUTILS_SYMLINKS)
add_llvm_tool_symlink(debuginfod llvm-debuginfod)
endif()

View File

@ -23,6 +23,7 @@
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/ThreadPool.h"
using namespace llvm;
@ -119,7 +120,7 @@ static void parseArgs(int argc, char **argv) {
HostInterface = Args.getLastArgValue(OPT_host_interface, "0.0.0.0");
}
int main(int argc, char **argv) {
int llvm_debuginfod_main(int argc, char **argv, const llvm::ToolContext &) {
InitLLVM X(argc, argv);
HTTPClient::initialize();
parseArgs(argc, argv);

View File

@ -25,6 +25,12 @@ target_sources(llvm-driver PRIVATE llvm-driver.cpp)
set_target_properties(llvm-driver PROPERTIES OUTPUT_NAME llvm)
target_link_libraries(llvm-driver PUBLIC ${LLVM_DRIVER_OBJLIBS})
target_link_libraries(llvm-driver PUBLIC LLVMDebuginfod)
if(LLVM_HAVE_LIBXAR)
# used by llvm-objdump
target_link_libraries(llvm-driver PUBLIC ${XAR_LIB})
endif()
if(APPLE)
# dsymutil uses some CoreFoundation stuff on Darwin...

View File

@ -18,4 +18,7 @@ add_public_tablegen_target(MLTableGen)
add_llvm_tool(llvm-ml
llvm-ml.cpp
Disassembler.cpp
DEPENDS
MLTableGen
GENERATE_DRIVER
)

View File

@ -35,6 +35,7 @@
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
@ -185,7 +186,7 @@ static int AssembleInput(StringRef ProgName, const Target *TheTarget,
return Res;
}
int main(int Argc, char **Argv) {
int llvm_ml_main(int Argc, char **Argv, const llvm::ToolContext &) {
InitLLVM X(Argc, Argv);
StringRef ProgName = sys::path::filename(Argv[0]);

View File

@ -34,11 +34,14 @@ add_llvm_tool(llvm-objdump
DEPENDS
ObjdumpOptsTableGen
OtoolOptsTableGen
GENERATE_DRIVER
)
target_link_libraries(llvm-objdump PRIVATE LLVMDebuginfod)
if(NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
target_link_libraries(llvm-objdump PRIVATE LLVMDebuginfod)
endif()
if(LLVM_HAVE_LIBXAR)
if(LLVM_HAVE_LIBXAR AND NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
target_link_libraries(llvm-objdump PRIVATE ${XAR_LIB})
endif()

View File

@ -73,6 +73,7 @@
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/StringSaver.h"
@ -3247,7 +3248,7 @@ static void parseObjdumpOptions(const llvm::opt::InputArgList &InputArgs) {
InputFilenames.push_back("a.out");
}
int main(int argc, char **argv) {
int llvm_objdump_main(int argc, char **argv, const llvm::ToolContext &) {
using namespace llvm;
InitLLVM X(argc, argv);

View File

@ -20,9 +20,12 @@ add_llvm_tool(llvm-symbolizer
DEPENDS
SymbolizerOptsTableGen
GENERATE_DRIVER
)
target_link_libraries(llvm-symbolizer PRIVATE LLVMDebuginfod)
if(NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
target_link_libraries(llvm-symbolizer PRIVATE LLVMDebuginfod)
endif()
add_llvm_tool_symlink(llvm-addr2line llvm-symbolizer)

View File

@ -34,6 +34,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/WithColor.h"
@ -395,7 +396,7 @@ static void filterMarkup(const opt::InputArgList &Args, LLVMSymbolizer &Symboliz
Filter.finish();
}
int main(int argc, char **argv) {
int llvm_symbolizer_main(int argc, char **argv, const llvm::ToolContext &) {
InitLLVM X(argc, argv);
sys::InitializeCOMRAII COM(sys::COMThreadingMode::MultiThreaded);