Commit Graph

167 Commits

Author SHA1 Message Date
Chris Lattner
cb9048a6e8 Preserve CC's when linking modules
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21799 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 01:09:39 +00:00
Misha Brukman
f976c856fc Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:55:34 +00:00
Chris Lattner
c72e57314a fix some 80 column violations
Add support for programs that define main in a .a file, such as f2c'd programs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20631 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 23:03:34 +00:00
Chris Lattner
fc82ef6797 consolidate LinkFiles into LinkItems, use lib_* iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20630 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 22:55:17 +00:00
Chris Lattner
ad988f397d consolidate LinkLibraries into LinkItems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20629 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 22:51:40 +00:00
Chris Lattner
e4d5c441e0 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 04:54:21 +00:00
Chris Lattner
97716a47a1 Add support for ".so" files compiled with LLVM which contain LLVM bytecode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20253 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-19 18:30:29 +00:00
Chris Lattner
b9476d9b45 Eliminate silly warnings from the linker of the form:
WARNING: Type conflict between types named 'union.._604.'.
    Src=' %union.._604.'.
   Dest=' %union.._604.'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20252 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-19 17:52:37 +00:00
Chris Lattner
12945acd4a Minor cleanup. No need to explicitly tell the compiler the template arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20153 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 17:50:16 +00:00
Chris Lattner
50c301b9bb Print something useful for gccld -v with an archive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20148 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-13 15:26:14 +00:00
Chris Lattner
e6f8c5a716 Allow globals to be of different const'nesses when we link.
This finally resolves PR502, PR450,
and test/Regression/Linker/2005-02-12-ConstantGlobals{,-2}.ll correctly


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20135 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-12 19:20:28 +00:00
Reid Spencer
4ca8e71068 Remove un-needed #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19061 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 04:15:44 +00:00
Reid Spencer
a834f5d793 Fix a compile error. config.h is now needed because DataTypes.h doesn't
include it any more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18993 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-16 19:19:24 +00:00
Reid Spencer
903f21dd39 * Fix header block.
* Fix loop style per standards
* Don't create a new Module when the Linker's module is released.
* Add/fix function comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18871 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:50:50 +00:00
Reid Spencer
ff5f3ab9fe Add missing space in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18870 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:23:13 +00:00
Reid Spencer
04f5412496 Fix header and function comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18867 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:13:18 +00:00
Reid Spencer
de4cedca14 This file contains basic Linker facilities needed by all tools
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18860 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:00:28 +00:00
Reid Spencer
0ba9e211be Make LinkModules a static member function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18859 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:00:16 +00:00
Reid Spencer
7a87ce043b This file contains only the Linker's library linking support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18858 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:00:04 +00:00
Reid Spencer
e84de29663 For PR351: \
* Remove redundant static function LinkOneLibrary. \
* Remove unneded #includes \
* Convert FileSupport usage to sys::Path instead


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18857 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 02:59:52 +00:00
Reid Spencer
3ece6397cb This file contains only the Linker's file linking support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18856 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 02:59:41 +00:00
Reid Spencer
7dde0e3b05 For PR351: \
* Convert functions to Linker:: methods. \
* Remove unneeded #includes \
* Utilize sys::Path utilities not FileSupport utilities \
* Move File & Library linking functions to other source files


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18855 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 02:59:29 +00:00
Chris Lattner
152f19ac65 Make sure to link the target-triple as well, so it ends up in the .llvm.bc file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18774 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 20:26:15 +00:00
Chris Lattner
b2abb26fe1 Turn this error back into a warning, fixing the povray regression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18655 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 20:01:10 +00:00
Chris Lattner
d37a75b9be Revert this disgusting hack, John has a much nicer solution
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18611 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 03:31:14 +00:00
Chris Lattner
a6a2bdd0e0 Add a disgusting hack to work around a libstdc++ issue. This code should
be removed when PR400 is resolved.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18610 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 03:28:51 +00:00
Reid Spencer
4bdf1c9855 Fix PR139: \
Implement LinkItems and BuildLinkItems interfaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18547 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-05 19:14:55 +00:00
Chris Lattner
c8ef1edc63 Fix linkage of mismatched weak globals. This unbreaks 300.twolf
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18494 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-04 18:54:48 +00:00
Chris Lattner
aee38ea569 Significantly rework linker support for global variables, allowing it to
correctly link globals whose LLVM types do not match.

This fixes several of the F2C SPEC FP benchmarks, which were failing this
due to the implementation of common blocks used by f2c.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18465 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-03 22:18:41 +00:00
Reid Spencer
be0b356593 PR466:
* Make the linker find lib*.bca files now instead of lib*.bc since those
  are what the makefiles now generate for bytecode archives.
* Make sure the linker only links archives when LinkLibraries is called.
  Previously if it found a lib*.bc file and that file was a bytecode file,
  it would link in the entire bytecode. This could make -lc -lc fail with
  duplicate symbols error but it shouldn't as searching multiple libraries,
  even the same one more than once, is permitted.
* Now that the above problems are corrected, implement the dependent libs
  feature. After the module is linked with all specified libraries, the
  LinkLibraries function will obtain the set of dependent libraries from
  the linked modules and attemp to find and link against those libraries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18428 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 09:52:10 +00:00
Reid Spencer
0022b83491 Revert version 1.39. It breaks the ordering of the library processing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18399 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 22:54:48 +00:00
Reid Spencer
a564845f83 Shared library extension is now in LTDL_SHLIB_EXT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18353 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-29 12:40:21 +00:00
Reid Spencer
53c4c5672c Implement dependent library linking. It is no longer required that -lstdc++
-lstdsup++ no -lc be passed on the command line to llvm linkers if the
progam being linked was compiled with the C/C++ Front End or Stacker.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18243 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 09:32:08 +00:00
Reid Spencer
719012d625 Remove blank comment lines for uniformity.
Make sure lines don't exceed 80 cols.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18242 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 09:29:44 +00:00
Reid Spencer
b9371ce552 Eliminate unsightly ;;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17979 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 03:27:05 +00:00
Reid Spencer
3cf2c32202 Reduce the amount of work in LinkInArchive by not searching the archive for
symbols it has already identified as not defining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17975 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 03:13:25 +00:00
Chris Lattner
a63acbfeab Don't increment a dead iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17904 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 19:04:40 +00:00
Chris Lattner
0033baf94e Simplify the remapper by only needing one map, since the body of the functions
being linked do not need to be remapped any longer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17900 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 17:12:38 +00:00
Chris Lattner
4bbfbff119 Take advantage of the fact that we are allowed to clobber the input module
by splicing function bodies from the src module to the destination module.

This speeds up linking quite a bit, e.g. gccld time on 176.gcc from 26s -> 20s
when forming the .rbc file, with a profile build.  One of the really strange
but cool effects of this patch is that it speeds up the optimizers as well,
from 12s -> 10.7s, presumably because of better locality???

In any case, this is just a first step.  We can trivially get rid of the
LocalMap now and do other simplifications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17893 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 07:31:51 +00:00
Reid Spencer
99d3604acf Per code review:\
* Adjust indentation\
* Ensure memory do not leak if exceptions happen (std::auto_ptr use)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17885 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:47:41 +00:00
Chris Lattner
242e525edc The second arg may be clobbered by this function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17880 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:41:36 +00:00
Chris Lattner
a4d0c6fb94 use an autoptr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17875 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 06:40:54 +00:00
Reid Spencer
6238a85e4f Remove a forgotten debug output line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17810 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 23:49:55 +00:00
Reid Spencer
7cc371a795 Linker.h moved to include/llvm from include/llvm/Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 23:27:04 +00:00
Reid Spencer
605b9e2c5b Linker.h has a new home.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17801 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 23:00:08 +00:00
Reid Spencer
a455cca62f Don't bother with a re-linked library, ensure archive library is built.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17773 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:03:14 +00:00
Reid Spencer
8bbb17abe6 *Adjust prototypes for public interface. *Rewrite LinkInArchive to use symbol tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17772 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:02:27 +00:00
Reid Spencer
5c911ab6f1 Makefile for lib/Linker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17695 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 20:38:45 +00:00
Reid Spencer
7f49602e5a This file originated in lib/VMCore/Linker.cpp but now lives in
lib/Linker/LinkModules.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17694 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 20:37:43 +00:00
Reid Spencer
c408c45900 This file originated in tools/gccld/Linker.cpp but now lives in
lib/Linker/LinkArchives.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17693 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 20:34:32 +00:00