1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

374 Commits

Author SHA1 Message Date
Chris Lattner
d31cacb5d6 implement linking of globals to functions, in one direction
(replacing a function with a global).  This is needed when building
llvm itself with LTO on darwin, because of the EXPLICIT_SYMBOL hack
in lib/system/DynamicLibrary.cpp.

Implementation of linking the other way will need to wait for a 
cleanup of LinkFunctionProtos.

llvm-svn: 53546
2008-07-14 06:49:45 +00:00
Chris Lattner
c68c953e71 wrap long lines, remove some code from a non-assert build.
llvm-svn: 53545
2008-07-14 05:52:33 +00:00
Chris Lattner
6d7c5fa8dc The source and dest of an alias are *not* required to have the same type,
though that would be nice and make sense :).  Patch by Nathan Keynes!

llvm-svn: 53387
2008-07-10 01:09:33 +00:00
Dan Gohman
c97817aac3 Make DenseMap's insert return a pair, to more closely resemble std::map.
llvm-svn: 53177
2008-07-07 17:46:23 +00:00
Anton Korobeynikov
47e1a76977 Add convenient helper for checking whether global is weak in linker sense
having weak or linkonce or common or extweak LLVM linkage.

llvm-svn: 53158
2008-07-05 23:48:30 +00:00
Anton Korobeynikov
302db24cf1 Override weak stuff during linking of aliases. This fixes PR2463.
llvm-svn: 53156
2008-07-05 23:33:22 +00:00
Anton Korobeynikov
3593f9f7f1 Properly link alias and function decls. This fixes PR2146
llvm-svn: 53154
2008-07-05 23:03:21 +00:00
Chris Lattner
f40ef5f964 when linking globals, make sure to preserve the address space of the global.
llvm-svn: 52810
2008-06-27 03:10:24 +00:00
Chris Lattner
9ab7735924 Fix an error handling redefinition of linkonce functions where the
types differ.  Patch by Nathan Keynes!

llvm-svn: 52527
2008-06-20 05:29:39 +00:00
Chris Lattner
468adb09d7 Add a missing ~ (dtor became ctor) which caused crashes on a bunch of stuff.
llvm-svn: 52374
2008-06-16 23:06:51 +00:00
Chris Lattner
6782f56054 stop making PATypeHolder's so crazily.
llvm-svn: 52364
2008-06-16 21:17:12 +00:00
Chris Lattner
3dfc439a87 use a real associative container for type association instead of using
a vector with a linear search.  This speeds up the linking testcase 
in PR1860 from 0.965s to 0.385s on my system.

llvm-svn: 52357
2008-06-16 21:00:18 +00:00
Chris Lattner
f87729aa1f bail out sooner if we have two concrete but different types.
llvm-svn: 52351
2008-06-16 20:03:01 +00:00
Chris Lattner
896c38c96a simplify some code.
llvm-svn: 52350
2008-06-16 19:55:40 +00:00
Chris Lattner
fe3ddf06a8 Apply a patch from Nathan Keynes, which speeds up llvm-link on
the testcases in PR1860 from taking more than 1 hour (when I killed it)
to taking 1s.

llvm-svn: 52347
2008-06-16 19:48:08 +00:00
Chris Lattner
1a604edf16 handle vectors. Any integers that got here would necessarily be different already.
llvm-svn: 52341
2008-06-16 18:27:53 +00:00
Chris Lattner
c24aba4724 Simplify ResolveTypes by pulling the null case out into the one
client that cares and simplifying its control flow.

Remove the DestST argument to ResolveTypes and RecursiveResolveTypes*
which are dead now.

llvm-svn: 52340
2008-06-16 18:19:05 +00:00
Chris Lattner
cebf7d79b3 simplify RecursiveResolveTypes and ResolveTypes by pulling the naming out of
ResolveTypes into the one place that needs it.

llvm-svn: 52338
2008-06-16 18:11:40 +00:00
Chris Lattner
96dec66124 use 'continue' to make the function linker simpler. When linking a strong
function into a weak function, zap the weak function body so that the
strong one overrides it.  This fixes PR2410

llvm-svn: 52135
2008-06-09 07:47:34 +00:00
Chris Lattner
4c99f72771 minor changes to short circuit the 'no linkage' case earlier for
function bodies.  We now don't try to unify types or handling type
mismatches if when linking an internal foo to an external foo.

llvm-svn: 52134
2008-06-09 07:36:11 +00:00
Chris Lattner
744e896c06 simplify function visibility handling.
llvm-svn: 52133
2008-06-09 07:25:28 +00:00
Duncan Sands
fa995d7cc5 Factor code to copy global value attributes like
the section or the visibility from one global
value to another: copyAttributesFrom.  This is
particularly useful for duplicating functions:
previously this was done by explicitly copying
each attribute in turn at each place where a
new function was created out of an old one, with
the result that obscure attributes were regularly
forgotten (like the collector or the section).
Hopefully now everything is uniform and nothing
is forgotten.

llvm-svn: 51567
2008-05-26 19:58:59 +00:00
Gabor Greif
48ffb6c7dc Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
llvm-svn: 51143
2008-05-15 10:04:30 +00:00
Dale Johannesen
768b6f281e Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences
in some cases on Darwin, so we need both.  The intent
is that "common" will behave identically to "weak" unless
somebody changes their target to do something else.
No functional change as yet.

llvm-svn: 51118
2008-05-14 20:12:51 +00:00
Anton Korobeynikov
0f39a96feb Fix linking of internal aliases
llvm-svn: 50950
2008-05-10 14:41:43 +00:00
Anton Korobeynikov
ddb93e7a02 Turn StripPointerCast() into a method
llvm-svn: 50836
2008-05-07 22:54:15 +00:00
Anton Korobeynikov
ef80f5dbca If weak GlobalVariable was bitcast'ed to different type during linking
we will need to strip all casts for intializer lookup.

llvm-svn: 50776
2008-05-06 22:52:54 +00:00
Owen Anderson
8aaa632351 Revert r49614. As Dan pointed out, some of these aren't correct.
llvm-svn: 49657
2008-04-14 17:38:21 +00:00
Owen Anderson
b54defaff0 Replace calls of the form V1->setName(V2->getName()) with V1->takeName(V2),
which is significantly more efficient.

llvm-svn: 49614
2008-04-13 19:15:17 +00:00
Gabor Greif
6c6b8a57f3 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.

llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Chris Lattner
d141d16ed7 Change the MemoryBuffer::getFile* methods to take just a pointer to the
start of a filename, not a filename+length.  All clients can produce a
null terminated name, and the system api's require null terminated 
strings anyway.

llvm-svn: 49041
2008-04-01 18:04:03 +00:00
Anton Korobeynikov
a69bd8b0e6 Ultimately resolve aliases during linking, if possible
llvm-svn: 48259
2008-03-11 22:51:09 +00:00
Anton Korobeynikov
da7746cf43 Fix thinko: alias always defines new symbol. Even is aliasee itself is undefined.
llvm-svn: 48203
2008-03-11 00:24:53 +00:00
Anton Korobeynikov
6d98df2a25 Add sanity checks
llvm-svn: 48184
2008-03-10 22:36:53 +00:00
Anton Korobeynikov
ada9acedd4 Typo: 'function' => 'alias'
llvm-svn: 48183
2008-03-10 22:36:35 +00:00
Anton Korobeynikov
25b1121a28 Syntactic sugar'ify stuff :)
llvm-svn: 48182
2008-03-10 22:36:08 +00:00
Anton Korobeynikov
4a897017af Always run 'make check' :) Fix fallout from prev. commit: query for possible
alias destination only if we don't have anything to link to

llvm-svn: 48181
2008-03-10 22:35:31 +00:00
Anton Korobeynikov
24360dead3 Make error messages to have common style
llvm-svn: 48180
2008-03-10 22:34:46 +00:00
Anton Korobeynikov
a17ceb586c Properly link globals with aliases
llvm-svn: 48179
2008-03-10 22:34:28 +00:00
Anton Korobeynikov
d33dd5acd2 Remove the LinkGlobal weirderness in common linking phase.
llvm-svn: 48177
2008-03-10 22:33:53 +00:00
Anton Korobeynikov
7ce7d7173a Typo
llvm-svn: 48176
2008-03-10 22:33:22 +00:00
Ted Kremenek
b05e945be4 Fix some compilation errors on msvc:
- "Redefinition of I" (iterator masks previous definition)
- include missing header file

Patch by Argiris Kirtzidis!

llvm-svn: 48115
2008-03-09 18:32:50 +00:00
Anton Korobeynikov
4ce7b6011b Clarify some important bits
llvm-svn: 48010
2008-03-07 18:34:50 +00:00
Anton Korobeynikov
d33aa31d4c Small cleanup: propagate thread-localness via generic routine.
No functionality change.

llvm-svn: 48009
2008-03-07 18:32:18 +00:00
Anton Korobeynikov
b66feb845f Missed patch from my last commit
llvm-svn: 47977
2008-03-05 23:21:39 +00:00
Anton Korobeynikov
d4e00c2d59 Resolve aliases to aliasees, where possible
llvm-svn: 47975
2008-03-05 23:08:47 +00:00
Anton Korobeynikov
76b5b2d294 Handle functions as targets during linking of aliases as well
llvm-svn: 47974
2008-03-05 23:08:16 +00:00
Anton Korobeynikov
f2f352ec48 Try hard to link aliases. Checks can be too strict by now.
llvm-svn: 47968
2008-03-05 22:22:46 +00:00
Anton Korobeynikov
79f6795ebb Remember the source->dest mapping when copying aliases. This fixes PR2054
llvm-svn: 47945
2008-03-05 15:27:21 +00:00
Anton Korobeynikov
0d90b4596b Clarify the state-of-the-art
llvm-svn: 47944
2008-03-05 15:11:00 +00:00
Anton Korobeynikov
f9d4370f22 Properly populate lists of defined/undefined symbols in presence of aliases
llvm-svn: 47900
2008-03-04 20:16:11 +00:00
Lauro Ramos Venancio
8dc3548bdf Emit an error when a library is not found. It is the GNU ld behavior and it is expected by the configure scripts.
llvm-svn: 47674
2008-02-27 17:20:32 +00:00
Anton Korobeynikov
b2dfae5fed And final pack of warnings silencing
llvm-svn: 47372
2008-02-20 11:27:04 +00:00
Chris Lattner
699e5dbcee random cleanups.
llvm-svn: 47334
2008-02-19 18:49:08 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner
8193d4af33 remove attribution from lib Makefiles.
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Anton Korobeynikov
f12327cd32 Ignore functions with internal linkages during linking. This snipped mimics the
behaviour of LinkGlobals() function.

llvm-svn: 45375
2007-12-27 23:21:57 +00:00
Gordon Henriksen
90d48b077d Fixing several transforms which would drop the collector attribute
when copying functions.

llvm-svn: 45356
2007-12-25 22:16:06 +00:00
Duncan Sands
3602011bec Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.

llvm-svn: 44359
2007-11-27 13:23:08 +00:00
Dan Gohman
d5c936914c Use correct parentheses with the '&& "..."' idiom in an assert.
llvm-svn: 42750
2007-10-08 15:13:30 +00:00
Chris Lattner
2de224be98 Fix PR1611 - Visibility should be ignored for a declaration
when a definition's visibility is different.  Likewise, the
visibility of two declarations mismatching is not an error.

llvm-svn: 41174
2007-08-19 22:22:54 +00:00
Reid Spencer
056b656f99 Improve error handling in the linker by:
1. Eliminate redundant error messages. LinkInFile and LinkInArchive
   already call the error() method in each case so there's no use
   telling the user again that an item couldn't be linked in.

2. Improve the formatting of error messages (separating content).

3. Change the wording for the warning about unrecognized files. Make
   it clear that the file is being ignored.

llvm-svn: 41121
2007-08-16 07:47:30 +00:00
Reid Spencer
3860c113ab Ensure that error messages a propagated from calls to LinkInModule so they get
reported to the end user.

llvm-svn: 41117
2007-08-16 07:23:37 +00:00
Reid Spencer
c5f311aa70 Allow the filename "-" to be a place holder for stdin. This allows directing
stdin through llvm-ld and llvm-link.

llvm-svn: 40938
2007-08-08 19:52:29 +00:00
Reid Spencer
dd93d5abaa Report an error if one occurs in releaseModule.
llvm-svn: 40405
2007-07-22 21:39:37 +00:00
Gabor Greif
f5e225a756 eliminate residual cruft related to recognizing bytecode
files.
bitcode files are the only LLVM format left.

llvm-svn: 37945
2007-07-06 13:38:17 +00:00
Gabor Greif
5f705671e4 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.

llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Lauro Ramos Venancio
04172124dd Fix a bug in my previous patch.
llvm-svn: 37778
2007-06-28 20:06:38 +00:00
Lauro Ramos Venancio
eb29d717b3 When linking two modules, we should copy the alias.
llvm-svn: 37776
2007-06-28 19:02:54 +00:00
Lauro Ramos Venancio
9907d0f8db Propagate alignment, section name and visibility when linking "appending
global values".
Fix noinline linkage.

llvm-svn: 37482
2007-06-06 22:01:12 +00:00
Chris Lattner
c684dbdb6b switch this to bitcode instead of bytecode
llvm-svn: 36867
2007-05-06 09:29:13 +00:00
Chris Lattner
c0fa93d591 add bitcode support
llvm-svn: 36855
2007-05-06 06:02:13 +00:00
Reid Spencer
db43279e9a If an archive is not recognized as an LLVM bytecode archive then declare
that it is native so that the linker will pass it on downstream. This avoids
a problem where the native link line fails because there is both a .so and
a .a file. The .a file gets processed as bytecode and then dropped from the
command line.

llvm-svn: 36584
2007-04-30 00:29:39 +00:00
Reid Spencer
d27ed404ea Dependent libraries could be native too.
llvm-svn: 36582
2007-04-30 00:00:10 +00:00
Anton Korobeynikov
081d3bdd9f Implement visibility checking during linking. Also implement protected
visibility support for bitcode.

llvm-svn: 36577
2007-04-29 20:56:48 +00:00
Lauro Ramos Venancio
a76c2806de Implement the "thread_local" keyword.
llvm-svn: 35950
2007-04-12 18:32:50 +00:00
Reid Spencer
2792e203c5 For PR1146:
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.

llvm-svn: 35877
2007-04-11 02:44:20 +00:00
Reid Spencer
d8c3813f51 For PR1302:
Use local variable names that match the function parameter name that it
is passed to so the code is more clear, to wit: is_bytecode -> is_native

llvm-svn: 35656
2007-04-04 06:44:18 +00:00
Reid Spencer
87ede33a19 For PR1302:
Implement file tests for both LinkInLibrary and LinkInFile to determine if
the file is native. Don't generate warnings if the file is native.

llvm-svn: 35653
2007-04-04 06:33:17 +00:00
Reid Spencer
55e4e98a2a For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.

llvm-svn: 34293
2007-02-15 02:26:10 +00:00
Chris Lattner
8aafcbb579 simplify this code by using value::takename
llvm-svn: 34172
2007-02-11 00:39:38 +00:00
Chris Lattner
43d0b955a3 push bytecode decompressor out through APIs. Now the bytecode reader
api's look like this:

ModuleProvider *getBytecodeModuleProvider(
  const std::string &Filename,  ///< Name of file to be read
  BCDecompressor_t *BCDC = Compressor::decompressToNewBuffer,
  std::string* ErrMsg = 0,      ///< Optional error message holder
  BytecodeHandler* H = 0        ///< Optional handler for reader events
);

This is ugly, but allows a client to say:

  getBytecodeModuleProvider("foo", 0);

If they do this, there is no dependency on the compression libraries, saving
codesize.

llvm-svn: 34012
2007-02-07 21:41:02 +00:00
Reid Spencer
83803ddedb For PR411:
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)

llvm-svn: 33922
2007-02-05 21:19:13 +00:00
Reid Spencer
6af21b3029 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.

llvm-svn: 33918
2007-02-05 20:47:22 +00:00
Reid Spencer
e86b73d7ce Fix some comments and other minor sundry things.
llvm-svn: 33873
2007-02-04 04:43:17 +00:00
Reid Spencer
0759b38041 Ensure that visibility and section are properly propagated.
llvm-svn: 33872
2007-02-04 04:30:33 +00:00
Reid Spencer
080fc7bf3f Back out last revision which was committed by accident.
llvm-svn: 33871
2007-02-04 04:29:21 +00:00
Reid Spencer
8fa4e4be1f Make sure that section and visibility are properly propagated.
llvm-svn: 33870
2007-02-04 04:28:18 +00:00
Andrew Lenharth
95c86563cd preserve sections of globals
llvm-svn: 33756
2007-02-01 17:12:54 +00:00
Reid Spencer
19af04a142 For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.

llvm-svn: 33663
2007-01-30 20:08:39 +00:00
Chris Lattner
b7ffc667c3 Read from the right place.
llvm-svn: 33611
2007-01-29 02:18:13 +00:00
Chris Lattner
e9c8a05b70 Fix PR1139
llvm-svn: 33610
2007-01-29 00:21:34 +00:00
Reid Spencer
cec82ab067 For PR761:
The Module::setEndianness and Module::setPointerSize methods have been
removed. Instead you can get/set the DataLayout. Adjust thise accordingly.

llvm-svn: 33530
2007-01-26 08:11:39 +00:00
Reid Spencer
373d2bccea For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.

This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
   bits in an integer. The Type classes SubclassData field is used to
   store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
   64-bit integers. These are replaced with just IntegerType which is not
   a primitive any more.
3. Adjust the rest of LLVM to account for this change.

Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types.  Future increments
will rectify this situation.

llvm-svn: 33113
2007-01-12 07:05:14 +00:00
Reid Spencer
cdaf88ff9d For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.

llvm-svn: 32956
2007-01-06 07:24:44 +00:00
Andrew Lenharth
3033b03f33 extern_weak linkage. fixes PR1038
llvm-svn: 32603
2006-12-15 17:35:32 +00:00
Reid Spencer
562b83c7df Change inferred getCast into specific getCast. Passes all tests.
llvm-svn: 32469
2006-12-12 05:05:00 +00:00
Bill Wendling
fe0af72bc4 Don't use <sstream> in Streams.h but <iosfwd> instead.
llvm-svn: 32340
2006-12-07 23:41:45 +00:00
Bill Wendling
a3246c4272 Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.

llvm-svn: 32298
2006-12-07 01:30:32 +00:00
Anton Korobeynikov
f627d28d9c Introducing external weak linkage. Darwin codegen should be added later.
llvm-svn: 32052
2006-12-01 00:25:12 +00:00
Bill Wendling
a18a61a56a Removed #include <iostream> and replaced with llvm_* streams.
llvm-svn: 31936
2006-11-27 10:09:12 +00:00
Reid Spencer
55d1963049 Remvoe a do-nothing else block.
llvm-svn: 31687
2006-11-11 20:27:49 +00:00
Reid Spencer
72bcd0530b For PR998:
Fix an infinite loop in the Linker and a few other assorted link problems.

Patch contributed by Scott Michel. Thanks, Scott!

llvm-svn: 31680
2006-11-11 11:54:25 +00:00
Chris Lattner
71c31643ad silence warnings
llvm-svn: 31587
2006-11-09 05:18:12 +00:00
Reid Spencer
4bafa71dc1 For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.

llvm-svn: 31380
2006-11-02 20:25:50 +00:00
Anton Korobeynikov
6e19f80688 Adding dllimport, dllexport and external weak linkage types.
DLL* linkages got full (I hope) codegeneration support in C & both x86
assembler backends.
External weak linkage added for future use, we don't provide any
codegeneration, etc. support for it.

llvm-svn: 30374
2006-09-14 18:23:27 +00:00
Chris Lattner
b0aae854ba Remove a redundant syscall.
llvm-svn: 29405
2006-07-28 22:52:11 +00:00
Chris Lattner
3a664f7dc0 eliminate some ugly code, using ConstantExpr::getWithOperands instead.
llvm-svn: 29149
2006-07-14 22:21:31 +00:00
Reid Spencer
cb66ae964e Finish removal of EH usage from the Archive library. The REQUIRES_EH flag
in lib/Bytecode/Archive/Makefile is now removed. One small step closer to
a smaller LLVM.

llvm-svn: 29067
2006-07-07 20:56:50 +00:00
Chris Lattner
29fbce5a20 Fix Regression/Linker/2006-06-15-GlobalVarAnment.ll
llvm-svn: 28812
2006-06-16 01:24:04 +00:00
Chris Lattner
609f7e070d Fix linking of inline asm objects.
llvm-svn: 28640
2006-06-01 19:14:22 +00:00
Chris Lattner
c84c3d7c32 Add shufflevector support
llvm-svn: 27515
2006-04-08 01:19:47 +00:00
Evan Cheng
37b4263eb8 Add code to RemapOperand() to handle Instruction::ExtractElement and
Instruction::InsertElement.

llvm-svn: 27477
2006-04-07 01:27:42 +00:00
Chris Lattner
2cbee3afee Rename method
llvm-svn: 25571
2006-01-24 04:14:29 +00:00
Chris Lattner
0af0dbcfa5 Add support for linking inline asm
llvm-svn: 25560
2006-01-23 23:08:37 +00:00
Chris Lattner
3158146649 add support for ConstantPacked to the linker
llvm-svn: 25467
2006-01-19 23:15:58 +00:00
John Criswell
e7062e0703 Fixed style of curly brace. No functionality changes.
llvm-svn: 25414
2006-01-17 22:01:57 +00:00
Reid Spencer
783084211a For PR521:
With these patches we implement the ability for the Linker library to
keep track of which libraries were actually bytecode files (not archives)
and cause their users to remove such files from the list of libraries to
pass to the native linker.

llvm-svn: 25169
2006-01-10 03:14:40 +00:00
Reid Spencer
e7b44b171a Be a little more explanatory in a comment.
llvm-svn: 25168
2006-01-10 03:12:29 +00:00
Reid Spencer
2b33292a67 Adjust the constructor to the Linker class to take an argument that names
the module being constructed. This is used to correctly name the module.
Previously the name of the linker tool was used which produces confusing
output when the module identifier is used in an error message.

llvm-svn: 24699
2005-12-13 20:00:37 +00:00
Chris Lattner
b3a66217a4 Fix test/Regression/Linker/2005-12-06-AppendingZeroLengthArrays.ll and
PR662.  Thanks to Markus for providing me with a ton of files to
reproduce the problem!

llvm-svn: 24619
2005-12-06 17:30:58 +00:00
Chris Lattner
e6f7a38925 DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE now
llvm-svn: 23940
2005-10-24 02:26:13 +00:00
Reid Spencer
5534b2d505 For PR495:
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.

llvm-svn: 22349
2005-07-07 23:21:43 +00:00
Reid Spencer
fb7bca6fa6 For PR495:
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute

More (incremental) changes coming to close 495.

llvm-svn: 22345
2005-07-07 18:21:42 +00:00
Chris Lattner
a2edd7e449 Preserve CC's when linking modules
llvm-svn: 21799
2005-05-09 01:09:39 +00:00
Misha Brukman
933cdaf254 Remove trailing whitespace
llvm-svn: 21422
2005-04-21 22:55:34 +00:00
Chris Lattner
f174f4c9d1 fix some 80 column violations
Add support for programs that define main in a .a file, such as f2c'd programs.

llvm-svn: 20631
2005-03-15 23:03:34 +00:00
Chris Lattner
1020a03b64 consolidate LinkFiles into LinkItems, use lib_* iterators.
llvm-svn: 20630
2005-03-15 22:55:17 +00:00
Chris Lattner
60222ca193 consolidate LinkLibraries into LinkItems
llvm-svn: 20629
2005-03-15 22:51:40 +00:00
Chris Lattner
4b688a1c70 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!

llvm-svn: 20597
2005-03-15 04:54:21 +00:00
Chris Lattner
15759af51d Add support for ".so" files compiled with LLVM which contain LLVM bytecode.
llvm-svn: 20253
2005-02-19 18:30:29 +00:00
Chris Lattner
042a54de90 Eliminate silly warnings from the linker of the form:
WARNING: Type conflict between types named 'union.._604.'.
    Src=' %union.._604.'.
   Dest=' %union.._604.'
llvm-svn: 20252
2005-02-19 17:52:37 +00:00
Chris Lattner
1194167daa Minor cleanup. No need to explicitly tell the compiler the template arguments.
llvm-svn: 20153
2005-02-13 17:50:16 +00:00
Chris Lattner
da614a0e0b Print something useful for gccld -v with an archive.
llvm-svn: 20148
2005-02-13 15:26:14 +00:00
Chris Lattner
6e3279c0b4 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

llvm-svn: 20135
2005-02-12 19:20:28 +00:00
Reid Spencer
68f4d407fc Remove un-needed #includes.
llvm-svn: 19061
2004-12-20 04:15:44 +00:00
Reid Spencer
8b758b07c4 Fix a compile error. config.h is now needed because DataTypes.h doesn't
include it any more.

llvm-svn: 18993
2004-12-16 19:19:24 +00:00
Reid Spencer
cc77c7abb5 * 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.

llvm-svn: 18871
2004-12-13 03:50:50 +00:00
Reid Spencer
7df034022a Add missing space in a comment.
llvm-svn: 18870
2004-12-13 03:23:13 +00:00
Reid Spencer
57575286ec Fix header and function comments.
llvm-svn: 18867
2004-12-13 03:13:18 +00:00
Reid Spencer
ed05e1fa02 This file contains basic Linker facilities needed by all tools
llvm-svn: 18860
2004-12-13 03:00:28 +00:00
Reid Spencer
94a27a253c Make LinkModules a static member function
llvm-svn: 18859
2004-12-13 03:00:16 +00:00
Reid Spencer
24726c4a89 This file contains only the Linker's library linking support
llvm-svn: 18858
2004-12-13 03:00:04 +00:00
Reid Spencer
f10f056fe4 For PR351: \
* Remove redundant static function LinkOneLibrary. \
* Remove unneded #includes \
* Convert FileSupport usage to sys::Path instead

llvm-svn: 18857
2004-12-13 02:59:52 +00:00
Reid Spencer
e7d544a97d This file contains only the Linker's file linking support
llvm-svn: 18856
2004-12-13 02:59:41 +00:00
Reid Spencer
9d9fc4e4ec 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

llvm-svn: 18855
2004-12-13 02:59:29 +00:00
Chris Lattner
3c31189583 Make sure to link the target-triple as well, so it ends up in the .llvm.bc file
llvm-svn: 18774
2004-12-10 20:26:15 +00:00
Chris Lattner
0cfaa02448 Turn this error back into a warning, fixing the povray regression
llvm-svn: 18655
2004-12-08 20:01:10 +00:00
Chris Lattner
722af6cfde Revert this disgusting hack, John has a much nicer solution
llvm-svn: 18611
2004-12-08 03:31:14 +00:00
Chris Lattner
ad4056c178 Add a disgusting hack to work around a libstdc++ issue. This code should
be removed when PR400 is resolved.

llvm-svn: 18610
2004-12-08 03:28:51 +00:00
Reid Spencer
98eb4c8d05 Fix PR139: \
Implement LinkItems and BuildLinkItems interfaces.

llvm-svn: 18547
2004-12-05 19:14:55 +00:00
Chris Lattner
32d0c4ce02 Fix linkage of mismatched weak globals. This unbreaks 300.twolf
llvm-svn: 18494
2004-12-04 18:54:48 +00:00
Chris Lattner
5d27646680 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.

llvm-svn: 18465
2004-12-03 22:18:41 +00:00
Reid Spencer
356384fbdb 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.

llvm-svn: 18428
2004-12-02 09:52:10 +00:00
Reid Spencer
af68e19395 Revert version 1.39. It breaks the ordering of the library processing.
llvm-svn: 18399
2004-11-30 22:54:48 +00:00
Reid Spencer
e76c012f3a Shared library extension is now in LTDL_SHLIB_EXT
llvm-svn: 18353
2004-11-29 12:40:21 +00:00
Reid Spencer
8cf334425d 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.

llvm-svn: 18243
2004-11-25 09:32:08 +00:00
Reid Spencer
c7b5efd4b9 Remove blank comment lines for uniformity.
Make sure lines don't exceed 80 cols.

llvm-svn: 18242
2004-11-25 09:29:44 +00:00
Reid Spencer
fb0e585554 Eliminate unsightly ;;
llvm-svn: 17979
2004-11-19 03:27:05 +00:00
Reid Spencer
119f824e80 Reduce the amount of work in LinkInArchive by not searching the archive for
symbols it has already identified as not defining.

llvm-svn: 17975
2004-11-19 03:13:25 +00:00
Chris Lattner
8906663505 Don't increment a dead iterator
llvm-svn: 17904
2004-11-16 19:04:40 +00:00
Chris Lattner
b40f8214ea Simplify the remapper by only needing one map, since the body of the functions
being linked do not need to be remapped any longer.

llvm-svn: 17900
2004-11-16 17:12:38 +00:00
Chris Lattner
0493754bcf 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.

llvm-svn: 17893
2004-11-16 07:31:51 +00:00
Reid Spencer
ddfafa643a Per code review:\
* Adjust indentation\
* Ensure memory do not leak if exceptions happen (std::auto_ptr use)

llvm-svn: 17885
2004-11-16 06:47:41 +00:00
Chris Lattner
be4c91f75f The second arg may be clobbered by this function
llvm-svn: 17880
2004-11-16 06:41:36 +00:00
Chris Lattner
e816a3abc2 use an autoptr
llvm-svn: 17875
2004-11-16 06:40:54 +00:00
Reid Spencer
29eb55846f Remove a forgotten debug output line.
llvm-svn: 17810
2004-11-14 23:49:55 +00:00
Reid Spencer
7850852268 Linker.h moved to include/llvm from include/llvm/Support.
llvm-svn: 17807
2004-11-14 23:27:04 +00:00
Reid Spencer
7a004d2749 Linker.h has a new home.
llvm-svn: 17801
2004-11-14 23:00:08 +00:00
Reid Spencer
292678447a Don't bother with a re-linked library, ensure archive library is built.
llvm-svn: 17773
2004-11-14 22:03:14 +00:00
Reid Spencer
8a2a29e286 *Adjust prototypes for public interface. *Rewrite LinkInArchive to use symbol tables.
llvm-svn: 17772
2004-11-14 22:02:27 +00:00
Reid Spencer
f6caf3b1c2 Makefile for lib/Linker
llvm-svn: 17695
2004-11-12 20:38:45 +00:00
Reid Spencer
f755c169b3 This file originated in lib/VMCore/Linker.cpp but now lives in
lib/Linker/LinkModules.cpp

llvm-svn: 17694
2004-11-12 20:37:43 +00:00
Reid Spencer
13a6af95ad This file originated in tools/gccld/Linker.cpp but now lives in
lib/Linker/LinkArchives.cpp

llvm-svn: 17693
2004-11-12 20:34:32 +00:00