diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt --- a/llvm/test/CMakeLists.txt +++ b/llvm/test/CMakeLists.txt @@ -82,6 +82,7 @@ llvm-install-name-tool llvm-jitlink llvm-lib + llvm-libtool-darwin llvm-link llvm-lipo llvm-locstats diff --git a/llvm/test/tools/llvm-libtool-darwin/help-message.test b/llvm/test/tools/llvm-libtool-darwin/help-message.test new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-libtool-darwin/help-message.test @@ -0,0 +1,10 @@ +## This test checks that the help message is displayed correctly. + +# RUN: llvm-libtool-darwin -h | FileCheck --check-prefix=LIBTOOL-USAGE %s --match-full-lines +# RUN: llvm-libtool-darwin --help | FileCheck --check-prefix=LIBTOOL-USAGE %s --match-full-lines +# RUN: not llvm-libtool-darwin -abcabc 2>&1 | FileCheck --check-prefix=UNKNOWN-ARG %s +# RUN: not llvm-libtool-darwin --abcabc 2>&1 | FileCheck --check-prefix=UNKNOWN-ARG %s + +# LIBTOOL-USAGE: USAGE: llvm-libtool-darwin [options] + +# UNKNOWN-ARG: Unknown command line argument '{{-+}}abcabc' diff --git a/llvm/tools/llvm-libtool-darwin/CMakeLists.txt b/llvm/tools/llvm-libtool-darwin/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/llvm/tools/llvm-libtool-darwin/CMakeLists.txt @@ -0,0 +1,9 @@ +set(LLVM_LINK_COMPONENTS + Object + Option + Support + ) + +add_llvm_tool(llvm-libtool-darwin + llvm-libtool-darwin.cpp +) diff --git a/llvm/tools/llvm-libtool-darwin/LLVMBuild.txt b/llvm/tools/llvm-libtool-darwin/LLVMBuild.txt new file mode 100644 --- /dev/null +++ b/llvm/tools/llvm-libtool-darwin/LLVMBuild.txt @@ -0,0 +1,20 @@ +;===- ./tools/llvm-libtool-darwin/LVMBuild.txt --------------------------*- Conf -*--===; +; +; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +; See https://llvm.org/LICENSE.txt for license information. +; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +; +;===------------------------------------------------------------------------===; +; +; This is an LLVMBuild description file for the components in this subdirectory. +; +; For more information on the LLVMBuild system, please see: +; +; http://llvm.org/docs/LLVMBuild.html +; +;===------------------------------------------------------------------------===; +[component_0] +type = Tool +name = llvm-libtool-darwin +parent = Tools +required_libraries = Object Option Support diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp new file mode 100644 --- /dev/null +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -0,0 +1,48 @@ +//===-- llvm-libtool-darwin.cpp - a tool for creating libraries --------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// A utility for creating static and dynamic libraries for Darwin. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Object/Archive.h" +#include "llvm/Object/ArchiveWriter.h" +#include "llvm/Object/Binary.h" +#include "llvm/Object/MachO.h" +#include "llvm/Object/MachOUniversal.h" +#include "llvm/Object/ObjectFile.h" +#include "llvm/Option/Arg.h" +#include "llvm/Option/ArgList.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/InitLLVM.h" +#include "llvm/Support/WithColor.h" + +using namespace llvm; +using namespace llvm::object; + +// The name this program was invoked as. +static StringRef ToolName; + +static cl::opt OutputFile("output", + cl::desc("Specify output filename"), + cl::value_desc("filename"), + cl::OneOrMore); +static cl::alias OutputFileShort("o", cl::desc("Alias for -output"), + cl::aliasopt(OutputFile)); + +static cl::list + InputFiles(cl::Positional, cl::desc(""), cl::OneOrMore); + +int main(int Argc, char **Argv) { + InitLLVM X(Argc, Argv); + ToolName = Argv[0]; + cl::ParseCommandLineOptions(Argc, Argv, "llvm-libtool\n"); + + return EXIT_SUCCESS; +}