summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core/LinkingContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [Darwin] Use errorHandler from liblldCommonBrian Gesiak2018-06-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Error handling in liblldCore and the Darwin toolchain prints to an output stream. A TODO in the project explained that a diagnostics interface resembling Clang's should be added. For now, the simple diagnostics interface defined in liblldCommon seems like an improvement. It prints colors when they're available, uses locks for thread-safety, and abstracts away the `"error: "` and newline literal strings that litter the Darwin toolchain code. To use the liblldCommon error handler, a link dependency is added to the liblldDriver library. Test Plan: 1. check-lld 2. Invoke `ld64.lld -r` in a terminal that supports color output. Confirm that "ld64.lld: error: -arch not specified and could not be inferred" is output, and that the "error:" is colored red! Reviewers: ruiu, smeenai Reviewed By: ruiu Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D47998 llvm-svn: 334466
* Fix some Clang-tidy modernize-use-default and Include What You Use warnings; ↵Eugene Zelenko2016-11-041-5/+6
| | | | | | | | other minor fixes. Differential revision: https://reviews.llvm.org/D26293 llvm-svn: 286000
* Convert lld file writing to llvm::Error. NFC.Pete Cooper2016-03-301-1/+1
| | | | | | | This converts the writeFile method, as well as some of the ones it calls in the normalized binary file writer and yaml writer. llvm-svn: 264961
* Use C++11 initializers for data members.Rui Ueyama2016-03-021-7/+1
| | | | llvm-svn: 262447
* Remove more dead code.Rui Ueyama2016-03-021-1/+1
| | | | llvm-svn: 262445
* Remove default implementations that are always overridden by subclasses.Rui Ueyama2016-03-021-7/+0
| | | | llvm-svn: 262444
* Remove dead code for ELF.Rui Ueyama2016-02-281-4/+1
| | | | llvm-svn: 262195
* Remove remaining code for COFF.Rui Ueyama2016-02-281-22/+0
| | | | llvm-svn: 262193
* Add File::kind's for all subclasses of File.Pete Cooper2016-01-141-3/+6
| | | | | | | | | | | | This is to enable isa<> support for any files which need it. It will be used in an upcoming patch to differentiate MachOFile from other implicitly generated files. Reviewed by Lang Hames. Differential Revision: http://reviews.llvm.org/D16103 llvm-svn: 257830
* Reapply r234378, with test fixed (by emaste).Davide Italiano2015-04-101-1/+1
| | | | | | Hopefully this time the build won't be broken. llvm-svn: 234553
* Revert "Allow undefined symbols in shared library by default."Rui Ueyama2015-04-081-1/+1
| | | | | | This reverts commit r234378 because it broke buildbots. llvm-svn: 234414
* Allow undefined symbols in shared library by default.Davide Italiano2015-04-081-1/+1
| | | | | | | | | | | | It's not our business to resolve those undefined symbols. We just trust the linker will load the library and its dependencies correctly, which is actually what happens, modulo bugs in the dynamic linker itself. PR: 23035 Differential Revision: http://reviews.llvm.org/D8886 llvm-svn: 234378
* Replace the `createImplicitFiles` method return type with `void`Simon Atanasyan2015-04-061-3/+3
| | | | | | | All instances of the `createImplicitFiles` always return `true` and this return value is used nowhere. llvm-svn: 234205
* [Core] Remove roundTripPass() function.Shankar Easwaran2015-02-061-20/+0
| | | | | | | | | | | | Use the environment variable "LLD_RUN_ROUNDTRIP_TEST" in the test that you want to disable, as RUN: env LLD_RUN_ROUNDTRIP_TEST= <run> This was a patch that I made, but I find this a better way to accomplish what we want to do. llvm-svn: 228376
* Fix five of the shared library build targetsGreg Fitzgerald2015-01-211-1/+1
| | | | | | | | | | | | | | | | | | Before this patch there was a cyclic dependency between lldCore and lldReaderWriter. Only lldConfig could be built as a shared library. * Moved Reader and Writer base classes into lldCore. * The following shared libraries can now be built: lldCore lldYAML lldNative lldPasses lldReaderWriter Differential Revision: http://reviews.llvm.org/D7105 From: Greg Fitzgerald <garious@gmail.com> llvm-svn: 226732
* [Core] Remove function to not override RoundTripPasses.Shankar Easwaran2014-12-011-1/+1
| | | | | | | | | RoundTripPasses should always be called in DEBUG mode if the environment variable "LLD_RUN_ROUNDTRIP_TEST" is set. Flavors should not be able to override this behavior. llvm-svn: 223073
* [Core] Add flag to check if RoundTripPasses need to be run.Shankar Easwaran2014-12-011-0/+20
| | | | | | | | | | | | | | This would allow other flavor specific contexts to override the default value, if they want to optionally run the round trip passes. There is some information lost like the original file owner of the atom with RoundTripPasses. The Gnu flavor needs this information inorder to implement LinkerScript matching and for other diagnostic outputs such as Map files. The flag also can be used to record information in the Atom if the information to the Writer needs to be conveyed through References too. llvm-svn: 222983
* Add MachOLinkingContext parameter to MachOFileNode constructor.Nick Kledzik2014-10-011-1/+1
| | | | | | | | | | | No functionality change. This removes a down-cast from LinkingContext to MachOLinkingContext. Also, remove const from LinkingContext::createImplicitFiles() to remove the need for another const cast. Seems reasonable for createImplicitFiles() to need to modify the context (MachOLinkingContext does). llvm-svn: 218796
* Don't import error_code into the lld namespace.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210785
* Move Simple.h and Alias.h to include/Core.Rui Ueyama2014-06-111-2/+2
| | | | | | | | Because the files in Core actually depend on these files. Differential Revision: http://reviews.llvm.org/D4000 llvm-svn: 210710
* Move alias symbols from ELFLinkingContext to LinkingContext.Rui Ueyama2014-05-221-2/+22
| | | | | | | | | | Alias symbols are SimpleDefinedAtoms and are platform neutral. They don't have to belong ELF. This patch is to make it available to all platforms. No functionality change intended. Differential Revision: http://reviews.llvm.org/D3862 llvm-svn: 209475
* Simplify nullptr check.Rui Ueyama2014-05-221-7/+4
| | | | llvm-svn: 209357
* Don't use "auto" where the actual type is not obvious.Rui Ueyama2014-05-021-2/+2
| | | | llvm-svn: 207875
* Move nextFile() from LinkingContext to InputGraph.Rui Ueyama2014-04-021-33/+1
| | | | | | | | | | | | | | | | | LinkingContext and InputGraph are unnecessarily entangled. Most linker input file data, e.g. the vector containing input files, the next index of the input file, etc. are managed by InputGraph, but only the current input file is for no obvious reason managed by LinkingContext. This patch is to move code from LinkingContext to InputGraph to fix it. It's now clear who's reponsible for managing input file state, which is InputGraph, and LinkingContext is now free from that responsibility. It improves the readability as we now have fewer dependencies between classes. No functionality change. Differential Revision: http://llvm-reviews.chandlerc.com/D3259 llvm-svn: 205394
* [ELF] Support --defsym option to define an absolute symbol.Rui Ueyama2014-03-281-2/+2
| | | | | | | | | | | | | | | | | 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-1/+2
| | | | | | | | | 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
* Fix typo.Rui Ueyama2014-03-281-1/+1
| | | | llvm-svn: 204984
* Use getError instead of the error_code operator.Rafael Espindola2014-01-081-3/+3
| | | | llvm-svn: 198797
* The return value of createInternalFiles is unused, so remove it.Joey Gouly2013-12-311-2/+1
| | | | llvm-svn: 198266
* Remove duplicate methods.Rui Ueyama2013-12-261-4/+12
| | | | llvm-svn: 198034
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [PassManager] add ReaderWriter{Native,YAML} to the Driver.Shankar Easwaran2013-10-291-1/+1
| | | | | | | | | | | | | Enable this for the following flavors a) core b) gnu c) darwin Its disabled for the flavor PECOFF. Convenient markers are added with FIXME comments in the Driver that would be removed and code removed from each flavor. llvm-svn: 193585
* [Layout] Assign ordinals in Resolution order.Shankar Easwaran2013-10-091-1/+2
| | | | llvm-svn: 192277
* [inputGraph] Associate Resolve state with appropriate nodesShankar Easwaran2013-10-091-1/+1
| | | | | | | | | | 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
* Update error classes from all lowercase to camel case.Rui Ueyama2013-10-091-5/+5
| | | | llvm-svn: 192261
* [LinkingContext] make LinkingContext non-constShankar Easwaran2013-10-081-2/+2
| | | | llvm-svn: 192183
* Make bitmask an unsigned type.Rui Ueyama2013-10-081-1/+1
| | | | llvm-svn: 192163
* Add comments. Early return.Rui Ueyama2013-10-081-10/+16
| | | | llvm-svn: 192149
* [lld][InputGraph] Change the Resolver to use inputGraphShankar Easwaran2013-10-071-12/+39
| | | | | | | | | | | | 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
* [lld][LinkingContext][ELF] Allow different output file types.Shankar Easwaran2013-09-231-1/+1
| | | | | | | | | | 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
* Drop the context forceLoadAllArchives() support. Rename the isForceLoadJoerg Sonnenberger2013-09-081-1/+1
| | | | | | | | | attribute in LinkerInput to isWholeArchive and use that for deciding whether library archives should be expanded. Implement the -all_load option of the Darwin linker using this flag and drop the support for it in GNU mode. llvm-svn: 190275
* Change the parseFile argument from MemoryBuffer pointer to LinkerInputJoerg Sonnenberger2013-09-071-11/+0
| | | | | | reference. Move readFile logic into FileNode::createLinkerInput. llvm-svn: 190253
* [lld][LinkingContext] Atoms created from command line options should be ↵Shankar Easwaran2013-08-311-0/+35
| | | | | | | | | | | | available in YAML This adds an API to the LinkingContext for flavors to add Internal files containing atoms that need to appear in the YAML output as well, when -emit-yaml switch is used. Flavors can add more internal files for other options that are needed. llvm-svn: 189718
* Rename TargetInfo -> LinkingContext.Rui Ueyama2013-08-061-0/+55
Also change some local variable names: "ti" -> "context" and "_targetInfo" -> "_context". Differential Revision: http://llvm-reviews.chandlerc.com/D1301 llvm-svn: 187823
OpenPOWER on IntegriCloud