diff options
Diffstat (limited to 'tools/llvm-stub')
-rw-r--r-- | tools/llvm-stub/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tools/llvm-stub/LLVMBuild.txt | 22 | ||||
-rw-r--r-- | tools/llvm-stub/Makefile | 15 | ||||
-rw-r--r-- | tools/llvm-stub/llvm-stub.c | 77 |
4 files changed, 0 insertions, 117 deletions
diff --git a/tools/llvm-stub/CMakeLists.txt b/tools/llvm-stub/CMakeLists.txt deleted file mode 100644 index a98dc9ed49a9..000000000000 --- a/tools/llvm-stub/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_llvm_tool(llvm-stub - llvm-stub.c - ) diff --git a/tools/llvm-stub/LLVMBuild.txt b/tools/llvm-stub/LLVMBuild.txt deleted file mode 100644 index 5c3534c106e5..000000000000 --- a/tools/llvm-stub/LLVMBuild.txt +++ /dev/null @@ -1,22 +0,0 @@ -;===- ./tools/llvm-stub/LLVMBuild.txt --------------------------*- Conf -*--===; -; -; The LLVM Compiler Infrastructure -; -; This file is distributed under the University of Illinois Open Source -; License. See LICENSE.TXT for details. -; -;===------------------------------------------------------------------------===; -; -; 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-stub -parent = Tools -required_libraries = diff --git a/tools/llvm-stub/Makefile b/tools/llvm-stub/Makefile deleted file mode 100644 index 077efa2d02f1..000000000000 --- a/tools/llvm-stub/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -##===- tools/llvm-stub/Makefile ----------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL := ../.. -TOOLNAME := llvm-stub -LINK_COMPONENTS := object - -include $(LEVEL)/Makefile.common - diff --git a/tools/llvm-stub/llvm-stub.c b/tools/llvm-stub/llvm-stub.c deleted file mode 100644 index 69cd6edbec57..000000000000 --- a/tools/llvm-stub/llvm-stub.c +++ /dev/null @@ -1,77 +0,0 @@ -/*===- llvm-stub.c - Stub executable to run llvm bitcode files ------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This tool is used by the gccld program to enable transparent execution of -// bitcode files by the user. Specifically, gccld outputs two files when asked -// to compile a <program> file: -// 1. It outputs the LLVM bitcode file to <program>.bc -// 2. It outputs a stub executable that runs lli on <program>.bc -// -// This allows the end user to just say ./<program> and have the JIT executed -// automatically. On unix, the stub executable emitted is actually a bourne -// shell script that does the forwarding. Windows does not like #!/bin/sh -// programs in .exe files, so we make it an actual program, defined here. -// -//===----------------------------------------------------------------------===*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "llvm/Config/config.h" - -#if defined(HAVE_UNISTD_H) && !defined(_MSC_VER) -#include <unistd.h> -#endif - -#ifdef _WIN32 -#include <process.h> -#include <io.h> -#endif - -int main(int argc, char** argv) { - const char *Interp = getenv("LLVMINTERP"); - const char **Args; - if (Interp == 0) Interp = "lli"; - - /* Set up the command line options to pass to the JIT. */ - Args = (const char**)malloc(sizeof(char*) * (argc+2)); - /* argv[0] is the JIT */ - Args[0] = Interp; - -#ifdef LLVM_ON_WIN32 - { - int len = strlen(argv[0]); - if (len < 4 || strcmp(argv[0] + len - 4, ".exe") != 0) { - /* .exe suffix is stripped off of argv[0] if the executable was run on the - * command line without one. Put it back on. - */ - argv[0] = strcat(strcpy((char*)malloc(len + 5), argv[0]), ".exe"); - } - } -#endif - - /* argv[1] is argv[0] + ".bc". */ - Args[1] = strcat(strcpy((char*)malloc(strlen(argv[0])+4), argv[0]), ".bc"); - - /* The rest of the args are as before. */ - memcpy((char **)Args+2, argv+1, sizeof(char*)*argc); - - /* Run the JIT. */ -#if !defined(_WIN32) || defined(__MINGW64__) - execvp(Interp, (char **)Args); /* POSIX execvp takes a char *const[]. */ -#else - execvp(Interp, Args); /* windows execvp takes a const char *const *. */ -#endif - /* if _execv returns, the JIT could not be started. */ - fprintf(stderr, "Could not execute the LLVM JIT. Either add 'lli' to your" - " path, or set the\ninterpreter you want to use in the LLVMINTERP " - "environment variable.\n"); - return 1; -} |