summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify.Rui Ueyama2015-01-153-14/+7
| | | | llvm-svn: 226225
* [ELF] Do not error on non-existent file in the driver.Rui Ueyama2015-01-151-2/+4
| | | | | | | 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
* Remove InputGraph and use std::vector<Node> instead.Rui Ueyama2015-01-155-45/+29
| | | | | | In total we have removed more than 1000 lines! llvm-svn: 226149
* Rename InputElement Node.Rui Ueyama2015-01-154-6/+6
| | | | | | | | | 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-155-12/+12
| | | | | | | | 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-155-13/+8
| | | | | | | WrapperNode was a useless subclass of FileNode. We should just use FileNode instead. llvm-svn: 226145
* Remove FileNode::parse.Rui Ueyama2015-01-151-10/+10
| | | | | | | FileNode::parse was just a forwarder to File::parse so we could remove that. Also removed dead code. llvm-svn: 226144
* Remove FileNode::getPath().Rui Ueyama2015-01-151-1/+1
| | | | | | | Previously both FileNode and File keep filename. This patch removed that redundancy. llvm-svn: 226143
* Remove InputGraph::size().Rui Ueyama2015-01-155-6/+6
| | | | llvm-svn: 226140
* Simplify FileNode.Rui Ueyama2015-01-151-3/+5
| | | | | | | | 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
* Merge SimpleFileNode with WrapperNode.Rui Ueyama2015-01-151-3/+4
| | | | llvm-svn: 226137
* [PECOFF] Remove an InputElement placeholder for the entry name.Rui Ueyama2015-01-151-5/+0
| | | | llvm-svn: 226133
* Re-commit r225766, r225767, r225769, r225814, r225816, r225829, and r225832.Rui Ueyama2015-01-153-4/+2
| | | | | | | 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
* Attempt to fix a Linux buildbot.Rui Ueyama2015-01-151-1/+1
| | | | llvm-svn: 226127
* Re-commit r225674: Convert other drivers to use WrapperNode.Rui Ueyama2015-01-159-309/+203
| | | | | | | | 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
* Revert "Convert other drivers to use WrapperNode" and subsequent commits.Rui Ueyama2015-01-149-202/+313
| | | | | | | r225764 broke a basic functionality on Mac OS. This change reverts r225764, r225766, r225767, r225769, r225814, r225816, r225829, and r225832. llvm-svn: 225859
* Remove dead code.Rui Ueyama2015-01-131-1/+0
| | | | | | | Now every InputElement has exactly one File in it, so "expand" method is now no-op. llvm-svn: 225769
* Remove InputGraph::registerObserver.Rui Ueyama2015-01-131-0/+1
| | | | | | | | | | | | 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
* Remove InputGraph::dump().Rui Ueyama2015-01-131-3/+0
| | | | | | This is dead code. llvm-svn: 225766
* Convert other drivers to use WrapperNode.Rui Ueyama2015-01-139-309/+201
| | | | llvm-svn: 225764
* Update comment.Rui Ueyama2015-01-121-2/+2
| | | | llvm-svn: 225645
* [ELF] Remove {ELF,}GNULinkerScript.Rui Ueyama2015-01-072-73/+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
* Convert CoreInputGraph.Rui Ueyama2015-01-062-7/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [macho] -rpath supportJean-Daniel Dupas2014-12-182-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
* Replace ReaderError with DynamicError.Rui Ueyama2014-12-151-2/+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
* Remove PECOFFLibraryNode.Rui Ueyama2014-12-141-2/+2
| | | | | | This class is empty, provides no additional feature to the base class. llvm-svn: 224212
* More WinLinkInputGraph cleanup.Rui Ueyama2014-12-142-10/+10
| | | | | | | This function is called only from WinLinkDriver.cpp. Move the function to that file and mark as static. llvm-svn: 224211
* [PECOFF] Resolve file name in the driver, not in InputElement.Rui Ueyama2014-12-142-17/+24
| | | | llvm-svn: 224209
* Remove code duplication.Rui Ueyama2014-12-141-6/+0
| | | | llvm-svn: 224206
* [ELF] Clean up OPT_INPUT handler. NFC.Rui Ueyama2014-12-131-33/+31
| | | | llvm-svn: 224192
* Move definitions to the correct file.Rui Ueyama2014-12-132-15/+16
| | | | llvm-svn: 224190
* Make File always take the ownership of a MemoryBuffer.Rui Ueyama2014-12-123-15/+25
| | | | | | | | | | | | | | 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
* [ELF] Make -init/-fini options compatible with the gnu linkerSimon Atanasyan2014-12-101-2/+2
| | | | | | | | | | | | | | 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-106-78/+38
| | | | llvm-svn: 223867
* Revert "Rewrite InputGraph's Group"Rui Ueyama2014-12-046-38/+78
| | | | | | | | This reverts commit r223330 because it broke Darwin and ELF linkers in a way that we couldn't have caught with the existing test cases. llvm-svn: 223373
* Rewrite InputGraph's GroupRui Ueyama2014-12-046-78/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aim of this patch is to reduce the excessive abstraction from the InputGraph. We found that even a simple thing, such as sorting input files (Mach-O) or adding a new file to the input file list (PE/COFF), is nearly impossible with the InputGraph abstraction, because it hides too much information behind it. As a result, we invented complex interactions between components (e.g. notifyProgress() mechanism) and tricky code to work around that limitation. There were many occasions that we needed to write awkward code. This patch is a first step to make it cleaner. As a first step, this removes Group class from the InputGraph. The grouping feature is now directly handled by the Resolver. notifyProgress is removed since we no longer need that. I could have cleaned it up even more, but in order to keep the patch minimum, I focused on Group. SimpleFileNode class, a container of File objects, is now limited to have only one File. We shold have done this earlier. We used to allow putting multiple File objects to FileNode. Although SimpleFileNode usually has only one file, the Driver class actually used that capability. I modified the Driver class a bit, so that one FileNode is created for each input File. We should now probably remove SimpleFileNode and directly store File objects to the InputGraph in some way, because a container that can contain only one object is useless. This is a TODO. Mach-O input files are now sorted before they are passe to the Resolver. DarwinInputGraph class is no longer needed, so removed. PECOFF still has hacky code to add a new file to the input file list. This will be cleaned up in another patch. llvm-svn: 223330
* [Core] Add flag to check if RoundTripPasses need to be run.Shankar Easwaran2014-12-011-3/+1
| | | | | | | | | | | | | | This would allow other flavor specific contexts to override the default value, if they want to optionally run the round trip passes. There is some information lost like the original file owner of the atom with RoundTripPasses. The Gnu flavor needs this information inorder to implement LinkerScript matching and for other diagnostic outputs such as Map files. The flag also can be used to record information in the Atom if the information to the Writer needs to be conveyed through References too. llvm-svn: 222983
* [PECOFF] Ignore /maxilkfile option.Rui Ueyama2014-11-251-0/+1
| | | | | | | | | | .ilk file is a file for incremental linking. We don't create nor use that file. /MAXILKFILE is an undocumented option to specify the maximum size of the .ilk file, IIUC. We should just ignore the option. llvm-svn: 222777
* [PECOFF] Create an empty PDB file if debug option is enabled.Rui Ueyama2014-11-252-1/+6
| | | | | | | | | | | | | | | | There are many build files in the wild that depend on the fact that link.exe produces a PDB file if /DEBUG option is given. They fail if the file is not created. This patch is to make LLD create an empty (dummy) file to satisfy such build targets. This doesn't do anything other than "touching" the file. If a target depends on the content of the PDB file, this workaround is no help, of course. Otherwise this patch should help build some stuff. llvm-svn: 222773
* [PECOFF] Enable dead-stripping even if /debug option is given.Rui Ueyama2014-11-201-2/+3
| | | | | | | | | | | | | | | | | | /debug makes MSVC link.exe to not remove unused sections from the resulting executable. We did the same thing before. However, I realized that the removal of associative section depends on the dead-stripping pass in LLD, so we cannot disable that. Or LLD may produce slightly broken executables that have too much data in it (which could result in nasty subtle bugs). This patch is a temporary measure to create correct executable. Currently /debug does not have any real effect for LLD anyway. I'll improve associative section handling in another patch, so that they are removed from output without depending on the dead-stripping pass. llvm-svn: 222483
* [ELF] Fix conditions for max-page-size.Shankar Easwaran2014-11-131-1/+1
| | | | | | Fix comments from Rui, also adds a test. llvm-svn: 221860
* [ELF] Fix max-page-size option.Shankar Easwaran2014-11-131-2/+1
| | | | | | | | | | The user can use the max-page-size option and set the maximum page size. Dont check for maximum allowed values for page size, as its what the kernel is configured with. Fix the test as well. llvm-svn: 221858
* [Gnu][Driver] Use StringRef conversion functionsShankar Easwaran2014-11-111-13/+7
| | | | llvm-svn: 221648
* [Gnu] Support --image-base optionShankar Easwaran2014-11-102-0/+16
| | | | | | The value for --image-base is used as the base address of the program. llvm-svn: 221589
* [Gnu] Add options that are ignoredShankar Easwaran2014-11-101-0/+15
| | | | | | Add options that are ignored and exists just for compatibility reasons. llvm-svn: 221585
* [ELF] Support -z max-page-size optionShankar Easwaran2014-11-101-1/+36
| | | | | | | The GNU linker allows the user to change the page size by using the option -z max-page-size. llvm-svn: 221584
* [ELF] Support --no-align-segments.Shankar Easwaran2014-11-082-0/+7
| | | | | | | | | | | | | lld generates an ELF by adhering to the ELF spec by aligning vma/fileoffset to a page boundary, but this becomes an issue when dealing with large pages. This adds support so that lld generated executables adheres to the ELF spec with the rule vma % p_align = offset % p_align. This is supported by the flag --no-align-segments. This could be the default in few targets like X86_64 to save space on disk. llvm-svn: 221571
* [mach-o] Fix MachOFileNode to own archives same as ELFFileNodeNick Kledzik2014-11-071-1/+4
| | | | | | | | | My previous fix to have FileArchive own the member MemoryBuffers was not a complete solution for darwin because nothing owned the FileArchive object. Fixed MachOFileNode to be like ELFFileNode and have the graph node own the archive object. llvm-svn: 221552
* [mach-o] Add support for -order_file optionNick Kledzik2014-11-072-0/+69
| | | | | | | | | | | The darwin linker lets you rearrange functions and data for better locality (less paging). You do this with the -order_file option which supplies a text file containing one symbol per line. Implementing this required a small change to LayoutPass to add a custom sorter hook. llvm-svn: 221545
* remove unneeded { }Nick Kledzik2014-11-061-2/+1
| | | | llvm-svn: 221478
OpenPOWER on IntegriCloud