summaryrefslogtreecommitdiffstats
path: root/lld/unittests/DriverTests/GnuLdDriverTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove the old ELF linker.Rafael Espindola2016-02-281-299/+0
| | | | | | I think it is clear by now that the new linker is viable. llvm-svn: 262158
* [Mips] Support two more MIPS linking emulation options ↵Simon Atanasyan2015-08-281-0/+6
| | | | | | elf32btsmipn32/elf32ltsmipn32 llvm-svn: 246336
* [Mips] Make "emulation" option less dependent on the "-target" option.Simon Atanasyan2015-08-281-0/+10
| | | | | | | Now it is possible to have mips-linux-gnu-ld executable and link MIPS 64-bit little-endian binaries providing -melf64ltsmip command line argument. llvm-svn: 246335
* Fix -Wextra-semi.Rui Ueyama2015-07-231-2/+1
| | | | | | Patch from Eugene.Zelenko! llvm-svn: 243060
* Remove redundant std::move on functions that return a unique_ptr.Benjamin Kramer2015-05-221-1/+1
| | | | llvm-svn: 238034
* [LinkerScript] Implement semantics for simple sections mappingsRafael Auler2015-03-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements the behaviour of the SECTIONS linker script directive, used to not only define a custom mapping between input and output sections, but also order input sections in the output file. To do this, we modify DefaultLayout with hooks at important places that allow us to re-order input sections according to a custom order. We also add a hook in SegmentChunk to allow us to calculate linker script expressions while assigning virtual addresses to the input sections that live in a segment. Not all SECTIONS constructs are currently supported, but only the ones that do not use special sort orders. It adds two LIT test as practical examples of which sections directives are currently supported. In terms of high-level changes, it creates a new class "script::Sema" that owns all linker script ASTs and the logic for linker script semantics as well. ELFLinkingContext owns a single copy of Sema, which will be used throughout the object file writing process (to layout sections as proposed by the linker script). Other high-level change is that the writer no longer uses a "const" copy of the linking context. This happens because linker script expressions must be calculated *while* calculating final virtual addresses, which is a very late step in object file writing. While calculating these expressions, we need to update the linker script symbol table (inside the semantics object), and, thus, we are "modifying our context" as we prepare to write the file. http://reviews.llvm.org/D8157 llvm-svn: 232402
* [LinkerScript] Implement linker script expression evaluationRafael Auler2015-03-091-0/+40
| | | | | | | | | | | The expression evaluation is needed when interpreting linker scripts, in order to calculate the value for new symbols or to determine a new position to load sections in memory. This commit extends Expression nodes from the linker script AST with evaluation functions, and also contains a unit test. http://reviews.llvm.org/D8156 llvm-svn: 231707
* Unittest: Do s/_context/_ctx/g.Rui Ueyama2015-02-101-25/+25
| | | | llvm-svn: 228750
* GNU: Add --no-export-dynamic command line option.Rui Ueyama2015-02-101-0/+12
| | | | llvm-svn: 228749
* Use override rather than virtual.Rui Ueyama2015-02-101-1/+1
| | | | llvm-svn: 228723
* GNU: Use StringRef::empty instead of a boolean flag.Rui Ueyama2015-02-101-0/+5
| | | | | | | This local variable name did not follow the style guide, and it is not actually needed. llvm-svn: 228722
* [Cleanup] Remove member functions added to support nostdlibShankar Easwaran2015-02-061-5/+4
| | | | | | No change in functionality. llvm-svn: 228379
* [ELF] Fix -nostdlib option.Shankar Easwaran2015-02-061-1/+12
| | | | | | | | | Only search library directories explicitly specified on the command line. Library directories specified in linker scripts (including linker scripts specified on the command line) are ignored. llvm-svn: 228375
* ELF: Support INPUT linker script directiveRui Ueyama2015-02-031-0/+8
| | | | | | | | | | INPUT directive is a variant of GROUP in the sense that that specifies a list of input files. The only difference is whether the entire file list is wrapped with a --start-group/--end-group or not. http://reviews.llvm.org/D7390 llvm-svn: 228060
* ELF: Improve linker script unit tests.Rui Ueyama2015-02-031-55/+44
| | | | | | | This patch is to enable to write unit tests for linker script with less boilerplate code. llvm-svn: 227902
* [ELF] Implement action for OUTPUT linker script commandDavide Italiano2015-02-021-0/+13
| | | | | | Reviewed by: ruiu, shankarke llvm-svn: 227787
* [ELF] Implement semantic action for ENTRY linker script command.Davide Italiano2015-02-011-0/+13
| | | | | | Reviewed by: shankarke, ruiu llvm-svn: 227708
* Implement semantic action for SEARCH_DIR linker script commandRafael Auler2015-01-311-0/+14
| | | | | | | | | | | | This is needed, among others by the FreeBSD kernel linker script. Patch by Davide Italiano! Reviewers: ruiu, rafaelauler Differential Revision: http://reviews.llvm.org/D7220 llvm-svn: 227694
* ELF: add a unit test for --as-needed.Rui Ueyama2015-01-281-0/+13
| | | | llvm-svn: 227367
* Add a unit test for LinkerScript.Rui Ueyama2015-01-281-0/+19
| | | | llvm-svn: 227341
* [ELF] Do not error on non-existent file in the driver.Rui Ueyama2015-01-151-43/+18
| | | | | | | 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
* [ELF] Make -init/-fini options compatible with the gnu linkerSimon Atanasyan2014-12-101-5/+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
* Sort include files according to convention.Shankar Easwaran2014-10-181-1/+0
| | | | llvm-svn: 220131
* [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
* [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-271-3/+1
| | | | llvm-svn: 204982
* Add "override" and remove "virtual" where appropriate.Rui Ueyama2014-03-061-1/+1
| | | | | | | For the record, I used clang-modernize to add "override" and perl to remove "virtual". llvm-svn: 203164
* [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
* Make Driver::link and LinkingContext::validate return true on success.Rui Ueyama2013-09-241-4/+4
| | | | | | | | | | | | | This patch inverts the return value of these functions, so that they return "true" on success and "false" on failure. The meaning of boolean return value was mixed in LLD; for example, InputGraph::validate() returns true on success. With this patch they'll become consistent. CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1748 llvm-svn: 191341
* [lld][LinkingContext][ELF] Allow different output file types.Shankar Easwaran2013-09-231-3/+5
| | | | | | | | | | This adds an option --output-filetype that can be set to either YAML/Native(case insensitive). The linker would create the outputs associated with the type specified by the user. Changes all the tests to use the new option. llvm-svn: 191183
* Rename TargetInfo -> LinkingContext.Rui Ueyama2013-08-061-14/+12
| | | | | | | | | Also change some local variable names: "ti" -> "context" and "_targetInfo" -> "_context". Differential Revision: http://llvm-reviews.chandlerc.com/D1301 llvm-svn: 187823
* Fix Driver tests to check return value of parse(), simplify subclassing, and ↵Nick Kledzik2013-07-161-18/+22
| | | | | | remove unneeded instance variables llvm-svn: 186440
* Fix broken unittest for GnuLDDriver.Rui Ueyama2013-07-161-1/+2
| | | | llvm-svn: 186427
* Fix typo in file header.Rui Ueyama2013-05-311-2/+2
| | | | llvm-svn: 182985
* [Driver] Add unit tests for GnuLdDriver.Rui Ueyama2013-05-311-0/+51
llvm-svn: 182980
OpenPOWER on IntegriCloud