summaryrefslogtreecommitdiffstats
path: root/lld/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [PECOFF] Simplify: Replace two-value enum with bool.Rui Ueyama2014-01-061-2/+2
| | | | llvm-svn: 198634
* [MachO] Begin to add some MachO specific File/Atoms, and add the start ofJoey Gouly2014-01-032-0/+62
| | | | | | normalizedToAtoms. llvm-svn: 198459
* Use scoped enum.Rui Ueyama2014-01-031-2/+2
| | | | llvm-svn: 198396
* temporary commitRui Ueyama2013-12-281-1/+1
| | | | llvm-svn: 198103
* [PECOFF] Use std::set to store export symbol descriptors.Rui Ueyama2013-12-281-17/+22
| | | | | | | Each export symbol descriptor has unique name attribute, so std::set is better container than std::vector for it. No functionality change. llvm-svn: 198102
* Use EXPECT_EQ in unit tests.Rui Ueyama2013-12-251-2/+2
| | | | llvm-svn: 197999
* [PECOFF] Use the first definition of an export if specified multiple times.Rui Ueyama2013-12-251-1/+11
| | | | | | | If the same symbol is specified multiple times as arguments of /export, the first definition should be used. llvm-svn: 197998
* [PECOFF] Fix /export option in the .drectve section.Rui Ueyama2013-12-241-3/+3
| | | | | | | /EXPORT option has slightly different semantics if it appears in the .drectve section. This patch implements it. llvm-svn: 197970
* [PECOFF] Assign default export ordinals in LinkingContext::verify().Rui Ueyama2013-12-201-1/+1
| | | | | | | | | | | | | | | Default ordinals were assigned in EdataPass, and the assigned values were then discarded in the pass. No code other than EdataPass would not be able to get all of the information about ordinals. That's not ideal since I'm writing code to emit an Import Library file, which also needs ordinals. This is a patch to move the code to assign default ordinals from EdataPass to LinkingContext::verify(), so that assigned ordinals will be available anywhere. No functionality change. llvm-svn: 197797
* Run clang-format on r197727.Rui Ueyama2013-12-201-2/+1
| | | | llvm-svn: 197788
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main changes are in: include/lld/Core/Reference.h include/lld/ReaderWriter/Reader.h Everything else is details to support the main change. 1) Registration based Readers Previously, lld had a tangled interdependency with all the Readers. It would have been impossible to make a streamlined linker (say for a JIT) which just supported one file format and one architecture (no yaml, no archives, etc). The old model also required a LinkingContext to read an object file, which would have made .o inspection tools awkward. The new model is that there is a global Registry object. You programmatically register the Readers you want with the registry object. Whenever you need to read/parse a file, you ask the registry to do it, and the registry tries each registered reader. For ease of use with the existing lld code base, there is one Registry object inside the LinkingContext object. 2) Changing kind value to be a tuple Beside Readers, the registry also keeps track of the mapping for Reference Kind values to and from strings. Along with that, this patch also fixes an ambiguity with the previous Reference::Kind values. The problem was that we wanted to reuse existing relocation type values as Reference::Kind values. But then how can the YAML write know how to convert a value to a string? The fix is to change the 32-bit Reference::Kind into a tuple with an 8-bit namespace (e.g. ELF, COFFF, etc), an 8-bit architecture (e.g. x86_64, PowerPC, etc), and a 16-bit value. This tuple system allows conversion to and from strings with no ambiguities. llvm-svn: 197727
* [PECOFF] Add a check for duplicate export ordinals.Rui Ueyama2013-12-161-0/+5
| | | | llvm-svn: 197373
* [PECOFF] Export ordinal must be in the range 1 through 65535.Rui Ueyama2013-12-161-0/+8
| | | | llvm-svn: 197365
* [PECOFF] Parse /export optional arguments.Rui Ueyama2013-12-131-4/+24
| | | | | | | /EXPORT command line option can take an ordinal, NONAME flag, and DATA flag. This patch is to parse these optional arguments. llvm-svn: 197217
* [PECOFF] Parse /dll command line option.Rui Ueyama2013-12-121-0/+3
| | | | llvm-svn: 197123
* [PECOFF] Add /dllexport option.Rui Ueyama2013-12-121-0/+7
| | | | | | | | | | /DLLEXPORT is a command line option to export a symbol. __declspec(dllexport) uses that to make the linker to export DLLExport'ed functions, by adding the option to .drectve section. This patch implements the parser of the command line option. llvm-svn: 197122
* [PECOFF] Add /alternatename option parser.Rui Ueyama2013-12-091-0/+6
| | | | | | | | | | | | | | /ALTERNATENAME is a rarely-used, undocumented command line option that is needed to link LLD for release build. It seems that the option is for defining an weak alias; /alternatename:foo=bar defines weak symbol "foo" for "bar". If "foo" is defined in an input file, it'll be linked normally and the command line option will have no effect. If it's not defined, "foo" will be handled as an alias for "bar". This patch implements the parser for the option. The actual weak alias handling will be implemented in a separate patch. llvm-svn: 196743
* [PECOFF] Handle .lib files as if they are grouped by --{start,end}-group.Rui Ueyama2013-12-052-18/+28
| | | | | | | | | | | | | | Currently we do not de-duplicate library files specified by /defaultlib option. As a result, the same files are added multiple times to the input graph. In particular, some popular files, such as kernel32.lib or oldnames.lib, are added more than 10 times during linking of LLD. That makes the linker slower, as it needs to parse the same file again and again. This patch solves the issue by de-duplicating. The same file will be added only once to the input graph. This patch improved the LLD linking time from 10.5 seconds to 7.7 seconds on my 4-core Core i7 Macbook Pro. llvm-svn: 196504
* [PECOFF] Ignore /functionpadmin option.Rui Ueyama2013-12-041-1/+1
| | | | | | | | | If /functionpadmin is specified, the linker is supposed to make room at the beginning of each function, so that self-modifying program would easily hotpatch existing functions. Since I'm not sure if this feature is really used, I'll make LLD to ignore the option for now. llvm-svn: 196363
* [PECOFF] Fix /debug option.Rui Ueyama2013-12-011-1/+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] Improve /merge option handling.Rui Ueyama2013-11-271-30/+28
| | | | | | | | | | | | | | | | | /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
* Refactor tests by using short identifiers.Rui Ueyama2013-11-271-22/+21
| | | | | | | This patch is to improve the readability of the tests before making a change to /merge option. llvm-svn: 195863
* [PECOFF] Rename getFinalSectionName -> getOutputSectionName.Rui Ueyama2013-11-271-3/+3
| | | | llvm-svn: 195855
* [PECOFF] Fix parameter mapping for /section.Rui Ueyama2013-11-261-23/+45
| | | | | | | The current mapping for /section one character options is really bogus. Map to the correct flags. llvm-svn: 195774
* [InputGraph][Gnu] Add LinkerScript support.Shankar Easwaran2013-11-241-20/+0
| | | | | | | | | | | | | | | | 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
* [InputGraph] Add capability to process Hidden nodes.Shankar Easwaran2013-11-221-2/+82
| | | | | | | | | | 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/+188
| | | | | | | | | | | 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-221-0/+15
| | | | | | | This is the first step towards DLL creation support. Resource-only DLLs don't have entry point address. llvm-svn: 195510
* [test] Add InputGraph testsShankar Easwaran2013-11-212-0/+366
| | | | llvm-svn: 195388
* [PECOFF] Move files with ".lib" extension to the end of the input file list.Rui Ueyama2013-11-211-0/+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-1/+2
| | | | llvm-svn: 195289
* [PECOFF] Recognize but ignore /implib and /safeseh for now.Rui Ueyama2013-11-201-1/+2
| | | | | | | So that the LLD won't print error message saying that it couldn't find /implib or /safeseh files. llvm-svn: 195276
* [PECOFF] Ignore /tlbid, /tlbout, /idlout and /ignoreigl for now.Rui Ueyama2013-11-191-1/+2
| | | | llvm-svn: 195105
* [mach-o] revert gunk added to test cases to debug build bot failuresNick Kledzik2013-11-081-18/+0
| | | | llvm-svn: 194292
* [mach-o] fix memory ownership in test caseNick Kledzik2013-11-071-14/+28
| | | | llvm-svn: 194187
* add debug logging to help figure out why some tests fail on some build botsNick Kledzik2013-11-071-0/+18
| | | | llvm-svn: 194186
* [mach-o] fix EXPECT_EQ typesNick Kledzik2013-11-062-12/+12
| | | | llvm-svn: 194173
* [mach-o] binary reader and writer Nick Kledzik2013-11-063-0/+1401
| | | | | | | | | | This patch adds support for converting normalized mach-o to and from binary mach-o. It also changes WriterMachO (which previously directly wrote a mach-o binary given a set of Atoms) to instead do it in two steps. The first step uses normalizedFromAtoms() to convert Atoms to normalized mach-o, and the second step uses writeBinary() which to generate the mach-o binary file. llvm-svn: 194167
* [PECOFF] Rename getSectionAlignment -> getSectionDefaultAlignment.Rui Ueyama2013-11-061-2/+2
| | | | | | | | These fields are for /align option. Section alignment can be set per-section basis with /section option too. In order to avoid name conflicts, rename the existing identifiers to become more specific. No functionality change. llvm-svn: 194160
* [PECOFF] Add /section option.Rui Ueyama2013-11-061-0/+32
| | | | | | | | | | | /section command line option is to set/reset attributes of the Characteristics field in the section header. You can set non-default values with this option. You can make .data section executable with this, for example. This patch implements the parser of the command line option. The code to use the parsed values will be committed in a separate patch. llvm-svn: 194133
* [PECOFF] Make /disallowlib an alias for /nodefaultlib.Rui Ueyama2013-11-061-0/+9
| | | | | | | I'm not sure if it is really an alias for /nodefaultlib, but I can say that they are at least similar. Making it an alias would be better than ignoring it. llvm-svn: 194131
* [PECOFF] Do not add the same library to the input graph more than once.Rui Ueyama2013-11-061-0/+8
| | | | | | | | /defaultlib options can be specified implicitly via the .drectve section, and it's pretty common that multiple object files add the same library, such as user32.lib, to the input. We shouldn't add the same library multiple times. llvm-svn: 194129
* [PECOFF] Ignore /disallowlib.Rui Ueyama2013-11-061-3/+3
| | | | | | | | msvcrt.lib contains "/disallowlib" command line option in its .drectve section. I couldn't spot any documentation for the option. Ignore it for now so that we can link the library without error. llvm-svn: 194114
* [PECOFF] Parse /merge command line option.Rui Ueyama2013-10-261-0/+13
| | | | | | | | /merge:<from>=<to> option makes the linker to combine "from" section to "to" section. This patch is to parse the option. The actual feature will be implemented in a subsequent patch. llvm-svn: 193454
* [PECOFF] Add /manifestdependency command line option.Rui Ueyama2013-10-221-1/+8
| | | | llvm-svn: 193201
* [PECOFF] Add /manifestfile command line option.Rui Ueyama2013-10-221-1/+8
| | | | | | | | /manifestfile:<path> specifies an alternative manifest file output path. Default is "<output-path>.manifest" where <output-path> is the executable's path. llvm-svn: 193195
* [PECOFF] Fix /manifestuac handling.Rui Ueyama2013-10-221-9/+9
| | | | | | uiAccess argument's type is not really boolean. It's string. llvm-svn: 193171
* [PECOFF] Add /manifestuac command line option.Rui Ueyama2013-10-221-1/+22
| | | | | | This option is used for the manifest file too. llvm-svn: 193145
* [PECOFF] Parse /manifest command line option.Rui Ueyama2013-10-221-0/+40
| | | | | | | | | | The manifest file is an XML file that conveys some information to the loader, such as whether the executable needs to run as Administrator or not. This patch is to parse command line option for manifest file. Actual XML file generation will be done in a separate patch. llvm-svn: 193141
* Make undefines check into an assertion.Rui Ueyama2013-10-161-2/+0
| | | | | | | | | Dead-strip root symbols can be undefined atoms, but should not really be nonexistent, because dead-strip root symbols should be added to initial undefined atoms at startup. Whenever you look up its name in the symbol table, some type of atom will always exist. llvm-svn: 192831
OpenPOWER on IntegriCloud