summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter
Commit message (Collapse)AuthorAgeFilesLines
...
* [Mips] Remove redundant namespace namesSimon Atanasyan2015-01-161-29/+27
| | | | | | No functional changes. llvm-svn: 226254
* [Mips] Allow linking object files with MIPS32 and MIPS64 instructionsSimon Atanasyan2015-01-161-4/+56
| | | | | | | If object files satisfy O32 ABI they can be linked together even if some of them contains MIPS64 or MIPS64R2 instructions. llvm-svn: 226253
* PE/COFF: use dyn_cast for the check of the targetSaleem Abdulrasool2015-01-161-1/+1
| | | | | | | | | | 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
* Simplify.Rui Ueyama2015-01-151-7/+5
| | | | llvm-svn: 226153
* Remove InputGraph and use std::vector<Node> instead.Rui Ueyama2015-01-152-6/+3
| | | | | | In total we have removed more than 1000 lines! llvm-svn: 226149
* Rename InputElement Node.Rui Ueyama2015-01-152-8/+8
| | | | | | | | | 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
* Remove InputGraph::addInputElement{,Front}.Rui Ueyama2015-01-151-3/+5
| | | | | | | | 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
* Remove WrapperNode.Rui Ueyama2015-01-151-5/+4
| | | | | | | WrapperNode was a useless subclass of FileNode. We should just use FileNode instead. llvm-svn: 226145
* Remove InputGraph::size().Rui Ueyama2015-01-152-2/+2
| | | | llvm-svn: 226140
* Merge SimpleFileNode with WrapperNode.Rui Ueyama2015-01-151-12/+9
| | | | llvm-svn: 226137
* [PECOFF] Remove an InputElement placeholder for the entry name.Rui Ueyama2015-01-151-5/+8
| | | | llvm-svn: 226133
* Re-commit r225766, r225767, r225769, r225814, r225816, r225829, and r225832.Rui Ueyama2015-01-153-52/+32
| | | | | | | 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
* Re-commit r225674: Convert other drivers to use WrapperNode.Rui Ueyama2015-01-1512-54/+54
| | | | | | | | 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
* [cleanup] Re-sort #include lines using llvm/utils/sort_includes.pyChandler Carruth2015-01-146-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
* Revert "Convert other drivers to use WrapperNode" and subsequent commits.Rui Ueyama2015-01-1413-80/+101
| | | | | | | r225764 broke a basic functionality on Mac OS. This change reverts r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832. llvm-svn: 225859
* Replace vector<unique_ptr<File> with unique_ptr<File>.Rui Ueyama2015-01-131-3/+1
| | | | | | | Because each InputElement has exactly one File, we no longer have to use a vector to store pointers to Files. llvm-svn: 225814
* Remove InputGraph::registerObserver.Rui Ueyama2015-01-132-49/+31
| | | | | | | | | | | | 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
* Convert other drivers to use WrapperNode.Rui Ueyama2015-01-1312-49/+48
| | | | llvm-svn: 225764
* PE/COFF: add support to import functions in ARM NTSaleem Abdulrasool2015-01-081-7/+46
| | | | | | | | | | 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
* PE/COFF: teach ARMNT backend about ADDR32NB for exportsSaleem Abdulrasool2015-01-072-0/+7
| | | | | | | | | 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
* PECOFF: adjust the entry point on ARM NTSaleem Abdulrasool2015-01-041-3/+9
| | | | | | | | | 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
* ReaderWriter: adjust ARM target addresses for execSaleem Abdulrasool2015-01-031-1/+8
| | | | | | | | | | | | 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
* ReaderWriter: teach the writer about IMAGE_REL_ARM_BRANCH24TSaleem Abdulrasool2015-01-021-1/+7
| | | | | | | | | | 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
* ReaderWriter: teach the writer about IMAGE_REL_ARM_BLX23TSaleem Abdulrasool2015-01-021-0/+20
| | | | | | | | | 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
* ReaderWriter: teach the writer about IMAGE_REL_ARM_MOV32TSaleem Abdulrasool2015-01-021-0/+17
| | | | | | | | | 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
* ReaderWriter: teach the writer about IMAGE_REL_ARM_ADDR32Saleem Abdulrasool2015-01-011-4/+25
| | | | | | | | 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
* ReaderWriter: teach PE/COFF backend about ARM NTSaleem Abdulrasool2014-12-312-0/+6
| | | | | | | | | 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
* [Mips] Replace stderr output by the `llvm_unreachable` callSimon Atanasyan2014-12-251-4/+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
* [Mips] Support linking of microMIPS 32-bit codeSimon Atanasyan2014-12-247-84/+530
| | | | | | | The change is rather large but mainly it just adds handling of new relocations, PLT entries etc. llvm-svn: 224826
* [Mips] Join two if statementsSimon Atanasyan2014-12-241-3/+1
| | | | | | No functional changes. llvm-svn: 224817
* [Mips] Make the comment more descriptiveSimon Atanasyan2014-12-241-1/+1
| | | | | | No functional changes. llvm-svn: 224816
* [Mips] Factor out the code checks a symbol's bindingSimon Atanasyan2014-12-241-5/+6
| | | | | | No functional changes. llvm-svn: 224815
* [Mips] Rename the function s/readAddend/getAddend/Simon Atanasyan2014-12-241-4/+4
| | | | | | No functional changes. llvm-svn: 224814
* [Mips] Use OR operation to set the microMIPS bitSimon Atanasyan2014-12-242-2/+2
| | | | llvm-svn: 224813
* [macho] Minor install_name fixesJean-Daniel Dupas2014-12-202-1/+5
| | | | | | | | | | | | | | | | | | | 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
* [macho] -rpath supportJean-Daniel Dupas2014-12-184-0/+31
| | | | | | | | | | | | | | | | | | | | | 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
* Remove dead code.Rui Ueyama2014-12-151-4/+0
| | | | | | This field was not even initialized properly. llvm-svn: 224236
* Protect doParse() because that's not a public interface.Rui Ueyama2014-12-155-13/+17
| | | | llvm-svn: 224235
* Clean up #include dependency.Rui Ueyama2014-12-142-0/+2
| | | | | | Core/File.h does not use LinkingContext.h, so remove that dependency. llvm-svn: 224214
* Make YAML files own MemoryBuffer.Rui Ueyama2014-12-131-5/+2
| | | | | | | YAML files have references such as StringRef to the underlying MemoryBuffer, so we shouldn't deallocate the buffer. llvm-svn: 224191
* Make File always take the ownership of a MemoryBuffer.Rui Ueyama2014-12-1210-51/+43
| | | | | | | | | | | | | | The documentation of parseFile() said that "the resulting File object may take ownership of the MemoryBuffer." So, whether or not the ownership of a MemoryBuffer would be taken was not clear. A FileNode (a subclass of InputElement, which is being deprecated) keeps the ownership if a File doesn't take it. This patch makes File always take the ownership of a buffer. Buffers lifespan is not always the same as File instances. Files are able to deallocate buffers after parsing the contents. llvm-svn: 224113
* Separate file parsing from File's constructors.Rui Ueyama2014-12-1218-368/+422
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a second patch for InputGraph cleanup. Sorry about the size of the patch, but what I did in this patch is basically moving code from constructor to a new method, parse(), so the amount of new code is small. This has no change in functionality. We've discussed the issue that we have too many classes to represent a concept of "file". We have File subclasses that represent files read from disk. In addition to that, we have bunch of InputElement subclasses (that are part of InputGraph) that represent command line arguments for input file names. InputElement is a wrapper for File. InputElement has parseFile method. The method instantiates a File. The File's constructor reads a file from disk and parses that. Because parseFile method is called from multiple worker threads, file parsing is processed in parallel. In other words, one reason why we needed the wrapper classes is because a File would start reading a file as soon as it is instantiated. So, the reason why we have too many classes here is at least partly because of the design flaw of File class. Just like threads in a good threading library, we need to separate instantiation from "start" method, so that we can instantiate File objects when we need them (which should be very fast because it involves only one mmap() and no real file IO) and use them directly instead of the wrapper classes. Later, we call parse() on each file in parallel to let them do actual file IO. In this design, we can eliminate a reason to have the wrapper classes. In order to minimize the size of the patch, I didn't go so far as to replace the wrapper classes with File classes. The wrapper classes are still there. In this patch, we call parse() immediately after instantiating a File, so this really has no change in functionality. Eventually the call of parse() should be moved to Driver::link(). That'll be done in another patch. llvm-svn: 224102
* [ELF] Remove isThumb().Shankar Easwaran2014-12-121-2/+0
| | | | llvm-svn: 224099
* [ELF] Remove duplicate constructor code.Rui Ueyama2014-12-116-182/+52
| | | | | | This piece of code was copied multiple times to each archs. llvm-svn: 224001
* [ELF] Allow target to adjust a symbol's value for using in a dynamic tagSimon Atanasyan2014-12-102-2/+20
| | | | | | | | | Some targets like microMIPS and ARM Thumb use the last bit of a symbol's value to mark 'compressed' code. This patch adds new virtual function `DynamicTable::getAtomVirtualAddress` which allows to adjust a symbol's value before using it in a dynamic table tags like DT_INIT / DT_FINI. llvm-svn: 223963
* Remove unreachable return statement.Rui Ueyama2014-12-101-1/+0
| | | | llvm-svn: 223920
* [ELF] Make -init/-fini options compatible with the gnu linkerSimon Atanasyan2014-12-108-281/+29
| | | | | | | | | | | | | | The LLD linker searches initializer and finalizer function names and emits DT_INIT/DT_FINI dynamic table tags to point to these symbols. The -init/-fini command line options override initializer ("_init") and finalizer ("_fini") function names used by default. Now the -init/-fini options do not affect .init_array/.fini_array sections. The corresponding code has been removed. Differential Revision: http://reviews.llvm.org/D6578 llvm-svn: 223917
* Re-commit r223330: Rewrite InputGraph's GroupRui Ueyama2014-12-102-1/+50
| | | | llvm-svn: 223867
* Fix Darwin linker. Patch from Jean-Daniel Dupas.Rui Ueyama2014-12-101-1/+1
| | | | llvm-svn: 223865
* Fix the MSVC buildHans Wennborg2014-12-092-2/+4
| | | | llvm-svn: 223796
OpenPOWER on IntegriCloud