Commit Graph

152 Commits

Author SHA1 Message Date
Reid Spencer 8d4ff90680 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 d857ef651b Dependent libraries could be native too.
llvm-svn: 36582
2007-04-30 00:00:10 +00:00
Anton Korobeynikov 31fc4f9526 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 749e4668e7 Implement the "thread_local" keyword.
llvm-svn: 35950
2007-04-12 18:32:50 +00:00
Reid Spencer a472f66dd0 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 d1b53f538d 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 a2c415526c 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 d84d35ba70 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 2a8d2e0e52 simplify this code by using value::takename
llvm-svn: 34172
2007-02-11 00:39:38 +00:00
Chris Lattner a0e49f2ead 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 1241d6d5ab 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 3aaaa0b2bd 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 d3ba7d9b42 Fix some comments and other minor sundry things.
llvm-svn: 33873
2007-02-04 04:43:17 +00:00
Reid Spencer 2dc3653531 Ensure that visibility and section are properly propagated.
llvm-svn: 33872
2007-02-04 04:30:33 +00:00
Reid Spencer 90246aa71e Back out last revision which was committed by accident.
llvm-svn: 33871
2007-02-04 04:29:21 +00:00
Reid Spencer 2ea1bb2b8a Make sure that section and visibility are properly propagated.
llvm-svn: 33870
2007-02-04 04:28:18 +00:00
Andrew Lenharth dd924e4e95 preserve sections of globals
llvm-svn: 33756
2007-02-01 17:12:54 +00:00
Reid Spencer 5301e7c605 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 78bddc388c Read from the right place.
llvm-svn: 33611
2007-01-29 02:18:13 +00:00
Chris Lattner 7f3bd82ab9 Fix PR1139
llvm-svn: 33610
2007-01-29 00:21:34 +00:00
Reid Spencer 3ac38e99b9 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 7a9c62baa6 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 32af9e8cc5 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 e06036d229 extern_weak linkage. fixes PR1038
llvm-svn: 32603
2006-12-15 17:35:32 +00:00
Reid Spencer b341b0861d Change inferred getCast into specific getCast. Passes all tests.
llvm-svn: 32469
2006-12-12 05:05:00 +00:00
Bill Wendling 30c0f3367c Don't use <sstream> in Streams.h but <iosfwd> instead.
llvm-svn: 32340
2006-12-07 23:41:45 +00:00
Bill Wendling f3baad3ee1 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 12c94949e0 Introducing external weak linkage. Darwin codegen should be added later.
llvm-svn: 32052
2006-12-01 00:25:12 +00:00
Bill Wendling 7339b8dbfd Removed #include <iostream> and replaced with llvm_* streams.
llvm-svn: 31936
2006-11-27 10:09:12 +00:00
Reid Spencer 06d8e0fa3b Remvoe a do-nothing else block.
llvm-svn: 31687
2006-11-11 20:27:49 +00:00
Reid Spencer 75db664f44 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 1b9633d7f0 silence warnings
llvm-svn: 31587
2006-11-09 05:18:12 +00:00
Reid Spencer de46e48420 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 d61d39ec53 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 e58f7408d0 Remove a redundant syscall.
llvm-svn: 29405
2006-07-28 22:52:11 +00:00
Chris Lattner 19247f36ea eliminate some ugly code, using ConstantExpr::getWithOperands instead.
llvm-svn: 29149
2006-07-14 22:21:31 +00:00
Reid Spencer 546436c482 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 44ab8aefa6 Fix Regression/Linker/2006-06-15-GlobalVarAnment.ll
llvm-svn: 28812
2006-06-16 01:24:04 +00:00
Chris Lattner c774592641 Fix linking of inline asm objects.
llvm-svn: 28640
2006-06-01 19:14:22 +00:00
Chris Lattner 0197e454d1 Add shufflevector support
llvm-svn: 27515
2006-04-08 01:19:47 +00:00
Evan Cheng 5c349b8b7d Add code to RemapOperand() to handle Instruction::ExtractElement and
Instruction::InsertElement.

llvm-svn: 27477
2006-04-07 01:27:42 +00:00
Chris Lattner 8ebd2164eb Rename method
llvm-svn: 25571
2006-01-24 04:14:29 +00:00
Chris Lattner dd2d3faf19 Add support for linking inline asm
llvm-svn: 25560
2006-01-23 23:08:37 +00:00
Chris Lattner 93bde9cbf7 add support for ConstantPacked to the linker
llvm-svn: 25467
2006-01-19 23:15:58 +00:00
John Criswell 0e9bd5a416 Fixed style of curly brace. No functionality changes.
llvm-svn: 25414
2006-01-17 22:01:57 +00:00
Reid Spencer 5995c57574 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 8097c0a0d9 Be a little more explanatory in a comment.
llvm-svn: 25168
2006-01-10 03:12:29 +00:00
Reid Spencer 6796b48e51 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 d490d4f023 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 bde3845548 DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE now
llvm-svn: 23940
2005-10-24 02:26:13 +00:00
Reid Spencer c9c0473fa5 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 5b891e9847 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 e251b5ca89 Preserve CC's when linking modules
llvm-svn: 21799
2005-05-09 01:09:39 +00:00
Misha Brukman 10468d8a3c Remove trailing whitespace
llvm-svn: 21422
2005-04-21 22:55:34 +00:00
Chris Lattner 018b093c79 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 ebaf17875e consolidate LinkFiles into LinkItems, use lib_* iterators.
llvm-svn: 20630
2005-03-15 22:55:17 +00:00
Chris Lattner d3d086d679 consolidate LinkLibraries into LinkItems
llvm-svn: 20629
2005-03-15 22:51:40 +00:00
Chris Lattner 531f9e92d4 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 e68dae0eb6 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 fe723a7c05 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 08a5eb3cf0 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 71a44087d4 Print something useful for gccld -v with an archive.
llvm-svn: 20148
2005-02-13 15:26:14 +00:00
Chris Lattner 16277c1775 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 6b853b22cb Remove un-needed #includes.
llvm-svn: 19061
2004-12-20 04:15:44 +00:00
Reid Spencer b193ec5a13 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 92e97620be * 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 bf63444a41 Add missing space in a comment.
llvm-svn: 18870
2004-12-13 03:23:13 +00:00
Reid Spencer 0005214558 Fix header and function comments.
llvm-svn: 18867
2004-12-13 03:13:18 +00:00
Reid Spencer 4a23d3f8e5 This file contains basic Linker facilities needed by all tools
llvm-svn: 18860
2004-12-13 03:00:28 +00:00
Reid Spencer c4e3153455 Make LinkModules a static member function
llvm-svn: 18859
2004-12-13 03:00:16 +00:00
Reid Spencer 9a5613962f This file contains only the Linker's library linking support
llvm-svn: 18858
2004-12-13 03:00:04 +00:00
Reid Spencer ebd3d9f8fc 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 9ce11c3929 This file contains only the Linker's file linking support
llvm-svn: 18856
2004-12-13 02:59:41 +00:00
Reid Spencer fe73bfcfdb 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 b7f5916e01 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 630729c97e Turn this error back into a warning, fixing the povray regression
llvm-svn: 18655
2004-12-08 20:01:10 +00:00
Chris Lattner db38fe94ae Revert this disgusting hack, John has a much nicer solution
llvm-svn: 18611
2004-12-08 03:31:14 +00:00
Chris Lattner 79a993ea0d 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 1014afc7ea Fix PR139: \
Implement LinkItems and BuildLinkItems interfaces.

llvm-svn: 18547
2004-12-05 19:14:55 +00:00
Chris Lattner a57c105687 Fix linkage of mismatched weak globals. This unbreaks 300.twolf
llvm-svn: 18494
2004-12-04 18:54:48 +00:00
Chris Lattner fc61de3902 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 f78508b25e 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 3f2352e23e 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 d1697bf2f7 Shared library extension is now in LTDL_SHLIB_EXT
llvm-svn: 18353
2004-11-29 12:40:21 +00:00
Reid Spencer 8bb258d1ea 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 2c4f9a484c 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 3356325996 Eliminate unsightly ;;
llvm-svn: 17979
2004-11-19 03:27:05 +00:00
Reid Spencer c2455ca7b7 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 f27514df9d Don't increment a dead iterator
llvm-svn: 17904
2004-11-16 19:04:40 +00:00
Chris Lattner 7391dde138 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 2f0557d0e4 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 5208a11440 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 f2e808449d The second arg may be clobbered by this function
llvm-svn: 17880
2004-11-16 06:41:36 +00:00
Chris Lattner 2981914302 use an autoptr
llvm-svn: 17875
2004-11-16 06:40:54 +00:00
Reid Spencer a67b6e1874 Remove a forgotten debug output line.
llvm-svn: 17810
2004-11-14 23:49:55 +00:00
Reid Spencer 9b0ddbbe2c Linker.h moved to include/llvm from include/llvm/Support.
llvm-svn: 17807
2004-11-14 23:27:04 +00:00
Reid Spencer 16c3bb3198 Linker.h has a new home.
llvm-svn: 17801
2004-11-14 23:00:08 +00:00
Reid Spencer c470261d27 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 9db61d9e3a *Adjust prototypes for public interface. *Rewrite LinkInArchive to use symbol tables.
llvm-svn: 17772
2004-11-14 22:02:27 +00:00
Reid Spencer a81f8197eb Makefile for lib/Linker
llvm-svn: 17695
2004-11-12 20:38:45 +00:00