summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[PECOFF] Fix atom ordinals."Rui Ueyama2013-12-022-12/+12
| | | | | | | This reverts commit r195852 because LLD seems to create broken executables with that patch when compiled with MSVC 2013. llvm-svn: 196078
* Fix "doesnot", "endsup" typos and "lets" grammar issuesAlp Toker2013-12-027-16/+16
| | | | llvm-svn: 196056
* Fix "don't" typos missed in previous commitAlp Toker2013-12-015-11/+11
| | | | llvm-svn: 196054
* Fix a variety of typos in function names and commentsAlp Toker2013-12-019-18/+18
| | | | | | No change in functionality. llvm-svn: 196053
* [PECOFF] Fix /debug option.Rui Ueyama2013-12-011-3/+0
| | | | | | | /DEBUG option is to make the linker to emit debug information to the resulting executable. It's not for enable debugging of the linker itself. llvm-svn: 196040
* [PECOFF] Set section characteristics based /section options.Rui Ueyama2013-11-271-31/+40
| | | | | | | | This is a patch to let the PECOFF writer to use the information passed by the parser for /section option. The implementation of /section should now be complete. llvm-svn: 195893
* [PECOFF] Improve /merge option handling.Rui Ueyama2013-11-272-2/+30
| | | | | | | | | | | | | | | | | /MERGE option is a bit complicated for many reasons. Firstly, it takes both positive and negative arguments. That means we have to have one of three distinctive values (set, clear or unchange) for each permission bit. In this patch we represent the three values using two bitmasks. Secondly, the permissions specified by the parameter is bitwise or-ed with the default permissions of a section. There is an exception for that rule; if one of READ, WRITE or EXECUTE bit is specified, unspecified bits need to be cleared. (So if you specify only WRITE for example, the resulting section will not have WRITE nor EXECUTE bits.) Lastly, multiple /merge options are allowed. llvm-svn: 195882
* [PECOFF] Implement /merge option.Rui Ueyama2013-11-271-5/+7
| | | | | | | /MERGE:foo=bar command line option merges section foo to section bar. If section bar does not exist, foo is just renamed as bar. llvm-svn: 195856
* [PECOFF] Rename getFinalSectionName -> getOutputSectionName.Rui Ueyama2013-11-271-2/+2
| | | | llvm-svn: 195855
* [PECOFF] Fix atom ordinals.Rui Ueyama2013-11-272-12/+12
| | | | | | | Atom ordinals are the indeces in a file. Currently the PECOFF reader assigns ordinals for each section, so it's (incorrectly) assigning duplicate ordinals. llvm-svn: 195852
* Print a bit more information before aborting.Rui Ueyama2013-11-271-1/+2
| | | | llvm-svn: 195801
* [PECOFF] Add a generic section writer.Rui Ueyama2013-11-271-135/+142
| | | | | | | | | | | | | | | | Instead of having multiple SectionChunks for each section (.text, .data, .rdata and .bss), we could have one chunk writer that can emit any sections. This patch does that -- removing all section-sepcific chunk writers and replace them with one "generic" writer. This change should simplify the code because it eliminates similar-but- slightly-different classes. It also fixes an issue in the previous design. Before this patch, we could emit only limited set of sections (i.e. .text, .data, .rdata and .bss). With this patch, we can emit any sections. llvm-svn: 195797
* Revert "WriterPECOFF"Rui Ueyama2013-11-271-142/+135
| | | | | | This reverts accidental commit r195794. llvm-svn: 195795
* WriterPECOFFRui Ueyama2013-11-271-135/+142
| | | | llvm-svn: 195794
* [PECOFF] Fix parameter mapping for /section.Rui Ueyama2013-11-261-6/+6
| | | | | | | The current mapping for /section one character options is really bogus. Map to the correct flags. llvm-svn: 195774
* [PECOFF] Skip sections with LNK_INFO.Rui Ueyama2013-11-251-2/+3
| | | | | | | | According to the PE/COFF spec, a section with IMAGE_SCN_LNK_INFO should only appear in an object file, and not allowed in an executable. So I believe treating it as the same way as IMAGE_SCN_LNK_INFO is the right thing. llvm-svn: 195692
* [PECOFF] String pointed by StringRef is not always NUL-terminated.Rui Ueyama2013-11-251-1/+2
| | | | | | | In order not to overrun a StringRef and copy the trailing garbage, we need to set the maximum length to be copied by strncpy. llvm-svn: 195688
* Early return.Rui Ueyama2013-11-251-2/+4
| | | | llvm-svn: 195663
* Use range-based for loop.Rui Ueyama2013-11-251-3/+2
| | | | llvm-svn: 195662
* Indentation.Rui Ueyama2013-11-251-21/+21
| | | | llvm-svn: 195661
* [PECOFF] Move definitions to IdataPass.cpp.Rui Ueyama2013-11-253-219/+278
| | | | llvm-svn: 195618
* [PECOFF] Set ordinals to linker internal atoms.Rui Ueyama2013-11-254-21/+36
| | | | | | | | | This patch won't change the output because the layout of linker internal atoms is forced by layout-{before,after} references. Ordinals of the linker internal atoms are not currently used. (That's why it's working even if there are atoms having the same ordinals.) llvm-svn: 195610
* [Gnu] Set the defaults in the ELFLinkingContext.Shankar Easwaran2013-11-252-7/+1
| | | | | | Comment from Rui Ueyema. llvm-svn: 195598
* [Gnu] Ignore unknown arguments, and print message.Shankar Easwaran2013-11-251-0/+7
| | | | llvm-svn: 195597
* [Gnu] Set the type of binary that lld would generate.Shankar Easwaran2013-11-251-27/+42
| | | | | | This is needed before any of the search paths are searched for. llvm-svn: 195596
* [PECOFF] Change sectionChoice attribute.Rui Ueyama2013-11-253-5/+6
| | | | | | | | | | | | | Change the attribute from sectionBasedOnContent to sectionCustomRequired because its the right attribute for atoms read from COFF files to have. COFF atoms should basically be emitted to the section having the same name as input. Permissions/attributes should not affect that. There's no functionality change because the writer doesn't yet use the section name. The writer will be modified in a following patch, so that atoms are written to its customSectionName()'s section. llvm-svn: 195595
* [Gnu] -L paths is not positional.Shankar Easwaran2013-11-253-21/+22
| | | | | | | Looks like -L paths are not positional. They need to be added to a list of search paths and those needs to be searched when lld looks for a library. llvm-svn: 195594
* Fix MSVC buildbot.Rui Ueyama2013-11-251-6/+4
| | | | llvm-svn: 195593
* [PECOFF] Infer subsystem from the entry point function.Rui Ueyama2013-11-252-0/+58
| | | | | | | | If /subsystem option is not specified, the linker needs to infer it from the entry point function. If "main" or "wmain" is defined, it's a console application. If "WinMain" or "wWinMain" is defined, it's a GUI application. llvm-svn: 195592
* [InputGraph][Gnu] Add LinkerScript support.Shankar Easwaran2013-11-247-109/+141
| | | | | | | | | | | | | | | | This adds LinkerScript support by creating a type Script which is of type FileNode in the InputGraph. Once the LinkerScript Parser converts the LinkerScript into a sequence of command, the commands are handled by the equivalent LinkerScript node for the current Flavor/Target. For ELF, a ELFGNULdScript gets created which converts the commands to ELF nodes and ELF control nodes(ELFGroup for handling Group nodes). Since the Inputfile type has to be determined in the Driver, the Driver needs to determine the complete path of the file that needs to be processed by the Linker. Due to this, few tests have been removed since the Driver uses paths that doesnot exist. llvm-svn: 195583
* [Gnu] Move code from .h to .cpp.Shankar Easwaran2013-11-242-0/+62
| | | | | | No change in functionality. llvm-svn: 195582
* [InputGraph] Add capability to process Hidden nodes.Shankar Easwaran2013-11-222-1/+8
| | | | | | | | | | Hidden nodes could be a result of expansion, where a flavor might decide to keep the node that we want to expand but discard it from being processed by the resolver. Verifies with unittests. llvm-svn: 195516
* [InputGraph] Expand InputGraph nodes.Shankar Easwaran2013-11-221-0/+32
| | | | | | | | | | | Flavors may like to expand InputGraph nodes, when a filenode after parsing results in more elements. One such example is while parsing GNU linker scripts. The linker scripts after parsing would result in a lot of filenodes and probably controlnodes too. Adds unittests to verify functionality. llvm-svn: 195515
* [PECOFF] Do not set the entry address if /noentry option is given.Rui Ueyama2013-11-222-1/+9
| | | | | | | This is the first step towards DLL creation support. Resource-only DLLs don't have entry point address. llvm-svn: 195510
* Fix file header comment.Rui Ueyama2013-11-211-1/+1
| | | | llvm-svn: 195393
* Fix indentation and whitespace.Rui Ueyama2013-11-211-57/+49
| | | | llvm-svn: 195389
* [LinkingContext] Limit shared library undefined atoms to be added.Shankar Easwaran2013-11-211-11/+16
| | | | | | | | | | | | This adds functionality to limit shared library undefined atoms to be added only once by the Resolver. Dynamic libraries may be processed more than once if they exist within a Group. Also adds a test to verify the change. llvm-svn: 195307
* [PECOFF] Move files with ".lib" extension to the end of the input file list.Rui Ueyama2013-11-211-2/+15
| | | | | | | | | It's allowed to specify library files *before* object files in the command line. Object files seems to be processed first, and then their undefined symbols are resolved from the libraries. This patch implements the compatible behavior. llvm-svn: 195295
* [PECOFF] Do not check if library is already added.Rui Ueyama2013-11-211-7/+3
| | | | llvm-svn: 195289
* Rename allocateString -> allocate.Rui Ueyama2013-11-213-16/+16
| | | | llvm-svn: 195284
* Reverse the condition for readability.Rui Ueyama2013-11-201-3/+3
| | | | llvm-svn: 195282
* Move member functions to its own cpp file.Rui Ueyama2013-11-203-14/+69
| | | | llvm-svn: 195281
* [PECOFF] Recognize but ignore /implib and /safeseh for now.Rui Ueyama2013-11-201-0/+2
| | | | | | | So that the LLD won't print error message saying that it couldn't find /implib or /safeseh files. llvm-svn: 195276
* Use NativeReferenceIvarsV2 if necessary.Rui Ueyama2013-11-203-69/+193
| | | | | | | | | | | | | | | | | | | | NativeReferenceIvarsV1 cannot handle more than 65535 relocation targets because its field to point to the target table is of type uint16_t. Because of that limitation, the LLD couldn't link a file containing more than 65535 relocations. 65535 is not a big number - the LLD couldn't even link itself with V1. This patch solves the issue by adding NativeReferenceIvarsV2 support. The new structure has more bits for the target table, so it can handle a large number of relocatinos. V2 structure is larger than V1. In order to prevent file bloating, V2 format is used only when the resulting file cannot be represented in V1 format. The writer and the reader support both V1 and V2 formats. Differential Revision: http://llvm-reviews.chandlerc.com/D2217 llvm-svn: 195270
* Fix Weak External symbol handling.Rui Ueyama2013-11-201-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | The fallback atom was used only when it's searching for a symbol in a library; if an undefined symbol was not found in a library, the LLD looked for its fallback symbol in the library. Although it worked in most cases, because symbols with fallbacks usually occur only in OLDNAMES.LIB (a standard library), that behavior was incompatible with link.exe. This patch fixes the issue so that the semantics is the same as MSVC's link.exe The new (and correct, I believe) behavior is this: - If there's no definition for an undefined atom, replace the undefined atom with its fallback and then proceed (e.g. look in the next file or stop linking as usual.) Weak External symbols are underspecified in the Microsoft PE/COFF spec. However, as long as I observed the behavior of link.exe, this seems to be what we want for compatibility. Differential Revision: http://llvm-reviews.chandlerc.com/D2162 llvm-svn: 195269
* Do not inline large member functions. No functionality change.Rui Ueyama2013-11-191-720/+768
| | | | llvm-svn: 195169
* Do not inline large member functions.Rui Ueyama2013-11-191-494/+553
| | | | | | | This should improve code readability as the class definitions are now more readable than before. llvm-svn: 195159
* [PECOFF] Now that identify_magic() recognizes COFF import library.Rui Ueyama2013-11-191-6/+1
| | | | | | No need to do that in ReaderCOFF.cpp. llvm-svn: 195109
* Remove meaningless "explicit" keywords.Rui Ueyama2013-11-191-2/+2
| | | | llvm-svn: 195108
* Remove extraneous curly braces and blank lines.Rui Ueyama2013-11-192-6/+1
| | | | llvm-svn: 195107
OpenPOWER on IntegriCloud