Commit Graph

6272 Commits

Author SHA1 Message Date
Rafael Espindola 01c078966d Delete dead code.
And make it easier to spot code going dead by using elf::.

llvm-svn: 275858
2016-07-18 18:24:41 +00:00
Hans Wennborg 708cf064ca docs/conf.py: update version to 4.0
llvm-svn: 275847
2016-07-18 18:12:14 +00:00
Hans Wennborg 72acd60772 Trunk release notes are now for 4.0.0
The 3.9 release are on the 3.9 branch.

llvm-svn: 275845
2016-07-18 18:07:03 +00:00
Rafael Espindola 3fab868675 Pass section by reference. NFC.
llvm-svn: 275803
2016-07-18 16:05:09 +00:00
Rui Ueyama e33579072d Remove SymbolBody::PlaceholderKind.
In the last patch for --trace-symbol, I introduced a new symbol type
PlaceholderKind and store it to SymVector storage. It made all code
that iterates over SymVector to recognize and skip PlaceholderKind
symbols. I found that that's annoying.

In this patch, I removed PlaceholderKind and stop storing them to SymVector.
Now the information whether a symbol is being watched by --trace-symbol
is stored to the Symtab hash table.

llvm-svn: 275747
2016-07-18 01:35:00 +00:00
Rui Ueyama d6328526ba Iterate over SymVector instead of Symtab hash table.
SymVector contains all symbols, so we can iterate either Symtab or SymVector
to visit all symbols. Iterating over SymVector makes the next change for
--trace-symbol possible.

llvm-svn: 275746
2016-07-18 01:34:57 +00:00
Rui Ueyama 25a6d57b9c Unbreak msan buildbot.
llvm-svn: 275728
2016-07-17 19:55:22 +00:00
Rui Ueyama 77fa5ee160 Remove dead code.
llvm-svn: 275724
2016-07-17 18:27:17 +00:00
Rui Ueyama 69c778c084 Implement almost-zero-cost --trace-symbol.
--trace-symbol is a command line option to watch a symbol.
Previosly, we looked up a hash table for a new symbol if the
option is given. Any code that looks up a hash table for each
symbol is expensive because the linker handles a lot of symbols.
In our design, we look up a hash table strictly only once
for a symbol, so --trace-symbol was an exception.

This patch improves efficiency of the option by merging the
hash table into the symbol table.

Instead of looking up a separate hash table with a string,
this patch sets `Traced` flag to symbols specified by --trace-symbol.
So, if you insert a symbol and get a symbol with `Traced` flag on,
you know that you need to print out a log message for the symbol.
This is nearly zero cost.

llvm-svn: 275716
2016-07-17 17:50:09 +00:00
Rui Ueyama b06700fa78 Make Lazy's ctro protected because it shouldn't be instantiated directly.
llvm-svn: 275715
2016-07-17 17:44:41 +00:00
Rui Ueyama bef5d16a90 Remove duplicate public specifier.
llvm-svn: 275714
2016-07-17 17:44:40 +00:00
Rui Ueyama 2a7c1c1507 Print out file names for common symbols for --trace-symbol.
Previously, there was no way to get a file name for a DefinedCommon
symbol. This patch adds it.

llvm-svn: 275712
2016-07-17 17:36:22 +00:00
Rui Ueyama 663b8c2769 Handle versioned symbols efficiently.
Versions can be assigned to symbols in two different ways.
One is the usual version scripts, and the other is special
symbol suffix '@'. If a symbol contains '@', the string after
that is considered to specify a version name.

Previously, we look for '@' for all symbols.

Anything that works on every symbol can be expensive because
the linker has to handle a lot of symbols. The search for '@'
was not an exception.

In this patch, I made two optimizations.

The first optimization is to handle '@' only when at least one
version is defined. If no versions are defined, no versions can
be assigned to any symbols, so it's waste of time to search for '@'.

The second optimization is to scan only suffixes of symbol names
instead of entire symbol names. Symbol names can be very long, but
symbol versions are usually short, so scanning entire symbol names
is waste of time, too.

There are some error cases which we no longer be able to detect
with this patch. I don't think it's a major drawback because they
are minor errors. Speed is more important.

This change improves LLD with debug info self-link time from
6.6993 seconds to 6.3426 seconds (or -5.3%).

Differential Revision: https://reviews.llvm.org/D22433

llvm-svn: 275711
2016-07-17 17:23:17 +00:00
Rui Ueyama 434b56179e Add a pointer to a source file to SymbolBody.
Previously, each subclass of SymbolBody had a pointer to a source
file from which it was created. So, there was no single way to get
a source file for a symbol. We had getSourceFile<ELFT>(), but the
function was a bit inconvenient as it's a template.

This patch makes SymbolBody have a pointer to a source file.
If a symbol is not created from a file, the pointer has a nullptr.

llvm-svn: 275701
2016-07-17 03:11:46 +00:00
Rui Ueyama 7a7a96e199 Do not invoke FileCheck with `not` command.
We should use CHECK-NOT instead.

llvm-svn: 275700
2016-07-17 01:34:39 +00:00
Rui Ueyama 3ec5c84606 Attempt to unbreak Windows bot.
llvm-svn: 275695
2016-07-16 19:16:15 +00:00
Rui Ueyama 818bb2f8dc Remove redundant namespace specifiers.
llvm-svn: 275694
2016-07-16 18:55:47 +00:00
Rui Ueyama 962b277d2d Resurrect code that was lost in conflicting commits.
llvm-svn: 275693
2016-07-16 18:45:25 +00:00
Rui Ueyama f953a8ac17 Use skip() instead of peek() and expect().
llvm-svn: 275692
2016-07-16 18:45:23 +00:00
George Rimar ee0e63804f Update for r275682:
I think 
# REQUIRES: shell 
is required instead of 
# XFAIL: win32

llvm-svn: 275683
2016-07-16 12:34:06 +00:00
George Rimar 50dcece2a0 Recommit r275257 "[ELF] - Implement extern "c++" version script tag"
BSD toolchain contains a bug:
https://sourceforge.net/p/elftoolchain/tickets/491/

In short demangler works differently, fix was to update the testcase.
It should fix the FreeBSD bot failture:
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/19432/steps/test_lld/logs/stdio

Original commit message was:
[ELF] - Implement extern "c++" version script tag

Patch implements 'extern' version script tag.
Currently only values in quotes(") are supported.

Matching of externs is performed in the same pass as exact match of globals.

Differential revision: http://reviews.llvm.org/D21930

llvm-svn: 275682
2016-07-16 12:26:39 +00:00
Rui Ueyama c755599997 Simplify. NFC.
llvm-svn: 275675
2016-07-16 04:19:29 +00:00
Rui Ueyama af469d47e9 Rename SymbolVersions VersionDefinitions.
SymbolVersions sounds like it had versions for a symbol, so rename it.

llvm-svn: 275674
2016-07-16 04:09:27 +00:00
Rui Ueyama bc94dd9b28 Rename Version VersionDefinition.
The identifier `Version` was used too often in the code to handle
symbol versions. The struct that contains version definitions is
named `Version`. Local variables for version ID are named `Version`.
Local varaible for version string are named `Version`.

This patch give them different names.

llvm-svn: 275673
2016-07-16 04:02:00 +00:00
Rui Ueyama 52654ebb12 Use ScriptParserBase::skip() instead of peek() and next().
skip(S) consumes a token if the next token is S,
so it can be used instead of peek() & next().

llvm-svn: 275672
2016-07-16 03:45:59 +00:00
Rui Ueyama c9b4c073b2 Simplify. NFC.
llvm-svn: 275670
2016-07-16 03:12:16 +00:00
Rui Ueyama 2506866ff6 Simplify default symbol version management. NFC.
llvm-svn: 275669
2016-07-16 03:08:26 +00:00
Rui Ueyama e9381bd2d8 Remove redundant variable.
llvm-svn: 275667
2016-07-16 02:47:42 +00:00
Rui Ueyama f524464e2f Set sh_addralign in the constructor for consistency. NFC.
llvm-svn: 275666
2016-07-16 02:36:00 +00:00
Rui Ueyama 9f61964769 Make Verdef and Verdaux adjacent in the version definition section.
Previously, Verdefs and Verdauxs are separated in the section.
The new layout is easier to write as we do not have to maintain
two pointers and can avoid passing a reference to a pointer.

llvm-svn: 275665
2016-07-16 02:29:45 +00:00
Rui Ueyama 0ff953e811 Use SymbolVersion::Id instead of a hard-coded local variable.
llvm-svn: 275660
2016-07-16 02:00:43 +00:00
Rui Ueyama 429ef2af6a ELF: Include filenames in error messages.
llvm-svn: 275608
2016-07-15 20:38:28 +00:00
Rui Ueyama 188d2c34e6 Remove variables. NFC.
llvm-svn: 275605
2016-07-15 20:05:05 +00:00
Eugene Leviant 0e36f42846 [ELF] Overriding reserved symbols in linker script
llvm-svn: 275549
2016-07-15 11:20:04 +00:00
Rui Ueyama 3d9b26b4ad Inline traceUndefined function.
llvm-svn: 275531
2016-07-15 04:57:46 +00:00
Rui Ueyama eba9b63cbc Update comments.
llvm-svn: 275530
2016-07-15 04:57:44 +00:00
Rui Ueyama 177746a739 Remove redundant `return`.
llvm-svn: 275528
2016-07-15 04:32:11 +00:00
Rui Ueyama 05ef4cff44 Merge SymbolAssignmentKind and ExprKind.
In a linker script, `.` is a special symbol indicating a counter.
Previously, we had two expression types, ExprKind and SymbolAssignmentKind
for `.` and all the other symbol names, respectively. But we could merge
them because the former is a special case of the latter.

llvm-svn: 275527
2016-07-15 04:19:37 +00:00
Rui Ueyama 601b07c7f5 ELF: Remove member variables that are used only in one function.
Differential Revision: https://reviews.llvm.org/D22396

llvm-svn: 275526
2016-07-15 03:06:42 +00:00
Rui Ueyama 112351dc38 Avoid writing to errs().
We should write to ErrorOS instead. Normaly, *ErrorOS == errs(),
but they can be different if LLD is embedded.

llvm-svn: 275525
2016-07-15 02:51:05 +00:00
Rui Ueyama a9d9eda0ce Inline a vairable that is used only once. NFC.
llvm-svn: 275524
2016-07-15 02:42:18 +00:00
Rui Ueyama 48da5cf236 ELF: Simplify path constructions for -save-temps. NFC.
llvm-svn: 275523
2016-07-15 02:17:13 +00:00
Rui Ueyama f8292e9ac9 ELF: Make check() always return a value.
This patch corresponds to r275511 for COFF.

llvm-svn: 275521
2016-07-15 02:01:03 +00:00
Rui Ueyama aa2db88984 ELF: Make error() to always set HasError.
Previously, it checked for the EC parameter and set HasError
only when there was an error. But in most places we called
error only when error had occurred, so this behavior was confusing.

llvm-svn: 275517
2016-07-15 01:38:54 +00:00
Rui Ueyama bb57954241 COFF: Update error messages so that they start with lowercase letters.
llvm-svn: 275513
2016-07-15 01:12:24 +00:00
Rui Ueyama 5694ebbc8b Remove unnecessary explicit call of Twine ctor.
llvm-svn: 275512
2016-07-15 01:06:40 +00:00
Rui Ueyama 659a4f2f38 Make check() always return a value.
Previously, one of two check functions didn't return a value.
It was confusing. This patch makes both functions return values.

llvm-svn: 275511
2016-07-15 01:06:38 +00:00
Rui Ueyama 0d09a865c6 COFF: Remove `void error()` functions and use fatal instead.
This change makes the control flow more explicit.

llvm-svn: 275504
2016-07-15 00:40:46 +00:00
Rui Ueyama 1a3fd13776 COFF: Remove unnecessary explicit calls of Twine ctor.
llvm-svn: 275501
2016-07-14 23:43:36 +00:00
Rui Ueyama 606047939c COFF: Rename noreturn error -> fatal.
This new name is also consistent with ELF.

llvm-svn: 275500
2016-07-14 23:37:14 +00:00