Remove llvm-ld and llvm-stub (which is only used by llvm-ld).

llvm-ld is no longer useful and causes confusion and so it is being removed.

* Does not work very well on Windows because it must call a gcc like driver to
  assemble and link.
* Has lots of hard coded paths which are wrong on many systems.
* Does not understand most of ld's options.
* Can be partially replaced by llvm-link | opt | {llc | as, llc -filetype=obj} |
  ld, or fully replaced by Clang.

I know of no production use of llvm-ld, and hacking use should be
replaced by Clang's driver.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155147 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/docs/Bugpoint.html b/docs/Bugpoint.html
index 5454ff4..9794f2c 100644
--- a/docs/Bugpoint.html
+++ b/docs/Bugpoint.html
@@ -44,9 +44,9 @@
 causes the crash, and reduce the file down to a small example which triggers the
 crash.</p>
 
-<p>For detailed case scenarios, such as debugging <tt>opt</tt>,
-<tt>llvm-ld</tt>, or one of the LLVM code generators, see <a
-href="HowToSubmitABug.html">How To Submit a Bug Report document</a>.</p>
+<p>For detailed case scenarios, such as debugging <tt>opt</tt>, or one of the
+LLVM code generators, see <a href="HowToSubmitABug.html">How To Submit a Bug
+Report document</a>.</p>
 
 </div>
 
diff --git a/docs/CommandGuide/index.html b/docs/CommandGuide/index.html
index 5db7020..772a59f 100644
--- a/docs/CommandGuide/index.html
+++ b/docs/CommandGuide/index.html
@@ -63,9 +63,6 @@
 <li><a href="/cmds/llvm-prof.html"><b>llvm-prof</b></a> -
     format raw `<tt>llvmprof.out</tt>' data into a human-readable report</li>
 
-<li><a href="/cmds/llvm-ld.html"><b>llvm-ld</b></a> -
-    general purpose linker with loadable runtime optimization support</li>
-
 <li><a href="/cmds/llvm-config.html"><b>llvm-config</b></a> -
     print out LLVM compilation options, libraries, etc. as configured</li>
 
diff --git a/docs/CommandGuide/llvm-ld.pod b/docs/CommandGuide/llvm-ld.pod
deleted file mode 100644
index efa9ebd..0000000
--- a/docs/CommandGuide/llvm-ld.pod
+++ /dev/null
@@ -1,234 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-ld - LLVM linker
-
-=head1 SYNOPSIS
-
-B<llvm-ld> <options> <files>
-
-=head1 DESCRIPTION
-
-The B<llvm-ld> tool takes a set of LLVM bitcode files and links them
-together into a single LLVM bitcode file.  The output bitcode file can be
-another bitcode file or an executable bitcode program.  Using additional
-options, B<llvm-ld> is able to produce native code executables.
-
-The B<llvm-ld> tool is the main linker for LLVM. It is used to link together
-the output of LLVM front-end compilers and run "link time" optimizations (mostly
-the inter-procedural kind).
-
-The B<llvm-ld> tools attempts to mimic the interface provided by the default
-system linker so that it can act as a I<drop-in> replacement.
-
-=head2 Search Order
-
-When looking for objects specified on the command line, B<llvm-ld> will search 
-for the object first in the current directory and then in the directory 
-specified by the B<LLVM_LIB_SEARCH_PATH> environment variable.  If it cannot 
-find the object, it fails.
-
-When looking for a library specified with the B<-l> option, B<llvm-ld> first
-attempts to load a file with that name from the current directory.  If that
-fails, it looks for libI<library>.bc, libI<library>.a, or libI<library>.I<shared
-library extension>, in that order, in each directory added to the library search
-path with the B<-L> option.  These directories are searched in the order they
-are specified.  If the library cannot be located, then B<llvm-ld> looks in the
-directory specified by the B<LLVM_LIB_SEARCH_PATH> environment variable.  If it
-does not find a library there, it fails.
-
-The I<shared library extension> may be I<.so>, I<.dyld>, I<.dll>, or something
-different, depending upon the system.
-
-The B<-L> option is global.  It does not matter where it is specified in the
-list of command line arguments; the directory is simply added to the search path
-and is applied to all libraries, preceding or succeeding, in the command line.
-
-=head2 Link order
-
-All object and bitcode files are linked first in the order they were 
-specified on the command line.  All library files are linked next.  
-Some libraries may not be linked into the object program; see below.
-
-=head2 Library Linkage
-
-Object files and static bitcode objects are always linked into the output
-file.  Library archives (.a files) load only the objects within the archive
-that define symbols needed by the output file.  Hence, libraries should be
-listed after the object files and libraries which need them; otherwise, the
-library may not be linked in, and the dependent library will not have its
-undefined symbols defined.
-
-=head2 Native code generation
-
-The B<llvm-ld> program has limited support for native code generation, when
-using the B<-native> or B<-native-cbe> options. Native code generation is
-performed by converting the linked bitcode into native assembly (.s) or C code
-and running the system compiler (typically gcc) on the result.
-
-=head1 OPTIONS
-
-=head2 General Options
-
-=over 
-
-=item B<-help>
-
-Print a summary of command line options.
-
-=item B<-v>
-
-Specifies verbose mode. In this mode the linker will print additional
-information about the actions it takes, programs it executes, etc. 
-
-=item B<-stats>
-
-Print statistics.
-
-=item B<-time-passes>
-
-Record the amount of time needed for each pass and print it to standard
-error.
-
-=back 
-
-=head2 Input/Output Options
-
-=over
-
-=item B<-o> F<filename>
-
-This overrides the default output file and specifies the name of the file that
-should be generated by the linker. By default, B<llvm-ld> generates a file named
-F<a.out> for compatibility with B<ld>. The output will be written to
-F<filename>.
-
-=item B<-b> F<filename>
-
-This option can be used to override the output bitcode file name. By default, 
-the name of the bitcode output file is one more ".bc" suffix added to the name 
-specified by B<-o filename> option.
-
-=item B<-l>F<name>
-
-This option specifies the F<name> of a library to search when resolving symbols
-for the program. Only the base name should be specified as F<name>, without a
-F<lib> prefix or any suffix. 
-
-=item B<-L>F<Path>
-
-This option tells B<llvm-ld> to look in F<Path> to find any library subsequently
-specified with the B<-l> option. The paths will be searched in the order in
-which they are specified on the command line. If the library is still not found,
-a small set of system specific directories will also be searched. Note that
-libraries specified with the B<-l> option that occur I<before> any B<-L> options
-will not search the paths given by the B<-L> options following it.
-
-=item B<-link-as-library>
-
-Link the bitcode files together as a library, not an executable. In this mode,
-undefined symbols will be permitted.
-
-=item B<-r>
-
-An alias for -link-as-library.
-
-=item B<-native>
-
-Generate a native machine code executable.
-
-When generating native executables, B<llvm-ld> first checks for a bitcode
-version of the library and links it in, if necessary.  If the library is
-missing, B<llvm-ld> skips it.  Then, B<llvm-ld> links in the same
-libraries as native code.
-
-In this way, B<llvm-ld> should be able to link in optimized bitcode
-subsets of common libraries and then link in any part of the library that
-hasn't been converted to bitcode.
-
-=item B<-native-cbe>
-
-Generate a native machine code executable with the LLVM C backend.
-      
-This option is identical to the B<-native> option, but uses the
-C backend to generate code for the program instead of an LLVM native
-code generator.
-
-=back
-
-=head2 Optimization Options
-
-=over 
-
-=item B<-disable-inlining>
-
-Do not run the inlining pass. Functions will not be inlined into other
-functions.
-
-=item B<-disable-opt>
-
-Completely disable optimization.
-
-=item B<-disable-internalize>
-
-Do not mark all symbols as internal.
-
-=item B<-verify-each>
-
-Run the verification pass after each of the passes to verify intermediate
-results.
-
-=item B<-strip-all>
-
-Strip all debug and symbol information from the executable to make it smaller.
-
-=item B<-strip-debug>
-
-Strip all debug information from the executable to make it smaller.
-
-=item B<-s>
-
-An alias for B<-strip-all>.
-
-=item B<-S>
-
-An alias for B<-strip-debug>.
-
-=item B<-export-dynamic>
-
-An alias for B<-disable-internalize>
-
-=item B<-post-link-opt>F<Path>
-
-Run post-link optimization program. After linking is completed a bitcode file
-will be generated. It will be passed to the program specified by F<Path> as the
-first argument. The second argument to the program will be the name of a
-temporary file into which the program should place its optimized output. For
-example, the "no-op optimization" would be a simple shell script:
-
-    #!/bin/bash
-    cp $1 $2
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-ld> succeeds, it will exit with 0 return code.  If an error occurs,
-it will exit with a non-zero return code.
-
-=head1 ENVIRONMENT
-
-The C<LLVM_LIB_SEARCH_PATH> environment variable is used to find bitcode
-libraries. Any paths specified in this variable will be searched after the C<-L>
-options.
-
-=head1 SEE ALSO
-
-L<llvm-link|llvm-link>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org/>).
-
-=cut
diff --git a/docs/FAQ.html b/docs/FAQ.html
index 74e8534..2a46a9e 100644
--- a/docs/FAQ.html
+++ b/docs/FAQ.html
@@ -19,9 +19,6 @@
 <ol>
   <li><a href="#license">License</a>
   <ol>
-    <li>Why are the LLVM source code and the front-end distributed under
-        different licenses?</li>
-
     <li>Does the University of Illinois Open Source License really qualify as an
        "open source" license?</li>
 
@@ -72,8 +69,6 @@
     <li>After Subversion update, rebuilding gives the error "No rule to make
         target".</li>
 
-    <li><a href="#srcdir-objdir">When I compile LLVM-GCC with srcdir == objdir,
-        it fails. Why?</a></li>
   </ol></li>
 
   <li><a href="#felangs">Source Languages</a>
@@ -91,30 +86,17 @@
       instruction. Help!</a></li>
   </ol>
 
-  <li><a href="#cfe">Using the GCC Front End</a>
+  <li><a href="#cfe">Using the C and C++ Front Ends</a>
   <ol>
-    <li>When I compile software that uses a configure script, the configure
-        script thinks my system has all of the header files and libraries it is
-        testing for.  How do I get configure to work correctly?</li>
-
-    <li>When I compile code using the LLVM GCC front end, it complains that it
-        cannot find libcrtend.a?</li>
-
-    <li>How can I disable all optimizations when compiling code using the LLVM
-        GCC front end?</li>
-
-    <li><a href="#translatecxx">Can I use LLVM to convert C++ code to C
-        code?</a></li>
-
     <li><a href="#platformindependent">Can I compile C or C++ code to
         platform-independent LLVM bitcode?</a></li>
   </ol>
   </li>
 
-  <li><a href="#cfe_code">Questions about code generated by the GCC front-end</a>
+  <li><a href="#cfe_code">Questions about code generated by the demo page</a>
   <ol>
      <li><a href="#iosinit">What is this <tt>llvm.global_ctors</tt> and
-          <tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I
+          <tt>_GLOBAL__I_a...</tt> stuff that happens when I
           #include &lt;iostream&gt;?</a></li>
 
      <li><a href="#codedce">Where did all of my code go??</a></li>
@@ -143,19 +125,6 @@
 <div>
 
 <div class="question">
-<p>Why are the LLVM source code and the front-end distributed under different
-   licenses?</p>
-</div>
-	
-<div class="answer">
-<p>The C/C++ front-ends are based on GCC and must be distributed under the GPL.
-   Our aim is to distribute LLVM source code under a <em>much less
-   restrictive</em> license, in particular one that does not compel users who
-   distribute tools based on modifying the source to redistribute the modified
-   source code as well.</p>
-</div>
-
-<div class="question">
 <p>Does the University of Illinois Open Source License really qualify as an
    "open source" license?</p>
 </div>
@@ -219,12 +188,9 @@
 <p>Some porting problems may exist in the following areas:</p>
 
 <ul>
-  <li>The GCC front end code is not as portable as the LLVM suite, so it may not
-      compile as well on unsupported platforms.</li>
-
-  <li>The LLVM build system relies heavily on UNIX shell tools, like the Bourne
-      Shell and sed.  Porting to systems without these tools (MacOS 9, Plan 9)
-      will require more effort.</li>
+  <li>The autoconf/makefile build system relies heavily on UNIX shell tools,
+      like the Bourne Shell and sed.  Porting to systems without these tools
+      (MacOS 9, Plan 9) Will require more effort.</li>
 </ul>
 
 </div>
@@ -256,7 +222,7 @@
 
 <div class="question">
 <p>The <tt>configure</tt> script finds the right C compiler, but it uses the
-   LLVM linker from a previous build.  What do I do?</p>
+   LLVM tools from a previous build.  What do I do?</p>
 </div>
 
 <div class="answer">
@@ -426,25 +392,6 @@
    rebuilding.</p>
 </div>
 
-<div class="question">
-<p><a name="srcdir-objdir">When I compile LLVM-GCC with srcdir == objdir, it
-   fails. Why?</a></p>
-</div>
-
-<div class="answer">
-<p>The <tt>GNUmakefile</tt> in the top-level directory of LLVM-GCC is a special
-   <tt>Makefile</tt> used by Apple to invoke the <tt>build_gcc</tt> script after
-   setting up a special environment. This has the unfortunate side-effect that
-   trying to build LLVM-GCC with srcdir == objdir in a "non-Apple way" invokes
-   the <tt>GNUmakefile</tt> instead of <tt>Makefile</tt>. Because the
-   environment isn't set up correctly to do this, the build fails.</p>
-
-<p>People not building LLVM-GCC the "Apple way" need to build LLVM-GCC with
-   srcdir != objdir, or simply remove the GNUmakefile entirely.</p>
-
-<p>We regret the inconvenience.</p>
-</div>
-
 </div>
 
 <!-- *********************************************************************** -->
@@ -460,12 +407,8 @@
 
 <div class="answer">
 <p>LLVM currently has full support for C and C++ source languages. These are
-   available through a special version of GCC that LLVM calls the
-   <a href="#cfe">C Front End</a></p>
-
-<p>There is an incomplete version of a Java front end available in the
-   <tt>java</tt> module. There is no documentation on this yet so you'll need to
-   download the code, compile it, and try it.</p>
+   available through both <a href="http://clang.llvm.org/">Clang</a> and
+   <a href="http://dragonegg.llvm.org/">DragonEgg</a>.</p>
 
 <p>The PyPy developers are working on integrating LLVM into the PyPy backend so
    that PyPy language can translate to LLVM.</p>
@@ -558,142 +501,12 @@
 
 <!-- *********************************************************************** -->
 <h2>
-  <a name="cfe">Using the GCC Front End</a>
+  <a name="cfe">Using the C and C++ Front Ends</a>
 </h2>
 
 <div>
 
 <div class="question">
-<p>When I compile software that uses a configure script, the configure script
-   thinks my system has all of the header files and libraries it is testing for.
-   How do I get configure to work correctly?</p>
-</div>
-
-<div class="answer">
-<p>The configure script is getting things wrong because the LLVM linker allows
-   symbols to be undefined at link time (so that they can be resolved during JIT
-   or translation to the C back end).  That is why configure thinks your system
-   "has everything."</p>
-
-<p>To work around this, perform the following steps:</p>
-
-<ol>
-  <li>Make sure the CC and CXX environment variables contains the full path to
-      the LLVM GCC front end.</li>
-
-  <li>Make sure that the regular C compiler is first in your PATH. </li>
-
-  <li>Add the string "-Wl,-native" to your CFLAGS environment variable.</li>
-</ol>
-
-<p>This will allow the <tt>llvm-ld</tt> linker to create a native code
-   executable instead of shell script that runs the JIT.  Creating native code
-   requires standard linkage, which in turn will allow the configure script to
-   find out if code is not linking on your system because the feature isn't
-   available on your system.</p>
-</div>
-
-<div class="question">
-<p>When I compile code using the LLVM GCC front end, it complains that it cannot
-   find libcrtend.a.
-</p>
-</div>
-
-<div class="answer">
-<p>The only way this can happen is if you haven't installed the runtime
-   library. To correct this, do:</p>
-
-<pre class="doc_code">
-% cd llvm/runtime
-% make clean ; make install-bytecode
-</pre>
-</div>
-
-<div class="question">
-<p>How can I disable all optimizations when compiling code using the LLVM GCC
-   front end?</p>
-</div>
-
-<div class="answer">
-<p>Passing "-Wa,-disable-opt -Wl,-disable-opt" will disable *all* cleanup and
-   optimizations done at the llvm level, leaving you with the truly horrible
-   code that you desire.</p>
-</div>
-
-
-<div class="question">
-<p><a name="translatecxx">Can I use LLVM to convert C++ code to C code?</a></p>
-</div>
-
-<div class="answer">
-<p>Yes, you can use LLVM to convert code from any language LLVM supports to C.
-   Note that the generated C code will be very low level (all loops are lowered
-   to gotos, etc) and not very pretty (comments are stripped, original source
-   formatting is totally lost, variables are renamed, expressions are
-   regrouped), so this may not be what you're looking for. Also, there are
-   several limitations noted below.<p>
-
-<p>Use commands like this:</p>
-
-<ol>
-  <li><p>Compile your program with llvm-g++:</p>
-
-<pre class="doc_code">
-% llvm-g++ -emit-llvm x.cpp -o program.bc -c
-</pre>
-
-      <p>or:</p>
-
-<pre class="doc_code">
-% llvm-g++ a.cpp -c -emit-llvm
-% llvm-g++ b.cpp -c -emit-llvm
-% llvm-ld a.o b.o -o program
-</pre>
-
-   <p>This will generate program and program.bc.  The .bc
-      file is the LLVM version of the program all linked together.</p></li>
-
-  <li><p>Convert the LLVM code to C code, using the LLC tool with the C
-      backend:</p>
-
-<pre class="doc_code">
-% llc -march=c program.bc -o program.c
-</pre></li>
-
-  <li><p>Finally, compile the C file:</p>
-
-<pre class="doc_code">
-% cc x.c -lstdc++
-</pre></li>
-
-</ol>
-
-<p>Using LLVM does not eliminate the need for C++ library support.  If you use
-   the llvm-g++ front-end, the generated code will depend on g++'s C++ support
-   libraries in the same way that code generated from g++ would.  If you use
-   another C++ front-end, the generated code will depend on whatever library
-   that front-end would normally require.</p>
-
-<p>If you are working on a platform that does not provide any C++ libraries, you
-   may be able to manually compile libstdc++ to LLVM bitcode, statically link it
-   into your program, then use the commands above to convert the whole result
-   into C code.  Alternatively, you might compile the libraries and your
-   application into two different chunks of C code and link them.</p>
-
-<p>Note that, by default, the C back end does not support exception handling.
-   If you want/need it for a certain program, you can enable it by passing
-   "-enable-correct-eh-support" to the llc program.  The resultant code will use
-   setjmp/longjmp to implement exception support that is relatively slow, and
-   not C++-ABI-conforming on most platforms, but otherwise correct.</p>
-
-<p>Also, there are a number of other limitations of the C backend that cause it
-   to produce code that does not fully conform to the C++ ABI on most
-   platforms. Some of the C++ programs in LLVM's test suite are known to fail
-   when compiled with the C back end because of ABI incompatibilities with
-   standard C++ libraries.</p>
-</div>
-
-<div class="question">
 <p><a name="platformindependent">Can I compile C or C++ code to
    platform-independent LLVM bitcode?</a></p>
 </div>
@@ -719,14 +532,14 @@
 
 <!-- *********************************************************************** -->
 <h2>
-  <a name="cfe_code">Questions about code generated by the GCC front-end</a>
+  <a name="cfe_code">Questions about code generated by the demo page</a>
 </h2>
 
 <div>
 
 <div class="question">
 <p><a name="iosinit">What is this <tt>llvm.global_ctors</tt> and
-   <tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I <tt>#include
+   <tt>_GLOBAL__I_a...</tt> stuff that happens when I <tt>#include
    &lt;iostream&gt;</tt>?</a></p>
 </div>
 
diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html
index 2bc17ea..561645f 100644
--- a/docs/GettingStarted.html
+++ b/docs/GettingStarted.html
@@ -1510,12 +1510,6 @@
   <dd>The disassembler transforms the LLVM bitcode to human readable 
   LLVM assembly.</dd>
 
-  <dt><tt><b>llvm-ld</b></tt></dt>
-  <dd><tt>llvm-ld</tt> is a general purpose and extensible linker for LLVM. 
-  It performs standard link time optimizations and allows optimization
-  modules to be loaded and run so that language specific optimizations can 
-  be applied at link time.</dd>
-
   <dt><tt><b>llvm-link</b></tt></dt>
   <dd><tt>llvm-link</tt>, not surprisingly, links multiple LLVM modules into 
   a single program.</dd>
diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html
index 54cfa20..e5f3047 100644
--- a/docs/ReleaseNotes.html
+++ b/docs/ReleaseNotes.html
@@ -604,6 +604,7 @@
 <ul>
   <li>llvm-stress is a command line tool for generating random .ll files to fuzz
       different LLVM components. </li>
+  <li>llvm-ld has been removed.  Use llvm-link or Clang instead.</li>
   <li>....</li>
 </ul>
 
diff --git a/docs/tutorial/LangImpl4.html b/docs/tutorial/LangImpl4.html
index 77c9dbe..d2cac62 100644
--- a/docs/tutorial/LangImpl4.html
+++ b/docs/tutorial/LangImpl4.html
@@ -253,10 +253,9 @@
 <p>LLVM provides a wide variety of optimizations that can be used in certain
 circumstances.  Some <a href="../Passes.html">documentation about the various 
 passes</a> is available, but it isn't very complete.  Another good source of
-ideas can come from looking at the passes that <tt>llvm-gcc</tt> or
-<tt>llvm-ld</tt> run to get started.  The "<tt>opt</tt>" tool allows you to 
-experiment with passes from the command line, so you can see if they do
-anything.</p>
+ideas can come from looking at the passes that <tt>Clang</tt> runs to get
+started.  The "<tt>opt</tt>" tool allows you to experiment with passes from the
+command line, so you can see if they do anything.</p>
 
 <p>Now that we have reasonable code coming out of our front-end, lets talk about
 executing it!</p>
diff --git a/docs/tutorial/OCamlLangImpl4.html b/docs/tutorial/OCamlLangImpl4.html
index fd2b5ad..dd31ded 100644
--- a/docs/tutorial/OCamlLangImpl4.html
+++ b/docs/tutorial/OCamlLangImpl4.html
@@ -270,10 +270,9 @@
 <p>LLVM provides a wide variety of optimizations that can be used in certain
 circumstances.  Some <a href="../Passes.html">documentation about the various
 passes</a> is available, but it isn't very complete.  Another good source of
-ideas can come from looking at the passes that <tt>llvm-gcc</tt> or
-<tt>llvm-ld</tt> run to get started.  The "<tt>opt</tt>" tool allows you to
-experiment with passes from the command line, so you can see if they do
-anything.</p>
+ideas can come from looking at the passes that <tt>Clang</tt> runs to get
+started.  The "<tt>opt</tt>" tool allows you to experiment with passes from the
+command line, so you can see if they do anything.</p>
 
 <p>Now that we have reasonable code coming out of our front-end, lets talk about
 executing it!</p>