Commit Graph

22 Commits

Author SHA1 Message Date
George Rimar 5f928ff133 [ELF] - Teach LLD to use information from .debug_str for error reporting.
Recently we teached LLD to report line numbers for duplicate variables
definitions, though currently LLD is unable to do that for case when
strings are not built in .debug_info, but stored in .debug_str instead.
That is because out LLDDwarfObj does not handle .debug_str yet. 
Patch fixes that.

Differential revision: https://reviews.llvm.org/D39542

llvm-svn: 318519
2017-11-17 11:57:47 +00:00
Bob Haarman 3fae5a6179 Revert "[ELF] - Teach LLD to use information from .debug_str for error reporting."
This reverts commit 00b7acb8f6c8a4663bb7c8396d217c210209b562.

It was causing some links to execute llvm_unreachable.

llvm-svn: 317378
2017-11-03 22:23:19 +00:00
George Rimar 5b262363b4 [ELF] - Teach LLD to use information from .debug_str for error reporting.
Recently we teached LLD to report line numbers for duplicate variables
definitions, though currently LLD is unable to do that for case when
strings are not built in .debug_info, but stored in .debug_str instead.
That is because out LLDDwarfObj does not handle .debug_str yet. 
Patch fixes that.

Differential revision: https://reviews.llvm.org/D39542

llvm-svn: 317305
2017-11-03 08:04:27 +00:00
Rui Ueyama 15b611d7f8 Remove unused member variable.
llvm-svn: 314087
2017-09-24 23:12:36 +00:00
Rui Ueyama 9f4f490c31 Refactor GdbIndexSection. NFC.
This patch rewrites a part of GdbIndexSection to address the following
issues in the previous implementation:

 - Previously, some struct declarations were in GdbIndex.h while they
   were not used in GdbIndex.cpp. Such structs are moved to
   SyntheticSection.h.

 - The actual implementation were split into GdbIndexSection and GdbHash
   section, but that separation didn't make much sense. They are now
   unified as GdbIndexSection.

In addition to the above changes, this patch splits functions, rename
variables and remove redundant functions/variables to generally improve
code quality.

llvm-svn: 314084
2017-09-24 21:45:35 +00:00
Rui Ueyama 709fb2bb10 Rename ObjectFile -> ObjFile.
Rename it because it was too easy to conflict with llvm::object::ObjectFile
which broke buildbots several times.

llvm-svn: 309199
2017-07-26 22:13:32 +00:00
Rafael Espindola 8b1afd59c3 Speed up gdb index creation.
With that in place we can use lld's own infrastructure for the low
level detail of dwarf parsing.

With this we don't decompress sections twice, we don't scan all
realocations and even with this simplistic implementation linking
clang with gdb index goes from 34.09 seconds to 20.80 seconds.

llvm-svn: 308544
2017-07-19 22:27:35 +00:00
George Rimar 67c60727ce [ELF] - Apply clang-format. NFC.
llvm-svn: 308297
2017-07-18 11:55:35 +00:00
Rafael Espindola 300b38678c Refactor gdb index creation.
I have a patch to let DwarfContext defer to lld for getting section
contents and relocations.

That is a pretty big performance improvement.

This is just a refactoring to make that easier to do.

This change makes the *creation* of gdb index a dedicated step and
makes that templated. That is so that we can uses Elf_Rel in the code.

llvm-svn: 307867
2017-07-12 23:56:53 +00:00
George Rimar 8666562e89 [ELF] - Make implementation of .gdb index to be more natural for futher paralleling.
This patch reimplements .gdb_index in more natural way,
that makes proccess of switching to multithreaded index building to
be trivial. 

Differential revision: https://reviews.llvm.org/D33552

llvm-svn: 304927
2017-06-07 16:59:11 +00:00
Peter Collingbourne 0a2678e9aa ELF: --gdb-index: Change findSection to return an InputSection.
We should only ever expect this function to return a regular
InputSection; I would not expect a function definition to be in a
MergeInputSection or EhInputSection. We were previously crashing
in writeTo if this function returned a section that was not an
InputSection because we do not set OutSec for such sections.

This can happen in practice if a function is defined in an empty
section which shares its offset-in-file with a MergeInputSection,
as in the provided test case.

A better fix for this bug would be to fix the
DWARFUnit::collectAddressRanges() interface to provide section
information (see D33183), but this at least fixes the crash.

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

llvm-svn: 303089
2017-05-15 17:59:21 +00:00
Rui Ueyama ac2d815a2a Split GdbIndexBuilder class into non-member functions.
That class had three member functions, and all of them are just reader
methods that did not depend on class members, so they can be just non-
member functions.

Probably we should reorganize the functions themselves because their
return types doesn't make much sense to me, but for now I just moved
these functions out of the class.

llvm-svn: 296700
2017-03-01 22:54:50 +00:00
Rui Ueyama aab18c0cfc Remove useless variables and declarations.
llvm-svn: 296695
2017-03-01 22:24:46 +00:00
Rui Ueyama e02cc60c72 Do not inherit LoadedObjectInfo.
GdbIndexBuilder class inherited LoadedObjectInfo, but that's not necessary.

llvm-svn: 296687
2017-03-01 22:02:37 +00:00
Rui Ueyama d0e07b919c Don't implement the gdb hash table as a generic in-memory hash table.
Looks like .gdb.index and its support classes do things that they don't
have to or shouldn't do do. This patch addresses one of these issues.

GdbHashTab class is a hash table class. Just like other in-memory hash
tables, that incrementally updates its internal data and resizes buckets
as new elements are added so that key lookup is always fast.
But that is completely not necessary.

Unlike debuggers, we only produce hash tables for .gdb.index and
never read them. So incrementally updating a hash table in memory is
just a waste of resource and complicates the code. What we should
do is to accumulate symbols and then create the final hash table
at once.

llvm-svn: 296678
2017-03-01 21:08:21 +00:00
Rafael Espindola 774ea7d0a9 Make InputSection a class. NFC.
With the current design an InputSection is basically anything that
goes directly in a OutputSection. That includes plain input section
but also synthetic sections, so this should probably not be a
template.

llvm-svn: 295993
2017-02-23 16:49:07 +00:00
Rafael Espindola b4c9b81aad Convert InputSectionBase to a class.
Removing this template is not a big win by itself, but opens the way
for removing more templates.

llvm-svn: 295923
2017-02-23 02:28:28 +00:00
George Rimar ec02b8d4c0 [ELF] - Partial support of --gdb-index command line option (Part 3).
Patch continues work started in D24706 and D25821.

in this patch symbol table and constant pool areas were
added to .gdb_index section output.

This one finishes the implementation of --gdb-index functionality in LLD.

Differential revision: https://reviews.llvm.org/D26283

llvm-svn: 289810
2016-12-15 12:07:53 +00:00
George Rimar 232d11cb54 [ELF] - Attempt to fix ubuntu 64x buildbot (2).
Fixed inaccurate member type: uint32_t -> size_t
(http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/2984/steps/build/logs/stdio).

llvm-svn: 289796
2016-12-15 09:59:18 +00:00
George Rimar aff2530cf8 [ELF] - Attempt to fix ubuntu bot.
(http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/2982)

llvm-svn: 289792
2016-12-15 09:30:07 +00:00
George Rimar 8b54739328 [ELF] - Partial support of --gdb-index command line option (Part 2).
Patch continues work started in D24706,

in this patch address area was added to .gdb_index section output.

Differential revision: https://reviews.llvm.org/D25821

llvm-svn: 289790
2016-12-15 09:08:13 +00:00
George Rimar 58fa5243cc [ELF] - Partial support of --gdb-index command line option (Part 1).
In this patch partial gdb_index section is created. 
For costructing the .gdb_index section 6 steps should be performed (details are in
SplitDebugInfo.cpp file header), this patch do first 3:

Creates proper section header.
Fills list of compilation units.
Types CU list area is not supposed to be supported, so it is ignored and therefore
can be treated as implemented either.

Differential revision: https://reviews.llvm.org/D24706

llvm-svn: 284708
2016-10-20 09:19:48 +00:00