llvm-project/lld
Rui Ueyama 8d3010a1a6 COFF: Change the order of adding symbols to the symbol table.
Previously, the order of adding symbols to the symbol table was simple.
We have a list of all input files. We read each file from beginning of
the list and add all symbols in it to the symbol table.

This patch changes that order. Now all archive files are added to the
symbol table first, and then all the other object files are added.
This shouldn't change the behavior in single-threading, and make room
to parallelize in multi-threading.

In the first step, only lazy symbols are added to the symbol table
because archives contain only Lazy symbols. Member object files
found to be necessary are queued. In the second step, defined and
undefined symbols are added from object files. Adding an undefined
symbol to the symbol table may cause more member files to be added
to the queue. We simply continue reading all object files until the
queue is empty.

Finally, new archive or object files may be added to the queues by
object files' directive sections (which contain new command line
options).

The above process is repeated until we get no new files.

Symbols defined both in object files and in archives can make results
undeterministic. If an archive is read before an object, a new member
file gets linked, while in the other way, no new file would be added.
That is the most popular cause of an undeterministic result or linking
failure as I observed. Separating phases of adding lazy symbols and
undefined symbols makes that deterministic. Adding symbols in each
phase should be parallelizable.

llvm-svn: 241107
2015-06-30 19:35:21 +00:00
..
COFF COFF: Change the order of adding symbols to the symbol table. 2015-06-30 19:35:21 +00:00
cmake/modules Add VTune as an optional external dependency and add task tracking. 2013-04-06 00:56:40 +00:00
docs Fix docs-lld-html build. 2015-04-10 21:37:42 +00:00
include/lld llvm api change. 2015-06-25 23:41:55 +00:00
lib Use copy init instead of direct init. 2015-06-30 18:04:46 +00:00
test COFF: Change the order of adding symbols to the symbol table. 2015-06-30 19:35:21 +00:00
tools ArrayRef-ify Driver::parse and related functions. 2015-06-21 06:32:10 +00:00
unittests ArrayRef-ify Driver::parse and related functions. 2015-06-21 06:32:10 +00:00
utils Move the 'linker-script-test' binary to the tools directory. 2015-03-11 22:05:49 +00:00
.arcconfig Update Phabricator server. 2014-04-07 04:52:24 +00:00
.clang-format Remove redundant "Standard: Cpp11" tag. The LLVM style has used the 2014-07-04 12:08:03 +00:00
.gitignore Update .gitignore to ignore hidden MacOSX Finder droppings 2014-07-16 21:01:17 +00:00
CMakeLists.txt COFF: Add a new PE/COFF port. 2015-05-28 19:09:30 +00:00
LICENSE.TXT Update copyright year to 2015. 2015-03-12 20:14:35 +00:00
README.md Test commit 2012-09-14 00:00:39 +00:00

README.md

LLVM Linker (lld)

This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.

lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.