aboutsummaryrefslogtreecommitdiff
path: root/lld
AgeCommit message (Collapse)AuthorFilesLines
2015-01-14[cleanup] Re-sort #include lines using llvm/utils/sort_includes.pyChandler Carruth6-6/+2
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-14Revert "Convert other drivers to use WrapperNode" and subsequent commits.Rui Ueyama45-407/+951
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-13Remove InputGraph::getNextFile().Rui Ueyama6-158/+31
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-13Use init list and move operator instead of swap().Rui Ueyama2-9/+9
llvm-svn: 225829
2015-01-13Simplify.Rui Ueyama2-31/+10
We can remove these methods because every InputElement has only one File. llvm-svn: 225816
2015-01-13Replace vector<unique_ptr<File> with unique_ptr<File>.Rui Ueyama4-20/+16
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-13Remove dead code.Rui Ueyama4-53/+1
Now every InputElement has exactly one File in it, so "expand" method is now no-op. llvm-svn: 225769
2015-01-13Remove InputGraph::registerObserver.Rui Ueyama7-81/+62
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-13Remove InputGraph::dump().Rui Ueyama3-13/+0
This is dead code. llvm-svn: 225766
2015-01-13Convert other drivers to use WrapperNode.Rui Ueyama36-602/+294
llvm-svn: 225764
2015-01-13Remove fragile regex from testGreg Fitzgerald2-5/+5
Differential Revision: http://reviews.llvm.org/D6937 llvm-svn: 225739
2015-01-12Remove CMake standalone build configurationGreg Fitzgerald2-119/+17
Differential Revision: http://reviews.llvm.org/D6898 llvm-svn: 225704
2015-01-12Update comment.Rui Ueyama1-2/+2
llvm-svn: 225645
2015-01-10Don't fail if parent directory name contains a '+' characterGreg Fitzgerald2-5/+5
Differential Revision: http://reviews.llvm.org/D6902 llvm-svn: 225574
2015-01-08PE/COFF: add support to import functions in ARM NTSaleem Abdulrasool5-7/+117
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-07PE/COFF: teach ARMNT backend about ADDR32NB for exportsSaleem Abdulrasool6-0/+84
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[ELF] Remove {ELF,}GNULinkerScript.Rui Ueyama3-109/+57
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-06Convert CoreInputGraph.Rui Ueyama9-76/+122
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-04PECOFF: adjust the entry point on ARM NTSaleem Abdulrasool4-3/+61
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-03test: correct PE/COFF tests to build under MSVC modeSaleem Abdulrasool3-13/+9
This adjusts the inputs to be compatible with armv7-windows-msvc as well as armv7-windows-itanium. NFC. llvm-svn: 225105
2015-01-03ReaderWriter: adjust ARM target addresses for execSaleem Abdulrasool7-1/+186
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-02ReaderWriter: teach the writer about IMAGE_REL_ARM_BRANCH24TSaleem Abdulrasool4-1/+91
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-02ReaderWriter: teach the writer about IMAGE_REL_ARM_BLX23TSaleem Abdulrasool4-0/+119
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-02ReaderWriter: teach the writer about IMAGE_REL_ARM_MOV32TSaleem Abdulrasool4-0/+112
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-01test: fix tests/buildbotsSaleem Abdulrasool2-4/+4
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-01ReaderWriter: teach the writer about IMAGE_REL_ARM_ADDR32Saleem Abdulrasool4-4/+93
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
2014-12-31ReaderWriter: teach PE/COFF backend about ARM NTSaleem Abdulrasool5-0/+53
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-29[py3] Make this test compatible with Python 3 where bytes andChandler Carruth1-8/+8
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[multilib] Teach LLD's CMake build to use LLVM_LIBDIR_SUFFIX whichChandler Carruth2-4/+4
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-25[Mips] Replace stderr output by the `llvm_unreachable` callSimon Atanasyan2-52/+4
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[Mips] Make the test more tolerant to the linker output orderSimon Atanasyan1-7/+7
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-24[Mips] Support linking of microMIPS 32-bit codeSimon Atanasyan41-84/+4516
The change is rather large but mainly it just adds handling of new relocations, PLT entries etc. llvm-svn: 224826
2014-12-24[Mips] Join two if statementsSimon Atanasyan1-3/+1
No functional changes. llvm-svn: 224817
2014-12-24[Mips] Make the comment more descriptiveSimon Atanasyan1-1/+1
No functional changes. llvm-svn: 224816
2014-12-24[Mips] Factor out the code checks a symbol's bindingSimon Atanasyan1-5/+6
No functional changes. llvm-svn: 224815
2014-12-24[Mips] Rename the function s/readAddend/getAddend/Simon Atanasyan1-4/+4
No functional changes. llvm-svn: 224814
2014-12-24[Mips] Use OR operation to set the microMIPS bitSimon Atanasyan2-2/+2
llvm-svn: 224813
2014-12-23Tweak lld's checkout instructions.Nico Weber1-1/+3
llvm-svn: 224778
2014-12-20[macho] Minor install_name fixesJean-Daniel Dupas3-14/+29
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-18[macho] -rpath supportJean-Daniel Dupas8-0/+104
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-17lld self-hosts on FreeBSD tooEd Maste1-1/+1
llvm-svn: 224448
2014-12-15Replace ReaderError with DynamicError.Rui Ueyama3-42/+1
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-15Remove dead code.Rui Ueyama1-4/+0
This field was not even initialized properly. llvm-svn: 224236
2014-12-15Protect doParse() because that's not a public interface.Rui Ueyama6-17/+21
llvm-svn: 224235
2014-12-14Clean up #include dependency.Rui Ueyama4-3/+5
Core/File.h does not use LinkingContext.h, so remove that dependency. llvm-svn: 224214
2014-12-14Remove PECOFFLibraryNode.Rui Ueyama2-9/+2
This class is empty, provides no additional feature to the base class. llvm-svn: 224212
2014-12-14More WinLinkInputGraph cleanup.Rui Ueyama3-12/+10
This function is called only from WinLinkDriver.cpp. Move the function to that file and mark as static. llvm-svn: 224211
2014-12-14[PECOFF] Resolve file name in the driver, not in InputElement.Rui Ueyama3-21/+24
llvm-svn: 224209
2014-12-14Simplify InputGraph API.Rui Ueyama7-87/+37
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-14Remove dead code.Rui Ueyama3-35/+2
llvm-svn: 224207