summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver
Commit message (Collapse)AuthorAgeFilesLines
...
* [PECOFF] Add a test for lib.exe subcommand.Rui Ueyama2014-05-012-0/+7
| | | | | | | | | | | | Previously the input file for the lib.exe command would be removed as soon as the command exits, so we couldn't write a test to check the file contents are correct. This patch adds /lldmoduledeffile: option to retain a copy of the temporary file at the given file path, so that you can see the file if you want. llvm-svn: 207727
* [Driver] Check type of InputElement before request a error message. If theSimon Atanasyan2014-04-301-2/+7
| | | | | | | | element is a FileNode, request error description. If the element is Group, print hard coded error message. We need to implement a better diagnostics here but even current solution is better than a segmentation fault output. llvm-svn: 207691
* [Driver] Remove the redundant cast.Simon Atanasyan2014-04-301-1/+1
| | | | | | No functional changes. llvm-svn: 207688
* [Mips] Recognize MIPS emulation name 'elf32ltsmip'.Simon Atanasyan2014-04-301-0/+4
| | | | llvm-svn: 207687
* [PECOFF] Allow multiple directives in one module-definition file.Rui Ueyama2014-04-262-44/+66
| | | | | | | | I'm a bit surprised that I have not implemented this yet. This is definitely needed to handle real-world module definition files. This patch contains a unit test for r207294. llvm-svn: 207297
* [PECOFF] Fix off-by-one error in .def file parser.Rui Ueyama2014-04-251-1/+1
| | | | | | | | I'm fixing another bug in the parser, and I wanted to submit this fix as a separate change as it's logically independent from the other. I'll add a test for this shortly. llvm-svn: 207294
* [PECOFF] Add /IMPLIB command line option.Rui Ueyama2014-04-252-1/+5
| | | | | | This option is to override the default import file path. llvm-svn: 207175
* [PECOFF] Better handling of /OPT option.Rui Ueyama2014-04-222-11/+17
| | | | | | | | | | | Previously LLD would fail if /OPT:icf, /OPT:lbr or such are specified, because these command line flags would be handled as unknown ones. We rather want LLD to ignore these known but yet-to-be-implemented options for now. Added tests for the driver as well. llvm-svn: 206863
* [PECOFF] Handle line comment in module-definition file.Rui Ueyama2014-04-221-41/+48
| | | | | | In .def files, ';' is the start of line comment. llvm-svn: 206831
* [PECOFF] Win64 DLL entry function name is _DllMainCRTStartup.Rui Ueyama2014-04-181-4/+7
| | | | | | Unlike Win32/x86, it has no "@12" suffix. llvm-svn: 206648
* [PECOFF] Support LIBRARY directive.Rui Ueyama2014-04-182-0/+14
| | | | | | | LIBRARY directive in a module definition file specifies the output DLL file name. It also takes an optional value for the base address. llvm-svn: 206647
* Use switch for readability.Rui Ueyama2014-04-181-12/+15
| | | | llvm-svn: 206638
* [PECOFF] Ignore /ignore option.Rui Ueyama2014-04-181-0/+1
| | | | | | | | /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-20/+26
| | | | | | | 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-7/+20
| | | | | | | | | | | | | | | | | | | | | 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
* Add missing includes.Benjamin Kramer2014-04-122-0/+2
| | | | llvm-svn: 206113
* Early continue to reduce nesting.Rui Ueyama2014-04-071-13/+13
| | | | llvm-svn: 205737
* No else after return.Rui Ueyama2014-04-071-4/+3
| | | | llvm-svn: 205736
* [ELF] Accept "-rpath=<foo>" as well as "-rpath <foo>".Rui Ueyama2014-04-061-2/+2
| | | | llvm-svn: 205694
* [ELF] Fix driver bug.Rui Ueyama2014-04-061-3/+3
| | | | | | | | 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] Fix --soname option.Rui Ueyama2014-04-051-1/+3
| | | | | | | | | | | | | | | 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-1/+1
| | | | llvm-svn: 205654
* Rename getInputGraph() and getNextFile().Rui Ueyama2014-04-042-6/+6
| | | | | | | | | 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
* Expand 'auto' that's hard for human to deduce its real type.Rui Ueyama2014-04-033-4/+4
| | | | llvm-svn: 205564
* Remove ordinals from Input Graph elements.Rui Ueyama2014-04-033-14/+7
| | | | | | | | | | | | | 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
* Fix style.Rui Ueyama2014-04-031-5/+5
| | | | llvm-svn: 205490
* Minor style fix.Rui Ueyama2014-04-021-2/+1
| | | | llvm-svn: 205486
* [TODO] revisit features TODO in the driverShankar Easwaran2014-04-021-6/+2
| | | | llvm-svn: 205395
* [ELF] Create Attribute class associated with Input files.Shankar Easwaran2014-04-022-14/+14
| | | | | | | The attribute class holds positional attributes for Input files specified on the command line for the Gnu flavor. llvm-svn: 205392
* [ELF] Add -z muldefs option.Shankar Easwaran2014-04-021-0/+10
| | | | | | | | | This adds -z muldefs option which is widely used over --allow-multiple-definition. This option is supported by the GNU linker. llvm-svn: 205391
* Merge ELFGroup with Group.Rui Ueyama2014-04-012-3/+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
* Rename insertOneElementAt -> insertElementAt.Rui Ueyama2014-04-011-2/+2
| | | | | | | insertElementsAt() is removed, so "One" in insertOneElementAt() no longer make much sense. Rename it for brevity. llvm-svn: 205372
* Greatly simplify InputGraph.Rui Ueyama2014-04-015-18/+13
| | | | | | | | | | | | | | | | | | | | | 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
* Remove dynamic casts.Rui Ueyama2014-04-011-6/+5
| | | | | | | | Asserting with cast<T> did not actually make much sense because there was no need to use dynamic casting in the first place. We could make the compiler to statically type check these objects. llvm-svn: 205350
* s/dyn_cast/cast/ where return value should never be null.Rui Ueyama2014-04-012-6/+7
| | | | | | | | 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
* [PECOFF] Make PECOFFFileNode::parse idempotent.Rui Ueyama2014-04-011-0/+3
| | | | | | | | PECOFFFileNode::parse can be called twice -- once by WinLink driver and once more by Driver. We want to make sure that the second call won't mess up the internal data. llvm-svn: 205284
* [PECOFF] Treat .imp as an import library file.Rui Ueyama2014-04-012-3/+7
| | | | | | | | | | | | Some Clang build uses .imp not .lib file extension for an import library file, so we need to treat such file as a library file. Ideally we should not rely on file extensions to detect file type. Instead we should use magic bytes at beginning of a file. The GNU-compatible driver actually does that but it made writing unit tests hard, so I chose an ad-hoc approach for now. llvm-svn: 205283
* [ELF] Terminate argv with nullptr.Rui Ueyama2014-03-281-7/+2
| | | | | | Also remove unused vector. llvm-svn: 205052
* [ELF] Support response file.Rui Ueyama2014-03-281-1/+48
| | | | | | | | | Response file is a command line argument in the form of @file. The GNU- compatible driver expands the file contents, replacing @file argument. Differential Revision: http://llvm-reviews.chandlerc.com/D3210 llvm-svn: 205038
* [ELF] Support --defsym option to define an absolute symbol.Rui Ueyama2014-03-282-1/+27
| | | | | | | | | | | | | | | | | 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
* [ELF] Add --allow-multiple-definition option.Rui Ueyama2014-03-282-0/+7
| | | | | | | | | If --allow-multiple-definition option is given, LLD does not treat duplicate symbol error as a fatal error. GNU LD supports this option. Differential Revision: http://llvm-reviews.chandlerc.com/D3211 llvm-svn: 205015
* Replace nested switches with if.Rui Ueyama2014-03-281-15/+5
| | | | llvm-svn: 204987
* Remove extraneous parentheses.Rui Ueyama2014-03-281-2/+2
| | | | llvm-svn: 204986
* Make anonymous namespace as small as possible.Rui Ueyama2014-03-272-18/+20
| | | | llvm-svn: 204982
* [PECOFF] Avoid C-style cast.Rui Ueyama2014-03-261-1/+1
| | | | llvm-svn: 204855
* [PECOFF] Use RAII object for mutex.Rui Ueyama2014-03-261-15/+8
| | | | llvm-svn: 204853
* [PECOFF] Print out command line if we have expanded response files.Rui Ueyama2014-03-251-3/+15
| | | | | | | | | | | If a response file is given via command line, the final command line arguments will not appear in the log because the actual arguments are in the given file. This patch is to show the final command line if /verbose is specified to help users. llvm-svn: 204754
* [PECOFF] Rename link.exe -> lld-link.exe.Rui Ueyama2014-03-211-0/+1
| | | | | | | Creating the file "link.exe" made some confusion, so it's better to name it lld-link.exe, as we did for CL (clang-cl.exe). llvm-svn: 204509
* [PECOFF] Fix possible response file buffer overrun.Rui Ueyama2014-03-211-1/+2
| | | | | | | | Response file is not NUL terminated, so when creating a StringRef for the buffer contents, we need to pass the buffer size as well as the pointer pointing to the buffer. llvm-svn: 204420
* Move RoundTrip tests behind LLVM_RUN_ROUNDTRIP_TEST env flag.Rui Ueyama2014-03-201-2/+6
| | | | | | | | | | | | | If the environment variable is defined and not empty, RoundTrip tests are run. The reason to move the tests behind the flag is because they are too slow to enable by default. LLD linking time on llvm-tblgen improved from 2m7s to 2.3s. About 60x faster now in this case. Differential Revision: http://llvm-reviews.chandlerc.com/D3126 llvm-svn: 204296
OpenPOWER on IntegriCloud