summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core/Resolver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* TypoJoerg Sonnenberger2014-01-031-1/+1
| | | | llvm-svn: 198434
* Fix a bug that undefined symbols are not reported if dead-stripping is enabled.Rui Ueyama2013-12-261-4/+0
| | | | | | | | There was a bug that the linker does not report an error if symbols specified by -u (or /include on Windows) are not resolved. This patch fixes it by adding such symbols to the dead strip root. llvm-svn: 198041
* Remove unnecessary call of DenseMap::clear.Rui Ueyama2013-12-261-3/+1
| | | | | | | It should be always true that _liveAtoms is empty, so we don't have to clear it. Add an assert() instead. llvm-svn: 198040
* Micro-optimize Resolver::markLive().Rui Ueyama2013-12-261-7/+5
| | | | | | This patch eliminates one std::set lookup per a function call. llvm-svn: 198037
* Simplify. No functionality change.Rui Ueyama2013-12-261-6/+3
| | | | llvm-svn: 198036
* Do not make an unnecessary copy of DenseMap.Rui Ueyama2013-12-261-1/+1
| | | | llvm-svn: 198035
* Style fixes. No functionality change.Rui Ueyama2013-12-101-10/+5
| | | | llvm-svn: 196883
* [InputGraph][Gnu] Add LinkerScript support.Shankar Easwaran2013-11-241-2/+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
* Fix indentation and whitespace.Rui Ueyama2013-11-211-57/+49
| | | | llvm-svn: 195389
* [LinkingContext] Limit shared library undefined atoms to be added.Shankar Easwaran2013-11-211-11/+16
| | | | | | | | | | | | This adds functionality to limit shared library undefined atoms to be added only once by the Resolver. Dynamic libraries may be processed more than once if they exist within a Group. Also adds a test to verify the change. llvm-svn: 195307
* Fix Weak External symbol handling.Rui Ueyama2013-11-201-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | The fallback atom was used only when it's searching for a symbol in a library; if an undefined symbol was not found in a library, the LLD looked for its fallback symbol in the library. Although it worked in most cases, because symbols with fallbacks usually occur only in OLDNAMES.LIB (a standard library), that behavior was incompatible with link.exe. This patch fixes the issue so that the semantics is the same as MSVC's link.exe The new (and correct, I believe) behavior is this: - If there's no definition for an undefined atom, replace the undefined atom with its fallback and then proceed (e.g. look in the next file or stop linking as usual.) Weak External symbols are underspecified in the Microsoft PE/COFF spec. However, as long as I observed the behavior of link.exe, this seems to be what we want for compatibility. Differential Revision: http://llvm-reviews.chandlerc.com/D2162 llvm-svn: 195269
* Refactor copy-paste-and-modifed code using callback.Rui Ueyama2013-11-151-60/+29
| | | | llvm-svn: 194784
* Revert "Use empty() instead of size() == 0."Rui Ueyama2013-11-131-1/+1
| | | | | | This reverts commit r194551 because it broke the buildbot. llvm-svn: 194552
* Use empty() instead of size() == 0.Rui Ueyama2013-11-131-1/+1
| | | | llvm-svn: 194551
* [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
* Revert "r193300 - [PassManager] add ReaderWriter{Native, YAML} to the Driver"Rui Ueyama2013-10-241-1/+1
| | | | | | | The patch have completely broken COFF port and disabled many tests. This also reverts r193302 (comment fix). llvm-svn: 193362
* [PassManager] add ReaderWriter{Native,YAML} to the Driver.Shankar Easwaran2013-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable tests to be run with REQUIRES: disable. Note disable is not added to the config by the test runner Mkaefiles, so essentially disables the test. Code changes would be required to fix these tests :- test/darwin/hello-world.objtxt test/elf/check.test test/elf/phdr.test test/elf/ppc.test test/elf/undef-from-main-dso.test test/elf/X86_64/note-sections-ro_plus_rw.test test/pecoff/alignment.test test/pecoff/base-reloc.test test/pecoff/bss-section.test test/pecoff/drectve.test test/pecoff/dynamic.test test/pecoff/dynamicbase.test test/pecoff/entry.test test/pecoff/hello.test test/pecoff/imagebase.test test/pecoff/importlib.test test/pecoff/lib.test test/pecoff/multi.test test/pecoff/reloc.test test/pecoff/weak-external.test llvm-svn: 193300
* Make undefines check into an assertion.Rui Ueyama2013-10-161-10/+8
| | | | | | | | | Dead-strip root symbols can be undefined atoms, but should not really be nonexistent, because dead-strip root symbols should be added to initial undefined atoms at startup. Whenever you look up its name in the symbol table, some type of atom will always exist. llvm-svn: 192831
* Propagate deadStripOptimize()'s failure to the caller.Rui Ueyama2013-10-161-5/+7
| | | | | | | We want to make the program to exit with non-zero exit code if there's an error during dead stripping. llvm-svn: 192771
* Propagate Resolver::resolveUndefines()'s failure to caller.Rui Ueyama2013-10-111-6/+7
| | | | llvm-svn: 192424
* Return true from Resolver::resolve() on success.Rui Ueyama2013-10-111-2/+2
| | | | llvm-svn: 192422
* Remove an unused variable added in r192415.Rui Ueyama2013-10-111-1/+0
| | | | llvm-svn: 192416
* Use switch instead of if, and handle all enum values.Rui Ueyama2013-10-111-18/+30
| | | | | | | This patch also handles errors other than no_more_files error. They were silently ignored. llvm-svn: 192415
* [Layout] Dont set ordinals to Files by default.Shankar Easwaran2013-10-091-0/+1
| | | | | | | | | | | | | This change removes code in various places which was setting the File Ordinals. This is because the file ordinals are assigned by the way files are resolved. There was no other way than making the getNextFileAndOrdinal be set const and change the _nextOrdinal to mutable. There are so many places in code, that you would need to cleanup to make LinkingContext non-const! llvm-svn: 192280
* [Layout] Assign ordinals in Resolution order.Shankar Easwaran2013-10-091-6/+17
| | | | llvm-svn: 192277
* [inputGraph] Associate Resolve state with appropriate nodesShankar Easwaran2013-10-091-0/+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-1/+1
| | | | llvm-svn: 192261
* Move a local variable into while-loop scope.Rui Ueyama2013-10-091-2/+1
| | | | llvm-svn: 192260
* Make bitmask an unsigned type.Rui Ueyama2013-10-081-1/+1
| | | | llvm-svn: 192163
* [lld][InputGraph] Change the Resolver to use inputGraphShankar Easwaran2013-10-071-88/+128
| | | | | | | | | | | | 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
* [PECOFF] Handle weak external symbols.Rui Ueyama2013-09-121-3/+9
| | | | | | Used the fallback mechanism to implement COFF weak external symbols. llvm-svn: 190633
* Add a fallback mechanism for undefined atom.Rui Ueyama2013-09-121-1/+8
| | | | | | | | | | | | | | | | | In COFF, an undefined symbol can have up to one alternative name. If a symbol is resolved by its regular name, then it's linked normally. If a symbol is not found in any input files, all references to the regular name are resolved using the alternative name. If the alternative name is not found, it's a link error. This mechanism is called "weak externals". To support this mechanism, I added a new member function fallback() to undefined atom. If an undefined atom has the second name, fallback() returns a new undefined atom that should be used instead of the original one to resolve undefines. If it does not have the second name, the function returns nullptr. Differential Revision: http://llvm-reviews.chandlerc.com/D1550 llvm-svn: 190625
* Resolver: Do not use assert() to notify user input error.Rui Ueyama2013-09-031-1/+5
| | | | llvm-svn: 189775
* Use do-while instead of a magic number. No functionality change.Rui Ueyama2013-08-271-3/+3
| | | | llvm-svn: 189413
* Rename TargetInfo -> LinkingContext.Rui Ueyama2013-08-061-13/+13
| | | | | | | | | Also change some local variable names: "ti" -> "context" and "_targetInfo" -> "_context". Differential Revision: http://llvm-reviews.chandlerc.com/D1301 llvm-svn: 187823
* Removed unnecessary "class" keyword.Rui Ueyama2013-06-211-1/+1
| | | | llvm-svn: 184589
* Instrument things.Michael J. Spencer2013-05-281-0/+8
| | | | llvm-svn: 182789
* [lld] Use range based for loop instead of explicit iterators (no ↵Rui Ueyama2013-05-091-3/+2
| | | | | | functionality change) llvm-svn: 181503
* [lld] Add comments to InputFiles::searchLibraries() arguments.Rui Ueyama2013-05-081-4/+11
| | | | llvm-svn: 181492
* Use anonymous namespace for local classes. Patch by Rui UeyamaNick Kledzik2013-05-081-2/+6
| | | | llvm-svn: 181473
* [Core] Allow weak symbols in shared library when linking.Michael J. Spencer2013-04-241-11/+13
| | | | | | Patch by Rui Ueyama. llvm-svn: 180209
* This adds functionality for undefined atoms from dynamic libraries to be addedShankar Easwaran2013-04-111-11/+19
| | | | | | | | | | | | to the list of undefined atoms. The processing of undefined atoms from dynamic libraries is controlled by use-shlib-undefines command line option. This patch also adds additional command line arguments to allow/disallow unresolved symbols from shared libraries and mimics GNU ld behavior. llvm-svn: 179257
* This is my Driver refactoring patch. Nick Kledzik2013-04-041-24/+31
| | | | | | | | | | | | | | | | | | | | | | | The major changes are: 1) LinkerOptions has been merged into TargetInfo 2) LinkerInvocation has been merged into Driver 3) Drivers no longer convert arguments into an intermediate (core) argument list, but instead create a TargetInfo object and call setter methods on it. This is only how in-process linking would work. That is, you can programmatically set up a TargetInfo object which controls the linking. 4) Lots of tweaks to test suite to work with driver changes 5) Add the DarwinDriver 6) I heavily doxygen commented TargetInfo.h Things to do after this patch is committed: a) Consider renaming TargetInfo, given its new roll. b) Consider pulling the list of input files out of TargetInfo. This will enable in-process clients to create one TargetInfo the re-use it with different input file lists. c) Work out a way for Drivers to format the warnings and error done in core linking. llvm-svn: 178776
* [lld] remove trailing whitespaceShankar Easwaran2013-03-141-4/+4
| | | | llvm-svn: 177079
* [Resolver] Improve undefined symbol error.Michael J. Spencer2013-02-031-1/+2
| | | | llvm-svn: 174277
* [Core] Only complain about undefined symbols if they are marked as ↵Michael J. Spencer2013-01-311-6/+10
| | | | | | canBeNullNever. llvm-svn: 174107
* Add SectionPosition and OrderPassNick Kledzik2013-01-231-0/+23
| | | | llvm-svn: 173300
* [Core] Move Resolver and SymbolTable over to TargetInfo.Michael J. Spencer2013-01-221-13/+15
| | | | | | No functionality change. llvm-svn: 173192
* Add new merge-by-content Merge attribute for use by anonymousNick Kledzik2013-01-151-5/+2
| | | | | | constants and string literals which the linker should coalesce. llvm-svn: 172495
* Add absolute symbol scope recognition in lld/CoreHemant Kulkarni2012-11-051-1/+3
| | | | llvm-svn: 167394
OpenPOWER on IntegriCloud