Skip to content

Commit

Permalink
[llvm-{debuginfod,ml,objdump,symbolizer}, dsymutil] Enable multicall …
Browse files Browse the repository at this point in the history
…driver

Differential Revision: https://reviews.llvm.org/D157670
  • Loading branch information
Andrés Villegas committed Aug 17, 2023
1 parent c296c35 commit d5ca900
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 10 deletions.
3 changes: 2 additions & 1 deletion llvm/tools/dsymutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/dsymutil/dsymutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion llvm/tools/llvm-debuginfod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 2 additions & 1 deletion llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions llvm/tools/llvm-driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
3 changes: 3 additions & 0 deletions llvm/tools/llvm-ml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ add_public_tablegen_target(MLTableGen)
add_llvm_tool(llvm-ml
llvm-ml.cpp
Disassembler.cpp
DEPENDS
MLTableGen
GENERATE_DRIVER
)
3 changes: 2 additions & 1 deletion llvm/tools/llvm-ml/llvm-ml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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]);

Expand Down
7 changes: 5 additions & 2 deletions llvm/tools/llvm-objdump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion llvm/tools/llvm-objdump/llvm-objdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);

Expand Down
5 changes: 4 additions & 1 deletion llvm/tools/llvm-symbolizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit d5ca900

Please sign in to comment.