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

Andrés Villegas via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 18:10:03 PDT 2023


Author: Andrés Villegas
Date: 2023-08-17T01:01:31Z
New Revision: 2628fa3351b021d2ab82dcd833a14d7b52840a01

URL: https://github.com/llvm/llvm-project/commit/2628fa3351b021d2ab82dcd833a14d7b52840a01
DIFF: https://github.com/llvm/llvm-project/commit/2628fa3351b021d2ab82dcd833a14d7b52840a01.diff

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

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

Added: 
    

Modified: 
    llvm/tools/dsymutil/CMakeLists.txt
    llvm/tools/dsymutil/dsymutil.cpp
    llvm/tools/llvm-debuginfod/CMakeLists.txt
    llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
    llvm/tools/llvm-driver/CMakeLists.txt
    llvm/tools/llvm-ml/CMakeLists.txt
    llvm/tools/llvm-ml/llvm-ml.cpp
    llvm/tools/llvm-objdump/CMakeLists.txt
    llvm/tools/llvm-objdump/llvm-objdump.cpp
    llvm/tools/llvm-symbolizer/CMakeLists.txt
    llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/dsymutil/CMakeLists.txt b/llvm/tools/dsymutil/CMakeLists.txt
index 3cb88a50ce257b..f27056b01e48c4 100644
--- a/llvm/tools/dsymutil/CMakeLists.txt
+++ b/llvm/tools/dsymutil/CMakeLists.txt
@@ -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)
 

diff  --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp
index 20d11bceb05eed..9f62546b2467e3 100644
--- a/llvm/tools/dsymutil/dsymutil.cpp
+++ b/llvm/tools/dsymutil/dsymutil.cpp
@@ -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.

diff  --git a/llvm/tools/llvm-debuginfod/CMakeLists.txt b/llvm/tools/llvm-debuginfod/CMakeLists.txt
index d32c6826d7687e..6b0a1193d1b222 100644
--- a/llvm/tools/llvm-debuginfod/CMakeLists.txt
+++ b/llvm/tools/llvm-debuginfod/CMakeLists.txt
@@ -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()

diff  --git a/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp b/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
index 1869f2eb4bc6d4..b9e2c6747187e2 100644
--- a/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
+++ b/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
@@ -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);

diff  --git a/llvm/tools/llvm-driver/CMakeLists.txt b/llvm/tools/llvm-driver/CMakeLists.txt
index 23cc37354eaa35..1c473c99cc1bf1 100644
--- a/llvm/tools/llvm-driver/CMakeLists.txt
+++ b/llvm/tools/llvm-driver/CMakeLists.txt
@@ -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...

diff  --git a/llvm/tools/llvm-ml/CMakeLists.txt b/llvm/tools/llvm-ml/CMakeLists.txt
index 2b2a116a5fec36..fe01d24b83407e 100644
--- a/llvm/tools/llvm-ml/CMakeLists.txt
+++ b/llvm/tools/llvm-ml/CMakeLists.txt
@@ -18,4 +18,5 @@ add_public_tablegen_target(MLTableGen)
 add_llvm_tool(llvm-ml
   llvm-ml.cpp
   Disassembler.cpp
+  GENERATE_DRIVER
   )

diff  --git a/llvm/tools/llvm-ml/llvm-ml.cpp b/llvm/tools/llvm-ml/llvm-ml.cpp
index f8e4734be63658..4d6bd90d13ad52 100644
--- a/llvm/tools/llvm-ml/llvm-ml.cpp
+++ b/llvm/tools/llvm-ml/llvm-ml.cpp
@@ -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]);
 

diff  --git a/llvm/tools/llvm-objdump/CMakeLists.txt b/llvm/tools/llvm-objdump/CMakeLists.txt
index 65d2f92848dbcc..73c857085e65bf 100644
--- a/llvm/tools/llvm-objdump/CMakeLists.txt
+++ b/llvm/tools/llvm-objdump/CMakeLists.txt
@@ -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()
 

diff  --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 47a8941a009554..1e5175b527710b 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -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);
 

diff  --git a/llvm/tools/llvm-symbolizer/CMakeLists.txt b/llvm/tools/llvm-symbolizer/CMakeLists.txt
index a6bc047154c675..6f8de1f1f49437 100644
--- a/llvm/tools/llvm-symbolizer/CMakeLists.txt
+++ b/llvm/tools/llvm-symbolizer/CMakeLists.txt
@@ -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)
 

diff  --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
index f43aad6c4cf7c8..4c1c2f224984c7 100644
--- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -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);
 


        


More information about the llvm-commits mailing list