summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver/GnuLdDriver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] Undefined symbols should be allowed when building dynamic librariesShankar Easwaran2014-09-081-0/+2
| | | | | | | When dynamic libraries are built, undefined symbols should always be allowed and the linker should not exit with an error. llvm-svn: 217356
* [AArch64] Initial ELF/AArch64 SupportChad Rosier2014-08-131-0/+4
| | | | | | | | | | This patch adds the initial ELF/AArch64 support to lld. Only a basic "Hello World" app has been successfully tested for both dynamic and static compiling. Differential Revision: http://reviews.llvm.org/D4778 Patch by Daniel Stewart <stewartd@codeaurora.org>! llvm-svn: 215544
* [all]: Use range-based ArgList adapter instead of filtered_begin/filtered_endTim Northover2014-07-091-9/+5
| | | | | | Some of those loops were pretty monstrous. llvm-svn: 212616
* Update for llvm api change.Rafael Espindola2014-06-131-1/+2
| | | | llvm-svn: 210919
* Don't import error_code into the lld namespace.Rafael Espindola2014-06-121-6/+6
| | | | llvm-svn: 210785
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-111-1/+1
| | | | | | This is an update for a llvm api change. llvm-svn: 210689
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-311-1/+1
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209948
* Call normalize() in the common driver.Rui Ueyama2014-05-071-5/+0
| | | | | | | | | | | Previously only GNU driver calls InputGraph::normalize, but its functionality is not and should not be limited to GNU ld. Other driver should be able to use it. Currently only linker scripts use the feature, so this change won't change the existing behavior. llvm-svn: 208266
* [ELF] Fix the file look up algorithm used in the linker script GROUP command.Simon Atanasyan2014-05-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | In general the linker scripts's GROUP command works like a pair of command line options --start-group/--end-group. But there is a difference in the files look up algorithm. The --start-group/--end-group commands use a trivial approach: a) If the path has '-l' prefix, add 'lib' prefix and '.a'/'.so' suffix and search the path through library search directories. b) Otherwise, use the path 'as-is'. The GROUP command implements more compicated approach: a) If the path has '-l' prefix, add 'lib' prefix and '.a'/'.so' suffix and search the path through library search directories. b) If the path does not have '-l' prefix, and sysroot is configured, and the path starts with the / character, and the script being processed is located inside the sysroot, search the path under the sysroot. Otherwise, try to open the path in the current directory. If it is not found, search through library search directories. https://www.sourceware.org/binutils/docs-2.24/ld/File-Commands.html The patch reviewed by Shankar Easwaran, Rui Ueyama. llvm-svn: 207769
* [Mips] Recognize MIPS emulation name 'elf32ltsmip'.Simon Atanasyan2014-04-301-0/+4
| | | | llvm-svn: 207687
* [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
* [ELF] Diagnose malformed --dynsym option.Rui Ueyama2014-04-041-1/+1
| | | | llvm-svn: 205654
* Remove ordinals from Input Graph elements.Rui Ueyama2014-04-031-6/+5
| | | | | | | | | | | | | 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
* [ELF] Create Attribute class associated with Input files.Shankar Easwaran2014-04-021-12/+10
| | | | | | | 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-011-1/+1
| | | | | | | | 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
* Greatly simplify InputGraph.Rui Ueyama2014-04-011-9/+7
| | | | | | | | | | | | | | | | | | | | | 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-011-5/+6
| | | | | | | | 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] 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-281-0/+24
| | | | | | | | | | | | | | | | | 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-281-0/+4
| | | | | | | | | 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-271-4/+4
| | | | llvm-svn: 204982
* [gnu-ld] Support -m on non-NetBSD targets.Michael J. Spencer2014-03-201-2/+0
| | | | llvm-svn: 204293
* [ELF] Add Target specific Readers.Shankar Easwaran2014-01-271-1/+1
| | | | | | No change in functionality. llvm-svn: 200175
* Replace nested switch statements.Rui Ueyama2014-01-051-25/+26
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2501 llvm-svn: 198535
* Add default search path if -nostdlib is not provided.Joerg Sonnenberger2014-01-021-3/+67
| | | | | | | Add basic emulation mapping for NetBSD/amd64, so that clang -m32 works as expected. llvm-svn: 198337
* Run clang-format on r197727.Rui Ueyama2013-12-201-2/+2
| | | | llvm-svn: 197788
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix "doesnot", "endsup" typos and "lets" grammar issuesAlp Toker2013-12-021-1/+1
| | | | llvm-svn: 196056
* [Gnu] Set the defaults in the ELFLinkingContext.Shankar Easwaran2013-11-251-6/+0
| | | | | | 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
* [Gnu] -L paths is not positional.Shankar Easwaran2013-11-251-15/+18
| | | | | | | 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
* [InputGraph][Gnu] Add LinkerScript support.Shankar Easwaran2013-11-241-3/+63
| | | | | | | | | | | | | | | | 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
* Remove extraneous parentheses.Rui Ueyama2013-11-051-5/+3
| | | | llvm-svn: 194089
* Remove unnecessary namespace qualifier.Rui Ueyama2013-11-051-4/+4
| | | | llvm-svn: 194037
* Simplify unique_ptr instantiation. No functionality change.Rui Ueyama2013-10-111-4/+3
| | | | llvm-svn: 192427
* [inputGraph] Associate Resolve state with appropriate nodesShankar Easwaran2013-10-091-3/+3
| | | | | | | | | | This associates resolveState to FileNodes. The control node derive their resolution state from the inputElements that are contained in it. This makes --start-group/--end-group to work with ELF linking. llvm-svn: 192269
* Rename GnuLd's path() too.Rui Ueyama2013-10-081-1/+1
| | | | llvm-svn: 192169
* [lld][InputGraph] Change the Resolver to use inputGraphShankar Easwaran2013-10-071-16/+5
| | | | | | | | | | | | Changes :- a) Functionality in InputGraph to insert Input elements at any position b) Functionality in the Resolver to use nextFile c) Move the functionality of assigning file ordinals to InputGraph d) Changes all inputs to MemoryBuffers e) Remove LinkerInput, InputFiles, ReaderArchive llvm-svn: 192081
* Make Driver::link and LinkingContext::validate return true on success.Rui Ueyama2013-09-241-12/+11
| | | | | | | | | | | | | 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-12/+23
| | | | | | | | | | 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
* Fallback to the default stringize function to show some meaningful error ↵Rui Ueyama2013-09-201-8/+3
| | | | | | | | | | message. GNU LD driver only understood no_such_file_or_directory error and was showing just "Unknown Error" for any other type of error. With this patch, the driver now prints file name and error message string by default. llvm-svn: 191070
* Output soname.Joerg Sonnenberger2013-09-141-0/+4
| | | | llvm-svn: 190758
OpenPOWER on IntegriCloud