Commit Graph

404 Commits

Author SHA1 Message Date
Ivan Krasin
5f2318e065 lib/Linker: add support of deps which does not end with ".so".
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
2011-09-20 22:52:35 +00:00
Chris Lattner
1bcbf8582e switch to the new struct api.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137482 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12 18:07:26 +00:00
Devang Patel
211da8f7a9 Linke NamedMDNodes after linking global values as comment suggests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136909 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-04 19:44:28 +00:00
Chandler Carruth
ac03e736c7 Rewrite the CMake build to use explicit dependencies between libraries,
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
2011-07-29 00:14:25 +00:00
Frits van Bommel
39b5abf507 Migrate LLVM and Clang to use the new makeArrayRef(...) functions where 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
2011-07-18 12:00:32 +00:00
Devang Patel
2959ebd14d Link NamedMDNode before linking function bodies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135204 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 22:13:07 +00:00
Chris Lattner
f84c59d110 simplify this logic now that GlobalAlias::isDeclaration is fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135183 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 20:23:05 +00:00
Chris Lattner
1afcace3a3 Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM.  One way to look at it
is through diffstat:
 109 files changed, 3005 insertions(+), 5906 deletions(-)

Removing almost 3K lines of code is a good thing.  Other advantages
include:

1. Value::getType() is a simple load that can be CSE'd, not a mutating
   union-find operation.
2. Types a uniqued and never move once created, defining away PATypeHolder.
3. Structs can be "named" now, and their name is part of the identity that
   uniques them.  This means that the compiler doesn't merge them structurally
   which makes the IR much less confusing.
4. Now that there is no way to get a cycle in a type graph without a named
   struct type, "upreferences" go away.
5. Type refinement is completely gone, which should make LTO much MUCH faster
   in some common cases with C++ code.
6. Types are now generally immutable, so we can use "Type *" instead 
   "const Type *" everywhere.

Downsides of this patch are that it removes some functions from the C API,
so people using those will have to upgrade to (not yet added) new API.  
"LLVM 3.0" is the right time to do this.

There are still some cleanups pending after this, this patch is large enough
as-is.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 17:41:24 +00:00
Bill Wendling
87fa8d12b4 Set the unnamed_addr only when we're creating a new GV in the dest module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128507 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 23:31:06 +00:00
Bill Wendling
5f49c29612 Revert r128501. It caused test failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128506 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 23:28:02 +00:00
Bill Wendling
75c7563f83 We need to copy over the unnamed_addr attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128501 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 23:05:41 +00:00
Rafael Espindola
4e93885bab Correctly merge available_externally and regular definitions when they have
different visibilities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124650 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 05:33:52 +00:00
Rafael Espindola
ba7c38c36a Allow unnamed_addr on declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123529 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 08:15:00 +00:00
Rafael Espindola
c2a94da313 Keep unnamed_addr when linking.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123364 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 05:12:34 +00:00
Chris Lattner
b5fa5fcecc Revamp the ValueMapper interfaces in a couple ways:
1. Take a flags argument instead of a bool.  This makes
   it more clear to the reader what it is used for.
2. Add a flag that says that "remapping a value not in the
   map is ok".
3. Reimplement MapValue to share a bunch of code and be a lot
   more efficient.  For lookup failures, don't drop null values
   into the map.
4. Using the new flag a bunch of code can vaporize in LinkModules
   and LoopUnswitch, kill it.

No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 08:15:20 +00:00
Chris Lattner
a797ee0210 include the module identifier when emitting this warning, PR8865.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-30 02:49:45 +00:00
Chris Lattner
c7bad77606 print the right string, thanks for Frits for noticing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122636 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-30 01:07:20 +00:00
Chris Lattner
e0f6db369d improve warning message to at least say what the triples are.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122632 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-29 22:41:18 +00:00
Michael J. Spencer
79e8625220 Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122158 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 22:23:15 +00:00
Michael J. Spencer
7385509101 Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 22:23:07 +00:00
Owen Anderson
fffa863536 Revert r122143 through r122140, which collectively broke the LLVMC tests on
the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122149 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 07:37:18 +00:00
Michael J. Spencer
1d6e7d2e42 Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:13:46 +00:00
Michael J. Spencer
b9c767cce5 Support/PathV1: Deprecate get{Basename,Dirname,Suffix}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122141 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18 04:13:36 +00:00
Michael J. Spencer
3ff9563c3e MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 03:29:14 +00:00
Michael J. Spencer
333fb04506 Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 17:36:48 +00:00
Michael J. Spencer
1f6efa3996 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:16:10 +00:00
Mikhail Glushenkov
c8aef4b2ea GetDLLSuffix: Remove the leading dot from LTDL_SHLIB_EXT.
This allows using GetDLLSuffix() with appendSuffix().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:59 +00:00
Mikhail Glushenkov
572ec1f3c0 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118050 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:52 +00:00
Rafael Espindola
19785995f6 Fix PR8300 by remembering to keep the bitcast in all cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116788 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 02:02:57 +00:00
Bill Wendling
933f9bdb00 Revert "RequiresUnique" patch. This should be handled at a lower level.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115827 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-06 20:18:44 +00:00
Bill Wendling
c7a012e581 Change RequiresMerge to RequiresUnique. It's a better description of what this
fix is trying to accomplish.

This code could still use some polishing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115759 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-06 07:03:52 +00:00
Bill Wendling
7f5124829f If the destination module all ready has a copy of the global coming from the
source module *and* it must be merged (instead of simply replaced or appended
to), then merge instead of replacing or adding another global.

The ObjC __image_info section was being appended to because of this
failure. This caused a crash because the linker expects the image info section
to be a specific size.

<rdar://problem/8198537>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-06 06:16:30 +00:00
Michael J. Spencer
3a210e2d30 Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
This reverts commit r113632

Conflicts:

	cmake/modules/AddLLVM.cmake

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 23:59:48 +00:00
Michael J. Spencer
4e9c939312 CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113632 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 21:14:25 +00:00
Chris Lattner
0b5b18340b dead code patrol
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112713 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 16:06:39 +00:00
Dan Gohman
6cb8c23db1 Reapply r112091 and r111922, support for metadata linking, with a
fix: add a flag to MapValue and friends which indicates whether
any module-level mappings are being made. In the common case of
inlining, no module-level mappings are needed, so MapValue doesn't
need to examine non-function-local metadata, which can be very
expensive in the case of a large module with really deep metadata
(e.g. a large C++ program compiled with -g).

This flag is a little awkward; perhaps eventually it can be moved
into the ClonedCodeInfo class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112190 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 15:41:53 +00:00
Daniel Dunbar
fd406f1ee2 Revert r112091, "Remap metadata attached to instructions when remapping
individual ...", which depends on r111922, which I am reverting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 03:48:08 +00:00
Dan Gohman
ce934260dc Remap metadata attached to instructions when remapping individual
instructions, not when remapping modules.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 21:36:50 +00:00
Bill Wendling
4e34d50272 - Add the LinkerPrivateWeakDefAutoLinkage to the Ada bindings.
- Support the LinkerWeak*Linkage types in llvm-nm and in LinkModules.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 20:00:52 +00:00
Dan Gohman
e422d1b162 Link NamedMDNodes after linking GlobalValues, so that MDNodes
which reference GlobalValues are properly remapped.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 19:37:11 +00:00
Dan Gohman
e5835fbe7f When linking NamedMDNodes, remap their operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111948 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 19:31:04 +00:00
Dan Gohman
05ea54e886 Use MapValue in the Linker instead of having a private function
which does the same thing. This eliminates redundant code and
handles MDNodes better. MDNode linking still doesn't fully
work yet though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111941 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 18:50:07 +00:00
Dan Gohman
c47a474802 Don't cast away qualifiers with C-style casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-24 18:09:44 +00:00
Argyrios Kyrtzidis
8c8b9ee8c8 Revert r111082. No warnings for this common pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111102 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15 10:27:23 +00:00
Argyrios Kyrtzidis
7268d97ae6 Add ATTRIBUTE_UNUSED to methods that are not supposed to be used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 21:35:10 +00:00
Dan Gohman
17aa92c92a Make NamedMDNode not be a subclass of Value, and simplify the interface
for creating and populating NamedMDNodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 23:38:33 +00:00
Bill Wendling
07d3177117 Revert r107205 and r107207.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107215 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 22:34:52 +00:00
Bill Wendling
207855cff9 Introducing the "linker_weak" linkage type. This will be used for Objective-C
metadata types which should be marked as "weak", but which the linker will
remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is
defined like this:

       .globl l_objc_msgSend_fixup_alloc
       .weak_definition l_objc_msgSend_fixup_alloc
       .section __DATA, __objc_msgrefs, coalesced
       .align 3
l_objc_msgSend_fixup_alloc:
        .quad   _objc_msgSend_fixup
        .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-29 21:24:00 +00:00
Dan Gohman
30377e7809 Add basic error checking to MemoryBuffer::getSTDIN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 17:31:51 +00:00
Dan Gohman
95131fcb67 Use the return value of getMagicNumber instead of using a
separate canRead() call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 17:18:38 +00:00