summaryrefslogtreecommitdiffstats
path: root/lld/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [PECOFF] Ignore /ignore option.Rui Ueyama2014-04-181-2/+2
| | | | | | | | /ignore:<number> is a linker option to disable warning specified by the number. We ignore the option because it does not make sense for LLD. llvm-svn: 206636
* [PECOFF] Support /manifestuac:NO.Rui Ueyama2014-04-181-0/+6
| | | | | | | If the value for /manifestuac is "NO", LLD will create a manifest XM file but won't emit <trustinfo> element. llvm-svn: 206633
* [ELF] Support --defsym=<symbol>=<symbol>.Rui Ueyama2014-04-161-5/+8
| | | | | | | | | | | | | | | | | | | | | Currently LLD supports --defsym only in the form of --defsym=<symbol>=<integer>, where the integer is interpreted as the absolute address of the symbol. This patch extends it to allow other symbol name to be given as an RHS value. If a RHS value is a symbol name, the LHS symbol will be defined as an alias for the RHS symbol. Internally, a LHS symbol is represented as a zero-size defined atom who has an LayoutAfter reference to an undefined atom, whose name is the RHS value. Everything else is already implemented -- Resolver will resolve the undefined symbol, and the layout pass will layout the two atoms at the same location. Looks like it's working fine. Note that GNU LD supports --defsym=<symbol>=<symbol>+<addend>. That feature is out of scope of this patch. Differential Revision: http://reviews.llvm.org/D3332 llvm-svn: 206417
* [ELF] Unit tests for -o and --noinhibit-exec.Rui Ueyama2014-04-071-0/+16
| | | | llvm-svn: 205735
* [ELF] Accept "-rpath=<foo>" as well as "-rpath <foo>".Rui Ueyama2014-04-061-0/+7
| | | | llvm-svn: 205694
* [ELF] Fix driver bug.Rui Ueyama2014-04-061-0/+37
| | | | | | | | GNU LD-comptaible driver wrongly requires a space after '=' for a few options such as "-init=<symbol>" or "-entry=<symbol>". This patch is to fix that bug and add a few tests for it. llvm-svn: 205693
* [ELF] Add a test for -rpath.Rui Ueyama2014-04-051-1/+11
| | | | llvm-svn: 205663
* [ELF] Fix --soname option.Rui Ueyama2014-04-051-0/+20
| | | | | | | | | | | | | | | Currently LLD accepts only "-soname <string>", but all the following options are actually valid. --soname=foo --soname foo -soname=foo -soname foo -h foo This patch fixes that issue. llvm-svn: 205662
* [ELF] Diagnose malformed --dynsym option.Rui Ueyama2014-04-041-0/+10
| | | | llvm-svn: 205654
* Rename getInputGraph() and getNextFile().Rui Ueyama2014-04-042-30/+30
| | | | | | | | | Seems getSomething() is more common naming scheme than just a noun to get something, so renaming these members. Differential Revision: http://llvm-reviews.chandlerc.com/D3285 llvm-svn: 205589
* Fix comments.Rui Ueyama2014-04-031-1/+1
| | | | llvm-svn: 205568
* Remove ordinals from Input Graph elements.Rui Ueyama2014-04-031-39/+34
| | | | | | | | | | | | | An ordinal is set to each child of Input Graph, but no one actually uses it. The only piece of code that gets ordinaly values is sortInputElements in InputGraph.cpp, but it does not actually do anything -- we assign ordinals in increasing order just before calling sort, so when sort is called it's already sorted. It's no-op. We can simply remove it. No functionality change. Differential Revision: http://llvm-reviews.chandlerc.com/D3270 llvm-svn: 205501
* Remove unused fields/member functions from unit test.Rui Ueyama2014-04-021-13/+4
| | | | llvm-svn: 205469
* Remove unused include.Rui Ueyama2014-04-021-2/+0
| | | | llvm-svn: 205466
* Simplify communication between Resolver and Input Graph.Rui Ueyama2014-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Resolver is sending too much information to Input Graph than Input Graph actually needs. In order to collect the detailed information, which wouldn't be consumed by anyone, we have a good amount of code in Resolver, Input Graph and Input Elements. This patch is to simplify it. No functionality change. Specifically, this patch replaces ResolverState enum with a boolean value. The enum defines many bits to notify the progress about linking to Input Graph using bit masks, however, what Input Graph actually does is to compare a given value with 0. The details of the bit mask is simply being ignored, so the efforts to collect such data is wasted. This patch also changes the name of the notification interface from setResolverState to notifyProgress, to make it sounds more like message passing style. It's not a setter but something to notify of an update, so the new name should be more appropriate than before. Differential Revision: http://llvm-reviews.chandlerc.com/D3267 llvm-svn: 205463
* s/llvm::dyn_cast/dyn_cast/Rui Ueyama2014-04-021-10/+10
| | | | llvm-svn: 205404
* Merge ELFGroup with Group.Rui Ueyama2014-04-011-11/+2
| | | | | | | | Group class is designed for GNU LD's --start-group and --end-group. There's no obvious need to have two classes for it -- one as an abstract base class and the other as a concrete class. llvm-svn: 205375
* Remove duplicate code in unit tests carried in from main code.Rui Ueyama2014-04-011-23/+5
| | | | llvm-svn: 205371
* Simplify InputGraphTest.Rui Ueyama2014-04-011-8/+4
| | | | llvm-svn: 205369
* Greatly simplify InputGraph.Rui Ueyama2014-04-011-237/+52
| | | | | | | | | | | | | | | | | | | | | InputGraph has too many knobs and controls that are not being used. This patch is to remove dead code, unused features and a class. There are two things that worth noting, besides simple dead code removal: 1. ControlNode class is removed. We had it as the base class of Group class, but it provides no functionality particularly meaningful. We now have shallower class hierarchy that is easier to understand. 2. InputGraph provides a feature to replace a node with its internal data. It is being used to "expand" some type of node, such as a Linker Script node, with its actual files. We used to have two options when replacing it -- ExpandOnly or ExpandAndReplace. ExpandOnly was to expand it but not remove the node from the tree. There is no use of that option in the code, so it was a dead feature. Differential Revision: http://llvm-reviews.chandlerc.com/D3252 llvm-svn: 205363
* s/dyn_cast/cast/ where return value should never be null.Rui Ueyama2014-04-011-1/+1
| | | | | | | | cast<X> asserts the type is correct and does not return null on failure. So we should use cast<X> rather than dyn_cast<X> at such places where we don't expect type conversion could fail. llvm-svn: 205332
* [ELF] Support --defsym option to define an absolute symbol.Rui Ueyama2014-03-281-0/+39
| | | | | | | | | | | | | | | | | This patch is to support --defsym option for ELF file format/GNU-compatible driver. Currently it takes a symbol name followed by '=' and a number. If such option is given, the driver sets up an absolute symbol with the specified address. You can specify multiple --defsym options to define multiple symbols. GNU LD's --defsym provides many more features. For example, it allows users to specify another symbol name instead of a number to define a symbol alias, or it even allows a symbol plus an offset (e.g. --defsym=foo+3) to define symbol- relative alias. This patch does not support that, but will be supported in subsequent patches. Differential Revision: http://llvm-reviews.chandlerc.com/D3208 llvm-svn: 205029
* Make anonymous namespace as small as possible.Rui Ueyama2014-03-274-12/+5
| | | | llvm-svn: 204982
* Remove extra semicolon for -Wpedantic.Simon Atanasyan2014-03-191-7/+7
| | | | llvm-svn: 204224
* [PECOFF] Fix link order.Rui Ueyama2014-03-141-5/+4
| | | | | | | | | | | | | | | | LLD fails to link symbol "_main" if the symbol is in a library file and the library file is given as a bare argument (i.e. not with /defaultlib option). It's because library files given as bare arguments are processed before other libraries given with /defaultlib, so when Linker finds msvcrtd needs a definition for "_main", the file providing the main function has already been processed and skipped. Linker don't revisit libraries if it's not given with /defaultlib. To fix it this patch change the way of command line handling; files end with ".lib" are treated as if they are given with /defaultlib. I don't believe it's 100% correct behavior but it's better than before. llvm-svn: 203892
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-131-5/+2
| | | | | | | | This results in some simplifications to the code where an OwningPtr had to be used with the previous api and then ownership moved to a unique_ptr for the rest of lld. llvm-svn: 203809
* [Cleanup] Sort includes.Ahmed Charles2014-03-121-2/+2
| | | | llvm-svn: 203666
* Add "override" and remove "virtual" where appropriate.Rui Ueyama2014-03-064-19/+19
| | | | | | | For the record, I used clang-modernize to add "override" and perl to remove "virtual". llvm-svn: 203164
* [PECOFF] Driver support for /SAFESEH option.Rui Ueyama2014-02-211-0/+16
| | | | | | | | | | | | | | | Syntactically /SAFESEH is a boolean flag -- you can pass /SAFESEH or /SAFESEH:no. The meaning of /SAFESEH is as follows. - If /SAFESEH is specified, the linker will produce an executable with SEH table. If any input files are not compatible with SEH, it's an error. - If /SAFESEH:no is specified, the linker will not emit SEH table even if all input files are compatible with SEH. - If no option is specified, the linker emits SEH table if all input files are compatible with SEH. llvm-svn: 201895
* [MachO] Add undefined atoms.Joey Gouly2014-02-021-4/+12
| | | | llvm-svn: 200649
* [PECOFF] Accept /machine:x64 option.Rui Ueyama2014-01-241-3/+8
| | | | | | | This is the first patch to support PE32+ format, which is the image format to use 64 bit address space on Windows/x86-64. llvm-svn: 200029
* [MachO] Begin support for reading fat binaries.Joey Gouly2014-01-143-27/+1322
| | | | llvm-svn: 199259
* [PECOFF] Support STACKSIZE module-definition file directive.Rui Ueyama2014-01-141-0/+13
| | | | llvm-svn: 199170
* Add a function to verify an ExportDesc.Rui Ueyama2014-01-141-21/+16
| | | | llvm-svn: 199167
* Do not use "auto" where actual type is obvious and short.Rui Ueyama2014-01-141-1/+1
| | | | llvm-svn: 199166
* Reduce even more boilerplate.Rui Ueyama2014-01-131-55/+34
| | | | llvm-svn: 199165
* Whitespace.Rui Ueyama2014-01-134-114/+114
| | | | llvm-svn: 199164
* Reduce the boilerplate in the test cases for the module-definition file.Rui Ueyama2014-01-131-26/+21
| | | | llvm-svn: 199163
* Use bettter names for the tests.Rui Ueyama2014-01-131-7/+7
| | | | llvm-svn: 199161
* [PECOFF] Add another test for the module-definition file parser.Rui Ueyama2014-01-131-0/+11
| | | | llvm-svn: 199159
* [MachO] Add basic support for local symbols.Joey Gouly2014-01-131-2/+20
| | | | llvm-svn: 199155
* [PECOFF] Support VERSION directive.Rui Ueyama2014-01-111-0/+20
| | | | llvm-svn: 199022
* [PECOFF] Support NAME directive.Rui Ueyama2014-01-111-0/+20
| | | | llvm-svn: 199020
* [PECOFF] Support HEAPSIZE directive.Rui Ueyama2014-01-111-0/+20
| | | | llvm-svn: 198994
* [PECOFF] Refactor module-defintion file parser.Rui Ueyama2014-01-111-12/+20
| | | | | | | | Refactor the parser so that the parser can return arbitrary type of parse result other than a vector of ExportDesc. Parsers for non-EXPORTS directives will be implemented in different patches. No functionality change. llvm-svn: 198993
* [mach-o] enable mach-o and native yaml to be intermixedNick Kledzik2014-01-112-8/+9
| | | | | | | | | | | | | | | | | | The main goal of this patch is to allow "mach-o encoded as yaml" and "native encoded as yaml" documents to be intermixed. They are distinguished via yaml tags at the start of the document. This will enable all mach-o test cases to be written using yaml instead of checking in object files. The Registry was extend to allow yaml tag handlers to be registered. The mach-o Reader adds a yaml tag handler for the tag "!mach-o". Additionally, this patch fixes some buffer ownership issues. When parsing mach-o binaries, the mach-o atoms can have pointers back into the memory mapped .o file. But with yaml encoded mach-o, name and content are ephemeral, so a copyRefs parameter was added to cause the mach-o atoms to make their own copy. llvm-svn: 198986
* [PECOFF] Add a unit test for r198925.Rui Ueyama2014-01-102-0/+62
| | | | llvm-svn: 198974
* Use getError instead of the error_code operator.Rafael Espindola2014-01-081-46/+46
| | | | llvm-svn: 198797
* [mach-o] properly extract atom content from subrange of section contentNick Kledzik2014-01-081-21/+29
| | | | llvm-svn: 198728
* Use the mach-o MH_* name for file types in yamlNick Kledzik2014-01-081-12/+12
| | | | llvm-svn: 198725
OpenPOWER on IntegriCloud