Commit Graph

2486 Commits

Author SHA1 Message Date
Rui Ueyama d1b00ea848 Update comments.
llvm-svn: 226380
2015-01-17 22:38:09 +00:00
Greg Fitzgerald c7a815bb3a Add LLVM_LINK_COMPONENTS for the shared object build
Differential Revision: http://reviews.llvm.org/D7023

From: Greg Fitzgerald <garious@gmail.com>
llvm-svn: 226346
2015-01-16 23:34:41 +00:00
Rui Ueyama 3a8d7e2f10 [PATCH] Speculatively instantiate archive members
LLD parses archive file index table only at first. When it finds a symbol
it is looking for is defined in a member file in an archive file, it actually
reads the member from the archive file. That's done in the core linker.

That's a single-thread process since the core linker is single threaded.
If your command line contains a few object files and a lot of archive files
(which is quite often the case), LLD hardly utilizes hardware parallelism.

This patch improves parallelism by speculatively instantiating archive
file members. At the beginning of the core linking, we first create a map
containing all symbols defined in all members, and each time we find a
new undefined symbol, we instantiate a member file containing the
symbol (if such file exists). File instantiation is side effect free, so this
should not affect correctness.

This is a quick benchmark result. Time to link self-link LLD executable:

Linux   9.78s -> 8.50s (0.86x)
Windows 6.18s -> 4.51s (0.73x)

http://reviews.llvm.org/D7015

llvm-svn: 226336
2015-01-16 22:44:50 +00:00
Saleem Abdulrasool 0e69c38d5d PE/COFF: rework how we handle base relocations
Generalise the base relocation handling slightly to support multiple base
relocation types in PE/COFF.  This is necessary to generate proper executables
for WoA.

Track the base relocation type from the decision that we need a base relocation
to the point where we emit the base relocation into base relocation directory.

Remove an outdated TODO item while in the area.

llvm-svn: 226335
2015-01-16 22:34:10 +00:00
Rui Ueyama c3abf062a1 Move common code to base class.
llvm-svn: 226329
2015-01-16 21:58:20 +00:00
Rui Ueyama bd350a5cd2 Remove duplication code.
llvm-svn: 226321
2015-01-16 21:11:00 +00:00
Rui Ueyama 6d176f88ea [PECOFF] Remove ResolvableSymbols to simplify.
We had such class there because of InputGraph abstraction.
Previously, no one except InputGraph itself has complete picture of
input file list. In order to create a set of all defined symbols,
we had to use some indirections there to workaround InputGraph.

It can now be rewritten as simple code. No change in functionality.

llvm-svn: 226319
2015-01-16 20:48:46 +00:00
Rui Ueyama 949dc41502 Split a function for readability.
llvm-svn: 226292
2015-01-16 17:53:55 +00:00
Rui Ueyama d50d2e7af0 Simplify. No functionality change.
llvm-svn: 226287
2015-01-16 16:58:58 +00:00
Rui Ueyama cb9b1086ff [PECOFF] Improve parallelism.
llvm-svn: 226284
2015-01-16 15:58:36 +00:00
Rui Ueyama d4730ea555 Run the resolver in parallel with the reader.
This patch makes File::parse() multi-thread safe. If one thread is running
File::parse(), other threads will block if they try to call the same method.
File::parse() is idempotent, so you can safely call  multiple times.

With this change, we don't have to wait for all worker threads to finish
in Driver::link(). Previously, Driver::link() calls TaskGroup::sync() to
wait for all threads running File::parse(). This was not ideal because
we couldn't start the resolver until we parse all files.

This patch increase parallelism by making Driver::link() to not wait for
worker threads. The resolver calls parse() to make sure that the file
being read has been parsed, and then uses the file. In this approach,
the resolver can run with the parser threads in parallel.

http://reviews.llvm.org/D6994

llvm-svn: 226281
2015-01-16 15:54:13 +00:00
Rui Ueyama fa7e8a663f [ELF] Add --as-needed.
The previous default behavior of LLD is --as-needed. LLD linked
against a DSO only if the DSO file was actually used to link an
executable (i.e. at least one symbol was resolved using the shared
library file.)

In this patch I added a boolean flag to FileNode for --as-needed.
I also added an accessor to DSO name to shared library file class.

llvm-svn: 226274
2015-01-16 14:27:01 +00:00
Simon Atanasyan 6cea6473b3 [ELF] Remove TargetHandler and DefaultTargetHandler constructors
These classes contain only abstract virtual functions. Explicit
constructors are redundant.

llvm-svn: 226265
2015-01-16 09:40:21 +00:00
Simon Atanasyan c7c4b26c11 [ELF] Remove unused class field
No functional changes.

llvm-svn: 226262
2015-01-16 08:58:14 +00:00
Simon Atanasyan 49a055336b [ELF] s/_context/_ctx/ and clang-format the code
No functional changes.

llvm-svn: 226261
2015-01-16 08:58:09 +00:00
Simon Atanasyan 7bdd62b2cd [ELF] Make the unhandledReferenceType() protected method
No functional changes.

llvm-svn: 226260
2015-01-16 08:58:03 +00:00
Simon Atanasyan 8a9c8b1968 [ELF] Make `TargetRelocationHandler` a regular non-template class
This class defines a relocation handler interface. The interface does
not depend on the template argument so the argument is redundant.

llvm-svn: 226259
2015-01-16 08:57:58 +00:00
Simon Atanasyan 42f0e789ed [PPC] Remove redundant `virtual` keyword
No functional changes.

llvm-svn: 226258
2015-01-16 08:57:45 +00:00
Simon Atanasyan 53d940335c [PPC] Remove unused class field PPCTargetRelocationHandler::_ppcTargetLayout
No functional changes.

llvm-svn: 226257
2015-01-16 08:57:39 +00:00
Simon Atanasyan c46de4ba3b [Mips] Use ELFLinkingContext class instead of MipsLinkingContext where possible
No functional changes.

llvm-svn: 226256
2015-01-16 08:57:33 +00:00
Simon Atanasyan 0f049c1a7c [Mips] Make MipsLinkingContext owner of MipsELFFlagsMerger
That reduce class dependencies and simplify the code a bit.
No functional changes.

llvm-svn: 226255
2015-01-16 08:57:26 +00:00
Simon Atanasyan 157432bcb2 [Mips] Remove redundant namespace names
No functional changes.

llvm-svn: 226254
2015-01-16 08:57:17 +00:00
Simon Atanasyan 48b0bca7e8 [Mips] Allow linking object files with MIPS32 and MIPS64 instructions
If object files satisfy O32 ABI they can be linked together even if some
of them contains MIPS64 or MIPS64R2 instructions.

llvm-svn: 226253
2015-01-16 08:57:08 +00:00
Saleem Abdulrasool 6fffd487ee PE/COFF: use dyn_cast for the check of the target
The target may be a synthetic symbol like __ImageBase.  cast_or_null will ensure
that the atom is a DefinedAtom, which is not guaranteed, which was the original
reason for the cast_or_null.  Switch this to dyn_cast, which should enable
building of executables for WoA.  Unfortunately, the issue of missing base
relocations still needs to be investigated.

llvm-svn: 226246
2015-01-16 04:14:33 +00:00
Rui Ueyama 18e53ca3dd Use std::recursive_mutex instead of llvm's SmartMutex.
llvm-svn: 226236
2015-01-16 00:55:01 +00:00
Rui Ueyama c2836079df Simplify.
llvm-svn: 226225
2015-01-15 23:15:09 +00:00
Filipe Cabecinhas e609302ad1 Remove the slashes so they don't fail in some Windows setups
llvm-svn: 226222
2015-01-15 23:04:15 +00:00
Rui Ueyama 8aa4aa4fd5 Add "explicit".
llvm-svn: 226205
2015-01-15 21:05:00 +00:00
Rui Ueyama 962b0c7740 Rename InputGraph.h -> Node.h.
llvm-svn: 226154
2015-01-15 08:58:38 +00:00
Rui Ueyama ae1daae461 Simplify.
llvm-svn: 226153
2015-01-15 08:51:23 +00:00
Rui Ueyama cf14b63116 [ELF] Do not error on non-existent file in the driver.
This change makes it easy to write unit tests for the GNU driver.
No more "empty group" hack is needed. No change in functionality.

llvm-svn: 226150
2015-01-15 08:49:19 +00:00
Rui Ueyama 883afba228 Remove InputGraph and use std::vector<Node> instead.
In total we have removed more than 1000 lines!

llvm-svn: 226149
2015-01-15 08:46:36 +00:00
Rui Ueyama 61635440a9 Rename InputElement Node.
InputElement was named that because it's an element of an InputGraph.
It's losing the origin because the InputGraph is now being removed.
InputElement's subclass is FileNode, that naming inconsistency needed
to be fixed.

llvm-svn: 226147
2015-01-15 08:31:46 +00:00
Rui Ueyama 861c2d6c3a Remove InputGraph::addInputElement{,Front}.
They were the last member functions of InputGraph (besides members()).
Now InputGraph is just a container of a vector. We are ready to replace
InputGraph with plain File vector.

llvm-svn: 226146
2015-01-15 08:18:14 +00:00
Rui Ueyama 423177a54b Remove WrapperNode.
WrapperNode was a useless subclass of FileNode. We should just use
FileNode instead.

llvm-svn: 226145
2015-01-15 08:10:10 +00:00
Rui Ueyama df3fca2520 Remove FileNode::parse.
FileNode::parse was just a forwarder to File::parse so we could remove that.
Also removed dead code.

llvm-svn: 226144
2015-01-15 07:56:14 +00:00
Rui Ueyama 7c4ba12769 Remove FileNode::getPath().
Previously both FileNode and File keep filename. This patch removed
that redundancy.

llvm-svn: 226143
2015-01-15 07:38:32 +00:00
Rui Ueyama be9acbfde0 temporary commit.
llvm-svn: 226141
2015-01-15 07:23:39 +00:00
Rui Ueyama cdb1071be5 Remove InputGraph::size().
llvm-svn: 226140
2015-01-15 07:20:39 +00:00
Rui Ueyama 56206368f5 Simplify FileNode.
The member function was defined to allow subclasses to customize
error message. But since we only have one FileNode type, there's
no actual need for that.

llvm-svn: 226139
2015-01-15 07:15:36 +00:00
Rui Ueyama 8054342f9e Merge SimpleFileNode with WrapperNode.
llvm-svn: 226137
2015-01-15 07:05:46 +00:00
Rui Ueyama 5a831ee5fd [PECOFF] Remove an InputElement placeholder for the entry name.
llvm-svn: 226133
2015-01-15 06:56:26 +00:00
Rui Ueyama 80c04431ca Re-commit r225766, r225767, r225769, r225814, r225816, r225829, and r225832.
These changes depended on r225674 and had been rolled back in r225859.
Because r225674 has been re-submitted, it's safe to re-submit them.

llvm-svn: 226132
2015-01-15 06:49:21 +00:00
Rui Ueyama 2b5a4fbc30 Attempt to fix a Linux buildbot.
llvm-svn: 226127
2015-01-15 05:41:12 +00:00
Rui Ueyama df230b21e3 Re-commit r225674: Convert other drivers to use WrapperNode.
The original commit had an issue with Mac OS dylib files. It didn't
handle fat binary dylib files correctly. This patch includes a fix.
A test for that case has already been committed in r225764.

llvm-svn: 226123
2015-01-15 04:34:31 +00:00
Rui Ueyama a2013fa33c Make libmyshared.dylib a fat binary.
This would have caught the issue that I made in r225764.

llvm-svn: 226072
2015-01-15 01:32:00 +00:00
Chandler Carruth 89642a7b37 [cleanup] Re-sort #include lines using llvm/utils/sort_includes.py
This is just a mechanical cleanup, no functionality changed. This just
fixes very minor inconsistencies with how #include lines were spaced and
sorted in LLD.

llvm-svn: 225978
2015-01-14 11:26:52 +00:00
Rui Ueyama cfb2534ef8 Revert "Convert other drivers to use WrapperNode" and subsequent commits.
r225764 broke a basic functionality on Mac OS. This change reverts
r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832.

llvm-svn: 225859
2015-01-14 00:21:34 +00:00
Rui Ueyama b34838424a Remove InputGraph::getNextFile().
getNextFile used to have a complex logic to determine which file
should be processed by the Resolver on next iteration.
Now, it is just a sequential accessor to the internal array and
provides no sensible feature.

This patch also removes InputGraph::getGroupSize and InputGraph::
skipGroup to simplify the code.

llvm-svn: 225832
2015-01-13 21:27:12 +00:00
Rui Ueyama a4f2925bd1 Use init list and move operator instead of swap().
llvm-svn: 225829
2015-01-13 21:09:05 +00:00
Rui Ueyama 555cd88224 Simplify.
We can remove these methods because every InputElement has
only one File.

llvm-svn: 225816
2015-01-13 18:51:09 +00:00
Rui Ueyama 0d31e53095 Replace vector<unique_ptr<File> with unique_ptr<File>.
Because each InputElement has exactly one File, we no longer have
to use a vector to store pointers to Files.

llvm-svn: 225814
2015-01-13 18:47:25 +00:00
Rui Ueyama d5bb5c2bfe Remove dead code.
Now every InputElement has exactly one File in it, so "expand"
method is now no-op.

llvm-svn: 225769
2015-01-13 05:59:17 +00:00
Rui Ueyama 64e3dedf3b Remove InputGraph::registerObserver.
PECOFF was the only user of the API, and the reason why we created
the API is because, although the driver creates a list of input files,
it has no knowledge on what files are being created. It was because
everything was hidden behind the InputGraph abstraction.

Now the driver knows what that's doing. We no longer need this
indirection to get the file list being processed.

llvm-svn: 225767
2015-01-13 05:24:53 +00:00
Rui Ueyama d2838c4958 Remove InputGraph::dump().
This is dead code.

llvm-svn: 225766
2015-01-13 05:11:05 +00:00
Rui Ueyama e8ecb2b144 Convert other drivers to use WrapperNode.
llvm-svn: 225764
2015-01-13 04:33:07 +00:00
Greg Fitzgerald 5a60ed7708 Remove fragile regex from test
Differential Revision: http://reviews.llvm.org/D6937

llvm-svn: 225739
2015-01-13 00:12:04 +00:00
Greg Fitzgerald cedca2f057 Remove CMake standalone build configuration
Differential Revision: http://reviews.llvm.org/D6898

llvm-svn: 225704
2015-01-12 21:41:10 +00:00
Rui Ueyama 1e51e238ed Update comment.
llvm-svn: 225645
2015-01-12 18:32:24 +00:00
Greg Fitzgerald fcf77fd369 Don't fail if parent directory name contains a '+' character
Differential Revision: http://reviews.llvm.org/D6902

llvm-svn: 225574
2015-01-10 02:34:26 +00:00
Saleem Abdulrasool b9c402ed25 PE/COFF: add support to import functions in ARM NT
This is necessary to support linking a basic program which references symbols
outside of the module itself.  Add the import thunk for ARM NT style imports.
This allows us to create the reference.  However, it is still insufficient to
generate executables that will run due to base relocations not being emitted for
the import.

llvm-svn: 225428
2015-01-08 04:19:08 +00:00
Saleem Abdulrasool f9b99a1e07 PE/COFF: teach ARMNT backend about ADDR32NB for exports
This adds the ability to export symbols from a DLL built for ARMNT.  Add this
support first to help work towards adding support for import thunks on Windows
on ARM.  In order to generate the exports, add support for
IMAGE_REL_ARM_ADDR32NB relocations.

llvm-svn: 225339
2015-01-07 04:20:26 +00:00
Rui Ueyama 5a25fd5962 [ELF] Remove {ELF,}GNULinkerScript.
Instead of representing a linker script file as an "InputElement",
parse and evaluate scripts in the driver as we see them.

Linker scripts are not regular input files (regular file is one of
object, archive, or shared library file). They are more like
extended command line options. Linker script handling was needlessly
complicated because of that inappropriate abstraction (besides
excessive class hierarchy -- there is no such thing like ELF linker
script but we had two classes there for some reason.)

LinkerScript was one of a few remaining InputElement subclasses
that can be expanded to multiple files. With this patch, we are one
step closer to retire InputElement.

http://reviews.llvm.org/D6648

llvm-svn: 225330
2015-01-07 01:13:08 +00:00
Rui Ueyama a5f2816b1c Convert CoreInputGraph.
This is a part of InputGraph cleanup to represent input files as a flat
list of Files (and some meta-nodes for group etc.)

We cannot achieve that goal in one gigantic patch, so I split the task
into small steps as shown below.

(Recap the progress so far: Currently InputGraph contains a list of
InputElements. Each InputElement contain one File (that used to have
multiple Files, but I eliminated that use case in r223867). Files are
currently instantiated in Driver::link(), but I already made a change
to separate file parsing from object instantiation (r224102), so we
can safely instantiate Files when we need them, instead of wrapping
a file with the wrapper class (FileNode class). InputGraph used to
act like a generator class by interpreting groups by itself, but it's
now just a container of a list of InputElements (r223867).)

1. Instantiate Files in the driver and wrap them with WrapperNode.
WrapperNode is a temporary class that allows us to instantiate Files
in the driver while keep using the current InputGraph data structure.

This patch demonstrates how this step 1 looks like, using Core driver
as an example.

2. Do the same thing for the other drivers.

When step 2 is done, an InputGraph consists of GroupEnd objects or
WrapperNodes each of which contains one File. Other types of
FileNode subclasses are removed.

3. Replace InputGraph with std::vector<std::unique_ptr<InputElement>>.
InputGraph is already just a container of list of InputElements,
so this step removes that needless class.

4. Remove WrapperNode.

We need some code cleanup between each step, because many classes
do a bit odd things (e.g. InputGraph::getGroupSize()). I'll straight
things up as I need to.

llvm-svn: 225313
2015-01-06 23:06:49 +00:00
Saleem Abdulrasool 1e94ef5bd0 PECOFF: adjust the entry point on ARM NT
ARM NT assumes a purely THUMB execution, and as such requires that the address
of entry point is adjusted to indicate a thumb entry point.  Unconditionally
adjust the AddressOfEntryPoint in the PE header for PE/COFF ARM as we only
support ARM NT at the moment.

llvm-svn: 225139
2015-01-04 20:26:45 +00:00
Saleem Abdulrasool 4c059622d5 test: correct PE/COFF tests to build under MSVC mode
This adjusts the inputs to be compatible with armv7-windows-msvc as well as
armv7-windows-itanium.  NFC.

llvm-svn: 225105
2015-01-03 00:57:14 +00:00
Saleem Abdulrasool a09f872f58 ReaderWriter: adjust ARM target addresses for exec
ARM NT assumes a THUMB only environment.  As such, any address that is detected
as residing in an executable section is adjusted to have its bottom bit set to
indicate THUMB in case of a mode exchange.

Although the testing here seems insufficient (missing the negative cases) the
existing test cases for the IMAGE_REL_ARM_{ADDR32,MOV32T} are relevant as they
ensure that we do not incorrectly set the bit.

llvm-svn: 225104
2015-01-03 00:57:10 +00:00
Saleem Abdulrasool 434fedb8d8 ReaderWriter: teach the writer about IMAGE_REL_ARM_BRANCH24T
This adds support for IMAGE_REL_ARM_BRANCH24T relocations.  Similar to the
IMAGE_REL_ARM_BLX32T relocation, this relocation requires munging an
instruction.  The instruction encoding is quite similar, allowing us to reuse
the same munging implementation.  This is needed by the entry point stubs for
modules provided by MSVCRT.

llvm-svn: 225082
2015-01-02 18:51:59 +00:00
Saleem Abdulrasool f081873161 ReaderWriter: teach the writer about IMAGE_REL_ARM_BLX23T
This adds support for IMAGE_REL_ARM_BLX23T relocations.  Similar to the
IMAGE_REL_ARM_MOV32T relocation, this relocation requires munging an
instruction.  This inches us closer to supporting a basic hello world
application.

llvm-svn: 225081
2015-01-02 18:51:36 +00:00
Saleem Abdulrasool 017822d81a ReaderWriter: teach the writer about IMAGE_REL_ARM_MOV32T
This adds support for the IMAGE_REL_ARM_MOV32T relocation.  This is one of the
most complicated relocations for the Window on ARM target.  It involves
re-encoding an instruction to contain an immediate value which is the relocation
target.

llvm-svn: 225072
2015-01-02 02:32:05 +00:00
Saleem Abdulrasool 425505a9aa test: fix tests/buildbots
Correct the yaml definition for the object.  Adjust the symbol storage class
which was flipped for the two symbols, resulting in the link failure due to the
symbol missing.  Adjust the virtual address of the section.  This ripples into
the test case, since the data has been shifted up by 4 bytes.

llvm-svn: 225058
2015-01-01 03:39:48 +00:00
Saleem Abdulrasool 93930b65b8 ReaderWriter: teach the writer about IMAGE_REL_ARM_ADDR32
This implements the IMAGE_REL_ARM_ADDR32 relocation.  There are still a few more
relocation types that need to resolved before lld can even attempt to link a
trivial program for Windows on ARM.

llvm-svn: 225057
2015-01-01 03:11:53 +00:00
Saleem Abdulrasool 0ba09e6b84 ReaderWriter: teach PE/COFF backend about ARM NT
This teaches lld about the ARM NT object types.  Add a trivial test to ensure
that it can handle ARM NT object file inputs.  It is still unable to perform the
necessary relocations for ARM NT, but this allows the linker to at least read
the objects.

llvm-svn: 225052
2014-12-31 22:32:21 +00:00
Chandler Carruth 60617eac47 [py3] Make this test compatible with Python 3 where bytes and
strings don't mix so easily. This fixes the last remaining failure
I have in 'check-all' on a system with both Python3 and and Python2
installed.

llvm-svn: 224947
2014-12-29 19:23:31 +00:00
Chandler Carruth 24e9773fc5 [multilib] Teach LLD's CMake build to use LLVM_LIBDIR_SUFFIX which
allows it to support multilib suffixed hosts using lib64, etc. This
variable is now available both in the direct LLVM build and from the
LLVMConfig.cmake file used by standalone builds.

llvm-svn: 224925
2014-12-29 12:11:30 +00:00
Simon Atanasyan e473df2bf6 [Mips] Replace stderr output by the `llvm_unreachable` call
If a regular symbol has microMIPS-bit we need to stop linking. Now the
LLD does not check the `applyRelocation` return value and continues
linking anyway. As a temporary workaround use the `llvm_unreachable`
call to stop the linker.

llvm-svn: 224831
2014-12-25 09:23:47 +00:00
Simon Atanasyan 9af53992c8 [Mips] Make the test more tolerant to the linker output order
The LLD output in the YAML mode depends on LLD_RUN_ROUNDTRIP_TEST
environment variable. Do not check unimportant YAML items like section-name.

llvm-svn: 224830
2014-12-25 09:23:37 +00:00
Simon Atanasyan 45010c92a8 [Mips] Support linking of microMIPS 32-bit code
The change is rather large but mainly it just adds handling of new relocations,
PLT entries etc.

llvm-svn: 224826
2014-12-24 21:04:05 +00:00
Simon Atanasyan 926f79f44f [Mips] Join two if statements
No functional changes.

llvm-svn: 224817
2014-12-24 12:19:42 +00:00
Simon Atanasyan 1a978ed9ac [Mips] Make the comment more descriptive
No functional changes.

llvm-svn: 224816
2014-12-24 12:19:36 +00:00
Simon Atanasyan 4360be5d26 [Mips] Factor out the code checks a symbol's binding
No functional changes.

llvm-svn: 224815
2014-12-24 12:19:30 +00:00
Simon Atanasyan eab5dc815a [Mips] Rename the function s/readAddend/getAddend/
No functional changes.

llvm-svn: 224814
2014-12-24 12:19:24 +00:00
Simon Atanasyan 375f07a919 [Mips] Use OR operation to set the microMIPS bit
llvm-svn: 224813
2014-12-24 12:19:18 +00:00
Nico Weber 9b839f8ced Tweak lld's checkout instructions.
llvm-svn: 224778
2014-12-23 18:52:41 +00:00
Jean-Daniel Dupas edefcccd46 [macho] Minor install_name fixes
Summary:
Fix the binary file reader to properly read dyld version info.
Update the install_name test case to properly test the binary reader. We can't use '-print_atoms' as the output format is 'native' yaml and it does not contains the dyld current and compatibility versions. 

Also change the timestamp value of LD_ID_DYLD to match the one generated by ld64.
The dynamic linker (dyld) used to expects different values for timestamp in LD_ID_DYLD and LD_LOAD_DYLD for prebound images. While prebinding is deprecated, we should probably keep it safe and match ld64. 

Reviewers: kledzik

Subscribers: llvm-commits

Projects: #lld

Differential Revision: http://reviews.llvm.org/D6736

llvm-svn: 224681
2014-12-20 09:22:56 +00:00
Jean-Daniel Dupas 23dd15e26d [macho] -rpath support
Summary:
Work on adding -rpath support to the mach-o linker.
This patch is based on the ld64 behavior for the command line option validation.

It includes a basic test to check that the LC_RPATH load commands are properly generated when that option is used.

It also add LC_RPATH support to the binary reader, but I don't know how to test it though.


Reviewers: kledzik

Subscribers: llvm-commits

Projects: #lld

Differential Revision: http://reviews.llvm.org/D6724

llvm-svn: 224544
2014-12-18 21:33:38 +00:00
Ed Maste aaa317a1eb lld self-hosts on FreeBSD too
llvm-svn: 224448
2014-12-17 19:14:57 +00:00
Rui Ueyama 7da4037c81 Replace ReaderError with DynamicError.
ReaderErrorCategory was used only at one place. We now have a
DynamicErrorCategory for this kind of one-time error, so use it.
The calling function doesn't really care the type of an error, so
ReaderErrorCategory was actually dead code.

llvm-svn: 224245
2014-12-15 12:20:13 +00:00
Rui Ueyama c1eeb310d4 Remove dead code.
This field was not even initialized properly.

llvm-svn: 224236
2014-12-15 07:22:29 +00:00
Rui Ueyama 0a2c2dbfc2 Protect doParse() because that's not a public interface.
llvm-svn: 224235
2014-12-15 07:14:32 +00:00
Rui Ueyama 0b23c37413 Clean up #include dependency.
Core/File.h does not use LinkingContext.h, so remove that dependency.

llvm-svn: 224214
2014-12-14 07:57:35 +00:00
Rui Ueyama 0215c88f00 Remove PECOFFLibraryNode.
This class is empty, provides no additional feature to the base class.

llvm-svn: 224212
2014-12-14 05:08:53 +00:00
Rui Ueyama c39120e101 More WinLinkInputGraph cleanup.
This function is called only from WinLinkDriver.cpp.
Move the function to that file and mark as static.

llvm-svn: 224211
2014-12-14 05:04:22 +00:00
Rui Ueyama 11c4874d83 [PECOFF] Resolve file name in the driver, not in InputElement.
llvm-svn: 224209
2014-12-14 02:50:29 +00:00
Rui Ueyama e9b455184f Simplify InputGraph API.
These member functions returns either no_more_files error or a File object.
We could simply return a nullptr instead of a no_more_files.
This function will be removed soon as a part of InputGraph cleanup.
I had to do that step by step.

llvm-svn: 224208
2014-12-14 02:04:01 +00:00
Rui Ueyama 83220a00ea Remove dead code.
llvm-svn: 224207
2014-12-14 02:03:54 +00:00
Rui Ueyama 4726967a51 Remove code duplication.
llvm-svn: 224206
2014-12-14 02:03:47 +00:00
Rui Ueyama 92cdfc7cb8 [ELF] Clean up OPT_INPUT handler. NFC.
llvm-svn: 224192
2014-12-13 09:36:44 +00:00
Rui Ueyama a60a75e566 Make YAML files own MemoryBuffer.
YAML files have references such as StringRef to the underlying
MemoryBuffer, so we shouldn't deallocate the buffer.

llvm-svn: 224191
2014-12-13 08:59:50 +00:00
Rui Ueyama ecf28e25de Move definitions to the correct file.
llvm-svn: 224190
2014-12-13 08:59:46 +00:00