aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Linker
Commit message (Collapse)AuthorAgeFilesLines
* Merge with LLVM upstream r155090.Shih-wei Liao2012-04-241-36/+63
|\ | | | | | | | | | | | | Conflicts: lib/Support/Unix/PathV2.inc Change-Id: I7b89833849f6cbcfa958a33a971d0f7754c9cb2c
| * It's possible for two types, which are isomorphic, to be added to theBill Wendling2012-03-231-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | destination module, but one of them isn't used in the destination module. If another module comes along and the uses the unused type, there could be type conflicts when the modules are finally linked together. (This happened when building LLVM.) The test that was reduced is: Module A: %Z = type { %A } %A = type { %B.1, [7 x x86_fp80] } %B.1 = type { %C } %C = type { i8* } declare void @func_x(%C*, i64, i64) declare void @func_z(%Z* nocapture) Module B: %B = type { %C.1 } %C.1 = type { i8* } %A.2 = type { %B.3, [5 x x86_fp80] } %B.3 = type { %C.1 } define void @func_z() { %x = alloca %A.2, align 16 %y = getelementptr inbounds %A.2* %x, i64 0, i32 0, i32 0 call void @func_x(%C.1* %y, i64 37, i64 927) nounwind ret void } declare void @func_x(%C.1*, i64, i64) declare void @func_y(%B* nocapture) (Unfortunately, this test doesn't fail under llvm-link, only during an LTO linking.) The '%C' and '%C.1' clash. The destination module gets the '%C' declaration. When merging Module B, it looks at the '%C.1' subtype of the '%B' structure. It adds that in, because that's cool. And when '%B.3' is processed, it uses the '%C.1'. But the '%B' has used '%C' and we prefer to use '%C'. So the '@func_x' type is changed to 'void (%C*, i64, i64)', but the type of '%x' in '@func_z' remains '%A.2'. The GEP resolves to a '%C.1', which conflicts with the '@func_x' signature. We can resolve this situation by making sure that the type is used in the destination before saying that it should be used in the module being merged in. With this fix, LLVM and Clang both compile under LTO. <rdar://problem/10913281> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153351 91177308-0d34-0410-b5e6-96231b3b80d8
| * Ignore the last message.Bill Wendling2012-03-231-1/+3
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153315 91177308-0d34-0410-b5e6-96231b3b80d8
| * Revert patch. It broke the build.Bill Wendling2012-03-231-3/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153314 91177308-0d34-0410-b5e6-96231b3b80d8
| * Dematerialize the source functions after we're done with them. This saves a bitBill Wendling2012-03-231-1/+3
| | | | | | | | | | | | | | of memory during LTO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153313 91177308-0d34-0410-b5e6-96231b3b80d8
| * Some whitespace and comment cleanup.Bill Wendling2012-03-221-5/+0
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153278 91177308-0d34-0410-b5e6-96231b3b80d8
| * Remove unneeded #ifdefs.Bill Wendling2012-03-221-3/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153277 91177308-0d34-0410-b5e6-96231b3b80d8
| * Add a 'dump' method to the type map. Doxygenify some of the comments and add aBill Wendling2012-03-221-23/+36
| | | | | | | | | | | | | | | | | | few comments where none existed before. Also change a function's name to match the current coding standard. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153276 91177308-0d34-0410-b5e6-96231b3b80d8
* | Merge branch 'upstream' into merge-20120305Stephen Hines2012-03-053-64/+312
|\ \ | |/ | | | | | | | | | | Conflicts: lib/Support/Atomic.cpp Change-Id: I563b3bc2a82942ccbae5bed42e53b9149a8bf3a0
| * Include cctype for isdigit. Patch by Stephen Hines.Duncan Sands2012-03-031-0/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151973 91177308-0d34-0410-b5e6-96231b3b80d8
| * Oops...Don't commit the other stuff..Bill Wendling2012-02-281-44/+29
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151618 91177308-0d34-0410-b5e6-96231b3b80d8
| * Modify comment to reflect the importance of this code.Bill Wendling2012-02-281-29/+44
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151617 91177308-0d34-0410-b5e6-96231b3b80d8
| * Add back removed code. It still causes LLVM to miscompile. But not having it ↵Bill Wendling2012-02-271-0/+30
| | | | | | | | | | | | breaks other things. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151594 91177308-0d34-0410-b5e6-96231b3b80d8
| * Don't use #if 0. Just remove until I can address this.Bill Wendling2012-02-271-35/+0
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151580 91177308-0d34-0410-b5e6-96231b3b80d8
| * The code that cleans up multiple, isomorphic types has a subtle error thatBill Wendling2012-02-271-3/+7
| | | | | | | | | | | | | | | | manifests itself when building LLVM with LTO. <rdar://problem/10913281> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151576 91177308-0d34-0410-b5e6-96231b3b80d8
| * Capitalize messages so that they appear nicely with the linker's error messages.Bill Wendling2012-02-141-9/+9
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150466 91177308-0d34-0410-b5e6-96231b3b80d8
| * [WIP] Initial code for module flags.Bill Wendling2012-02-111-5/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Module flags are key-value pairs associated with the module. They include a 'behavior' value, indicating how module flags react when mergine two files. Normally, it's just the union of the two module flags. But if two module flags have the same key, then the resulting flags are dictated by the behaviors. Allowable behaviors are: Error Emits an error if two values disagree. Warning Emits a warning if two values disagree. Require Emits an error when the specified value is not present or doesn't have the specified value. It is an error for two (or more) llvm.module.flags with the same ID to have the Require behavior but different values. There may be multiple Require flags per ID. Override Uses the specified value if the two values disagree. It is an error for two (or more) llvm.module.flags with the same ID to have the Override behavior but different values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150300 91177308-0d34-0410-b5e6-96231b3b80d8
| * Convert assert(0) to llvm_unreachableCraig Topper2012-02-071-1/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149967 91177308-0d34-0410-b5e6-96231b3b80d8
| * use Constant::getAggregateElement to simplify a bunch of code.Chris Lattner2012-01-251-15/+4
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148934 91177308-0d34-0410-b5e6-96231b3b80d8
| * add more support for ConstantDataSequentialChris Lattner2012-01-241-18/+21
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148802 91177308-0d34-0410-b5e6-96231b3b80d8
| * The iteration order over a std::set<Module*> depends on the addresses of theRafael Espindola2012-01-231-2/+2
| | | | | | | | | | | | modules. Avoid that to make the order the linker sees the modules deterministic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148676 91177308-0d34-0410-b5e6-96231b3b80d8
| * Link symbols with different visibilities according to the rules in theRafael Espindola2012-01-051-24/+54
| | | | | | | | | | | | | | | | System V Application Binary Interface. This lets us use -fvisibility-inlines-hidden with LTO. Fixes PR11697. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147624 91177308-0d34-0410-b5e6-96231b3b80d8
| * When not destroying the source, the linker is not remapping the types. Added ↵Mon P Wang2011-12-231-1/+1
| | | | | | | | | | | | | | | | | | support to CloneFunctionInto to allow remapping for this case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147217 91177308-0d34-0410-b5e6-96231b3b80d8
| * drop unneeded config.h includesDylan Noblesmith2011-12-222-2/+0
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147197 91177308-0d34-0410-b5e6-96231b3b80d8
| * Fix a nasty bug in the type remapping stuff that I added that is breaking ↵Chris Lattner2011-12-201-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kc++ on the build bot in some cases. The basic issue happens when a source module contains both a "%foo" type and a "%foo.42" type. It will see the later one, check to see if the destination module contains a "%foo" type, and it will return true... because both the source and destination modules are in the same LLVMContext. We don't want to map source types to other source types, so don't do the remapping if the mapped type came from the source module. Unfortunately, I've been unable to reduce a decent testcase for this, kc++ is pretty great that way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147010 91177308-0d34-0410-b5e6-96231b3b80d8
| * Now that PR11464 is fixed, reapply the patch to fix PR11464, Chris Lattner2011-12-201-0/+25
| | | | | | | | | | | | | | | | | | | | merging types by name when we can. We still don't guarantee type name linkage but we do it when obviously the right thing to do. This makes LTO type names easier to read, for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146932 91177308-0d34-0410-b5e6-96231b3b80d8
| * fix PR11464 by preventing the linker from mapping two different struct types ↵Chris Lattner2011-12-201-12/+27
| | | | | | | | | | | | from the source module onto the same opaque destination type. An opaque type can only be resolved to one thing or another after all. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146929 91177308-0d34-0410-b5e6-96231b3b80d8
| * Revert 146728 as it's causing failures on some of the external bots as well as Chad Rosier2011-12-171-25/+0
| | | | | | | | | | | | | | | | | | | | | | | | internal nightly testers. Original commit message: By popular demand, link up types by name if they are isomorphic and one is an autorenamed version of the other. This makes the IR easier to read, because we don't end up with random renamed versions of the types after LTO'ing a large app. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146838 91177308-0d34-0410-b5e6-96231b3b80d8
| * By popular demand, link up types by name if they are isomorphic and one is anChris Lattner2011-12-161-0/+25
| | | | | | | | | | | | | | | | autorenamed version of the other. This makes the IR easier to read, because we don't end up with random renamed versions of the types after LTO'ing a large app. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146728 91177308-0d34-0410-b5e6-96231b3b80d8
* | Merge with LLVM upstream r146714 (Dec 16th 2011)Logan Chien2011-12-162-9/+0
|\ \ | |/ | | | | Change-Id: Ied458adb08bf9a69250cbcee9b14b44d17e8701a
| * LLVMBuild: Remove trailing newline, which irked me.Daniel Dunbar2011-12-121-1/+0
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146409 91177308-0d34-0410-b5e6-96231b3b80d8
| * build/CMake: Finish removal of add_llvm_library_dependencies.Daniel Dunbar2011-11-291-8/+0
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145420 91177308-0d34-0410-b5e6-96231b3b80d8
| * build: Add initial cut at LLVMBuild.txt files.Daniel Dunbar2011-11-031-0/+23
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143634 91177308-0d34-0410-b5e6-96231b3b80d8
| * Add support to the linker to lazily link in functions. This change only ↵Tanya Lattner2011-11-021-0/+58
| | | | | | | | | | | | links functions marked with specific linkage (internal, private, linker_private, linker_private_weak, linker_private_weak_def_auto, linkonce, linkonce_odr, and available_externally) if they have uses in the destination module. Instead of automatically linking, these functions are placed onto a worklist to be processed in the final stage of linking. We iterate over the list and if any functions on the list have uses in the destination module, we link them in and repeat the process until no changes in the state (uses) has changed. This means that any functions in the LazilyLink worklist that have a use in the destination module will be linked in and none that don't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143524 91177308-0d34-0410-b5e6-96231b3b80d8
| * Teach ModuleLinker::getLinkageResult about materialisable functionsPeter Collingbourne2011-10-301-1/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143316 91177308-0d34-0410-b5e6-96231b3b80d8
* | build: Add initial cut at LLVMBuild.txt files.Daniel Dunbar2011-11-141-0/+23
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143634 91177308-0d34-0410-b5e6-96231b3b80d8
* | Add support to the linker to lazily link in functions. This change only ↵Tanya Lattner2011-11-141-0/+58
| | | | | | | | | | | | links functions marked with specific linkage (internal, private, linker_private, linker_private_weak, linker_private_weak_def_auto, linkonce, linkonce_odr, and available_externally) if they have uses in the destination module. Instead of automatically linking, these functions are placed onto a worklist to be processed in the final stage of linking. We iterate over the list and if any functions on the list have uses in the destination module, we link them in and repeat the process until no changes in the state (uses) has changed. This means that any functions in the LazilyLink worklist that have a use in the destination module will be linked in and none that don't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143524 91177308-0d34-0410-b5e6-96231b3b80d8
* | Teach ModuleLinker::getLinkageResult about materialisable functionsPeter Collingbourne2011-11-141-1/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143316 91177308-0d34-0410-b5e6-96231b3b80d8
* | Apply changes to migrate to upstream Oct 20th 2011.Logan Chien2011-10-211-2/+2
| | | | | | | | Change-Id: I2bb819151f3fa5ce18690ef373bf071205d3f278
* | Merge with LLVM upstream 2011/10/20 (r142530)Logan Chien2011-10-203-38/+88
|\ \ | |/ | | | | | | | | | | Conflicts: lib/Support/Unix/Host.inc Change-Id: Idc00db3b63912dca6348bddd9f8a1af2a8d5d147
| * Allow the source module to be materialized during the linking process.Tanya Lattner2011-10-141-2/+11
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142010 91177308-0d34-0410-b5e6-96231b3b80d8
| * Make it possible to use the linker without destroying the source module. ↵Tanya Lattner2011-10-111-30/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is so the source module can be linked to multiple other destination modules. For all that used LinkModules() before, they will continue to destroy the source module as before. This line, and those below, will be ignored-- M include/llvm/Linker.h M tools/bugpoint/Miscompilation.cpp M tools/bugpoint/BugDriver.cpp M tools/llvm-link/llvm-link.cpp M lib/Linker/LinkModules.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141606 91177308-0d34-0410-b5e6-96231b3b80d8
| * lib/Linker: add support of deps which does not end with ".so".Ivan Krasin2011-09-201-0/+8
| | | | | | | | | | | | | | | | | | | | It happens (for example) when you want to have a dependency on the .so with the specific version, like liblzma.so.1.0.0 or libcrypto.so.0.9.8. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140201 91177308-0d34-0410-b5e6-96231b3b80d8
| * switch to the new struct api.Chris Lattner2011-08-121-3/+3
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137482 91177308-0d34-0410-b5e6-96231b3b80d8
| * Linke NamedMDNodes after linking global values as comment suggests.Devang Patel2011-08-041-5/+5
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136909 91177308-0d34-0410-b5e6-96231b3b80d8
| * Rewrite the CMake build to use explicit dependencies between libraries,Chandler Carruth2011-07-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specified in the same file that the library itself is created. This is more idiomatic for CMake builds, and also allows us to correctly specify dependencies that are missed due to bugs in the GenLibDeps perl script, or change from compiler to compiler. On Linux, this returns CMake to a place where it can relably rebuild several targets of LLVM. I have tried not to change the dependencies from the ones in the current auto-generated file. The only places I've really diverged are in places where I was seeing link failures, and added a dependency. The goal of this patch is not to start changing the dependencies, merely to move them into the correct location, and an explicit form that we can control and change when necessary. This also removes a serialization point in the build because we don't have to scan all the libraries before we begin building various tools. We no longer have a step of the build that regenerates a file inside the source tree. A few other associated cleanups fall out of this. This isn't really finished yet though. After talking to dgregor he urged switching to a single CMake macro to construct libraries with both sources and dependencies in the arguments. Migrating from the two macros to that style will be a follow-up patch. Also, llvm-config is still generated with GenLibDeps.pl, which means it still has slightly buggy dependencies. The internal CMake 'llvm-config-like' macro uses the correct explicitly specified dependencies however. A future patch will switch llvm-config generation (when using CMake) to be based on these deps as well. This may well break Windows. I'm getting a machine set up now to dig into any failures there. If anyone can chime in with problems they see or ideas of how to solve them for Windows, much appreciated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136433 91177308-0d34-0410-b5e6-96231b3b80d8
* | Merge with LLVM upstream r135568 (Jul 20th 2011)Logan Chien2011-07-201-1/+1
|\ \ | |/ | | | | | | | | | | Conflicts: lib/Bitcode/Reader/BitcodeReader.cpp Change-Id: Iebed76d2f7d281e742947e31d9a0b78174daf2d6
| * Migrate LLVM and Clang to use the new makeArrayRef(...) functions where ↵Frits van Bommel2011-07-181-1/+1
| | | | | | | | | | | | | | | | | | previously explicit non-default constructors were used. Mostly mechanical with some manual reformatting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135390 91177308-0d34-0410-b5e6-96231b3b80d8
* | Merge upstream to r135343 at Sat. 16th July 2011.Nowar Gu2011-07-161-1075/+741
|\ \ | |/
| * Link NamedMDNode before linking function bodies.Devang Patel2011-07-141-5/+5
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135204 91177308-0d34-0410-b5e6-96231b3b80d8