From 3c6f47d6b879ddd2842925d2e5da54657d9e5631 Mon Sep 17 00:00:00 2001 From: Alexandre Ganea <37383324+aganea@users.noreply.github.com> Date: Thu, 11 Jan 2024 19:08:28 -0500 Subject: [llvm-driver] Fix usage of `InitLLVM` on Windows (#76306) Previously, some tools such as `clang` or `lld` which require strict order for certain command-line options, such as `clang -cc1` or `lld -flavor`, would not longer work on Windows, when these tools were linked as part of `llvm-driver`. This was caused by `InitLLVM` which was part of the `*_main()` function of these tools, which in turn calls `windows::GetCommandLineArguments`. That function completly replaces argc/argv by new UTF-8 contents, so any ajustements to argc/argv made by `llvm-driver` prior to calling these tools was reset. `InitLLVM` is now called by the `llvm-driver`. Any tool that participates in (or is part of) the `llvm-driver` doesn't call `InitLLVM` anymore. --- llvm/tools/llvm-objcopy/llvm-objcopy.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'llvm/tools/llvm-objcopy/llvm-objcopy.cpp') diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp index 558359e..730f423 100644 --- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp @@ -42,7 +42,6 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/FileUtilities.h" -#include "llvm/Support/InitLLVM.h" #include "llvm/Support/LLVMDriver.h" #include "llvm/Support/Memory.h" #include "llvm/Support/Path.h" @@ -224,7 +223,6 @@ static Error executeObjcopy(ConfigManager &ConfigMgr) { } int llvm_objcopy_main(int argc, char **argv, const llvm::ToolContext &) { - InitLLVM X(argc, argv); ToolName = argv[0]; // Expand response files. -- cgit v1.1