Commit Graph

628 Commits

Author SHA1 Message Date
George Rimar
cc870b19ca [llvm/Object] - Make ELFObjectFile::getRelocatedSection return Expected<section_iterator>
It returns just a section_iterator currently and have a report_fatal_error call inside.
This change adds a way to return errors and handle them on caller sides.

The patch also changes/improves current users and adds test cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375408 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-21 11:06:38 +00:00
Zinovy Nis
9873f72649 Fix minor warning in DWARFVerifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375357 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-20 07:55:50 +00:00
David Blaikie
73770d6089 DebugInfo: Remove unnecessary/mistaken inclusion of Bitcode/BitcodeAnalyzer.h
Introduced in r374582, Michael Spencer pointed out this broke the
modules build due to a missing tblgen dependency on
llvm/IR/Attributes.inc.

Michael fixed the dependency in r374827.

So this removes the inclusion and the new dependency (effectively
reverting r374827 and including the alternative fix of removing rather
than supporting the new dependency).

Thanks for the quick fix/notice, Michael!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374831 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 22:12:45 +00:00
Michael J. Spencer
e122082aec [Modules Build] Add missing dependency.
A previous commit made libLLVMDebugInfoDWARF depend on the LLVM_Bitcode module which depends on the LLVM_intrinsic_gen module which depends on "llvm/IR/Attributes.inc" which is a generated header not depended on by libLLVMDebugInfo. Add that dependency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374827 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 21:53:51 +00:00
David Blaikie
0d1d61648e DebugInfo: Fix msan use-of-uninitialized exposed by r374600
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374619 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 00:27:12 +00:00
David Blaikie
9a6583f43f llvm-dwarfdump: Add verbose printing for debug_loclists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374582 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-11 19:06:35 +00:00
David Blaikie
230cf52e6e llvm-dwarfdump: Support multiple debug_loclists contributions
Also fixing the incorrect "offset" field being computed/printed for each
location list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374232 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-09 21:25:28 +00:00
David Blaikie
6ee28aaf7f DebugInfo: Shot in the dark attempt to fix ubsan error from r374122
(specifying an underlying type for the enum might also be suitable - but
this seems better/as good, since there's a clear expectation this can
contain values other than the actual enumerators of this enum)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374196 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-09 18:37:13 +00:00
David Blaikie
f17b0c49ca DebugInfo: Move LLE enum handling to .def to match RLE handling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374122 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-08 21:48:46 +00:00
David Blaikie
374a09dd02 DebugInfo: Add parsing support for debug_loc base address specifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373278 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-01 00:29:13 +00:00
Pavel Labath
d93e5a30d0 MCRegisterInfo: Merge getLLVMRegNum and getLLVMRegNumFromEH
Summary:
The functions different in two ways:
- getLLVMRegNum could return both "eh" and "other" dwarf register
  numbers, while getLLVMRegNumFromEH only returned the "eh" number.
- getLLVMRegNum asserted if the register was not found, while the second
  function returned -1.

The second distinction was pretty important, but it was very hard to
infer that from the function name. Aditionally, for the use case of
dumping dwarf expressions, we needed a function which can work with both
kinds of number, but does not assert.

This patch solves both of these issues by merging the two functions into
one, returning an Optional<unsigned> value. While the same thing could
be achieved by adding an "IsEH" argument to the (renamed)
getLLVMRegNumFromEH function, it seemed better to avoid the confusion of
two functions and put the choice of asserting into the hands of the
caller -- if he checks the Optional value, he can safely process
"untrusted" input, and if he blindly dereferences the Optional, he gets
the assertion.

I've updated all call sites to the new API, choosing between the two
options according to the function they were calling originally, except
that I've updated the usage in DWARFExpression.cpp to use the "safe"
method instead, and added a test case which would have previously
triggered an assertion failure when processing (incorrect?) dwarf
expressions.

Reviewers: dsanders, arsenm, JDevlieghere

Subscribers: wdng, aprantl, javed.absar, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372710 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-24 09:31:02 +00:00
Igor Kudrin
7214b3f528 [DWARF] Fix referencing Range List Tables from CUs for DWARF64.
As DW_AT_rnglists_base points after the header and headers have
different sizes for DWARF32 and DWARF64, we have to use the format
of the CU to adjust the offset correctly in order to extract
the referenced range list table.

The patch also changes the type of RangeSectionBase because in DWARF64
it is 8-bytes long.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371016 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 07:02:28 +00:00
Igor Kudrin
5d5cff4a14 [DWARF] Support DWARF64 in DWARFListTableHeader.
This enables 64-bit DWARF support for parsing range and location list tables.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371014 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 06:49:05 +00:00
Pavel Labath
7c8f17874e DWARF: Fix a regression in location list dumping
Summary:
While fixing the handling of some error cases, r370363 introduced new
problems -- assertion failures due to unchecked errors (my excuse is that a very
early version of that patch used Optional<T> instead of Expected).

This patch adds proper handling of parsing errors encountered when
dumping location lists from inside DWARF DIEs, and adds a bunch of
additional tests.

I reorder the arguments of the location list dumping functions to make
them consistent, and also be able to dump the two kinds of location
lists generically.

Reviewers: JDevlieghere, dblaikie, probinson

Subscribers: aprantl, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370868 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-04 10:09:12 +00:00
Djordje Todorovic
5c672903bd [DWARFVerifier] Verify GNU extensions of call site DWARF symbols
Verify that the call site DWARF symbols (added during the implementation
of the debug entry values feature) are generated properly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370631 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-02 09:20:46 +00:00
Pavel Labath
91fd77e058 DWARFDebugLoc: Make parsing and error reporting more robust
Summary:
While examining this class for possible use in lldb, I noticed two
things:
- it spits out parsing errors directly to stderr
- the loclists parser can incorrectly return valid location lists when
  parsing malformed (truncated) data

I improve the stderr situation by making the parseOneLocationList
functions return Expected<T>s. The errors are still dumped to stderr by
their callers, so this is only a partial fix, but it is enough for my
use case, as I intend to parse the locations lists one by one.

I fix the behavior in the truncated scenario by using the newly
introduced DataExtractor Cursor API.

I also add tests for handling the error cases, as they currently have no
coverage.

Reviewers: dblaikie, JDevlieghere, probinson

Subscribers: lldb-commits, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370363 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-29 14:26:05 +00:00
Pavel Labath
49276e2904 Add error handling to the DataExtractor class
Summary:
This is motivated by D63591, where we realized that there isn't a really
good way of telling whether a DataExtractor is reading actual data, or
is it just returning default values because it reached the end of the
buffer.

This patch resolves that by providing a new "Cursor" class. A Cursor
object encapsulates two things:
- the current position/offset in the DataExtractor
- an error object

Storing the error object inside the Cursor enables one to use the same
pattern as the std::{io}stream API, where one can blindly perform a
sequence of reads and only check for errors once at the end of the
operation. Similarly to the stream API, as soon as we encounter one
error, all of the subsequent operations are skipped (return default
values) too, even if the would suceed with clear error state. Unlike the
std::stream API (but in line with other llvm APIs), we force the error
state to be checked through usage of llvm::Error.

Reviewers: probinson, dblaikie, JDevlieghere, aprantl, echristo

Subscribers: kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370042 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-27 11:24:08 +00:00
Igor Kudrin
93a98d69bb [DWARF] Adjust return type of DWARFUnit::getLength().
DWARFUnitHeader::getLength() returns uint64_t.
DWARFUnit::getLength() should do the same.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369529 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 14:10:57 +00:00
Igor Kudrin
3afc5fe656 [DWARF] Fix reading 64-bit DWARF type units.
The type_offset field is 8 bytes long in DWARF64. The patch extends
TypeOffset to uint64_t and fixes its reading. The patch also fixes
checking of TypeOffset bounds as it was inaccurate in DWARF64 case.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369378 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20 12:52:32 +00:00
Igor Kudrin
9cd6fac1ec Remove the temporary code. NFC.
That should have been done in rL368156 but somehow was missed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369082 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-16 03:40:04 +00:00
Jonas Devlieghere
e703aabe74 [DebugLine] Don't try to guess the path style
In r368879 I made an attempt to guess the path style from the files in
the line table. After some consideration I now think this is a poor
idea. This patch undoes that behavior and instead adds an optional
argument to specify the path style. This allows us to make that decision
elsewhere where we have more information. In case of LLDB based on the
Unit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369072 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-15 23:53:15 +00:00
Jonas Devlieghere
114087caa6 [llvm] Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369013 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-15 15:54:37 +00:00
Michael Pozulp
23c8a3ba6c [llvm-objdump] Add warning messages if disassembly + source for problematic inputs
Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905

Reviewers: jhenderson, rupprecht, grimar

Reviewed By: jhenderson, grimar

Subscribers: RKSimon, MaskRay, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368963 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-15 05:15:22 +00:00
Jonas Devlieghere
5fbbf499ea [DebugLine] Improve path handling.
After switching over LLDB's line table parser to libDebugInfo, we
noticed two regressions on the Windows bot. The problem is that when
obtaining a file from the line table prologue, we append paths without
specifying a path style. This leads to incorrect results on Windows for
debug info containing Posix paths:

  0x0000000000201000: /tmp\b.c, is_start_of_statement = TRUE

This patch is an attempt to fix that by guessing the path style whenever
possible.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368879 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 17:00:10 +00:00
George Rimar
1bfa43df58 Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return Expected<>"
Changes: no changes. A fix for the clang code will be landed right on top.

Original commit message:

SectionRef::getName() returns std::error_code now.
Returning Expected<> instead has multiple benefits.

For example, it forces user to check the error returned.
Also Expected<> may keep a valuable string error message,
what is more useful than having a error code.
(Object\invalid.test was updated to show the new messages printed.)

This patch makes a change for all users to switch to Expected<> version.

Note: in a few places the error returned was ignored before my changes.
In such places I left them ignored. My intention was to convert the interface
used, and not to improve and/or the existent users in this patch.
(Though I think this is good idea for a follow-ups to revisit such places
and either remove consumeError calls or comment each of them to clarify why
it is OK to have them).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368826 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 11:10:11 +00:00
George Rimar
899e01b67d Revert r368812 "[llvm/Object] - Convert SectionRef::getName() to return Expected<>"
It broke clang BB: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/16455



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368813 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 08:56:55 +00:00
George Rimar
0d8949846a [llvm/Object] - Convert SectionRef::getName() to return Expected<>
SectionRef::getName() returns std::error_code now.
Returning Expected<> instead has multiple benefits.

For example, it forces user to check the error returned.
Also Expected<> may keep a valuable string error message,
what is more useful than having a error code.
(Object\invalid.test was updated to show the new messages printed.)

This patch makes a change for all users to switch to Expected<> version.

Note: in a few places the error returned was ignored before my changes.
In such places I left them ignored. My intention was to convert the interface
used, and not to improve and/or the existent users in this patch.
(Though I think this is good idea for a follow-ups to revisit such places
and either remove consumeError calls or comment each of them to clarify why
it is OK to have them).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368812 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-14 08:46:54 +00:00
David Blaikie
d7cbb69576 DebugInfo/DWARF: Provide some (pretty half-hearted) error handling access when parsing units
This isn't the most robust error handling API, but does allow clients to
opt-in to getting Errors they can handle. I suspect the long-term
solution would be to move away from the lazy unit parsing and have an
explicit step that parses the unit and then allows access to the other
APIs that require a parsed unit.

llvm-dwarfdump could be expanded to use this (or newer/better API) to
demonstrate the benefit of it - but for now lld will use this in a
follow-up cl which ensures lld can exit non-zero on errors like this (&
provide more descriptive diagnostics including which object file the
error came from).

(error access to later errors when parsing nested DIEs would be good too
- but, again, exposing that without it being a hassle for every consumer
may be tricky)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368377 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-09 01:14:33 +00:00
David Blaikie
f5b457980d Remove else-after-return
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368364 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-08 23:17:23 +00:00
David Blaikie
b5de9a3fcc DebugInfo/DWARF: Remove unused return type from DWARFUnit::extractDIEsIfNeeded
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368212 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-07 21:31:33 +00:00
David Blaikie
4237abeab2 Fix indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368198 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-07 19:09:31 +00:00
David Blaikie
948e657594 DebugInfo/DWARF: Normalize DWARFObject members on the DWARF spec section names
Some of these names were abbreviated, some were not, some pluralised,
some not. Made the API difficult to use - since it's an exact 1:1
mapping to the DWARF sections - use those names (changing underscore
separation for camel casing).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368189 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-07 17:18:11 +00:00
Igor Kudrin
7dfea23421 Remove support for 32-bit offsets in utility classes (5/5)
Differential Revision: https://reviews.llvm.org/D65641


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368156 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-07 11:44:47 +00:00
Igor Kudrin
6ddd530f1e Try to unbreak buildbots after r368014
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368018 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-06 11:12:13 +00:00
Igor Kudrin
8ee19f8c63 Switch LLVM to use 64-bit offsets (2/5)
This updates all libraries and tools in LLVM Core to use 64-bit offsets
which directly or indirectly come to DataExtractor.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368014 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-06 10:49:40 +00:00
Igor Kudrin
36ec6cc9c1 Support 64-bit offsets in utility classes (1/5)
Using 64-bit offsets is required to fully implement 64-bit DWARF.
As these classes are used in many different libraries they should
temporarily support both 32- and 64-bit offsets.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368013 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-06 10:47:20 +00:00
Michael Pozulp
22dacdb953 Revert "[llvm-objdump] Re-commit r367284."
This reverts r367776 (git commit d34099926e909390cb0254bebb4b7f5cf15467c7).
My changes to llvm-objdump tests caused them to fail on windows:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/27368

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367816 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-05 08:52:28 +00:00
Fangrui Song
6183bab466 [DWARF] Change DWARFDebugLoc::Entry::Loc from SmallVector<char, 4> to SmallString<4>
SmallString has a conversion to StringRef, which can be leveraged to
simplify two use sites.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367801 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-05 06:33:52 +00:00
Michael Pozulp
befd61501a [llvm-objdump] Re-commit r367284.
Add warning messages if disassembly + source for problematic inputs

Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905

Reviewers: jhenderson, rupprecht, grimar

Reviewed By: jhenderson, grimar

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367776 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-04 06:04:00 +00:00
Djordje Todorovic
a782d2cb2d Reland "[DwarfDebug] Dump call site debug info"
The build failure found after the rL365467 has been
resolved.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367446 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-31 16:51:28 +00:00
Michael Pozulp
3917015010 Revert "[llvm-objdump] Add warning messages if disassembly + source for problematic inputs"
This reverts r367284 (git commit b1cbe51bdf44098c74f5c74b7bcd8c041a7c6772).
My changes to LLVMSymbolizer caused a test to fail:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/29488

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367286 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-30 07:05:27 +00:00
Michael Pozulp
3401779594 [llvm-objdump] Add warning messages if disassembly + source for problematic inputs
Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=41905

Reviewers: jhenderson, rupprecht, grimar

Reviewed By: jhenderson, grimar

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367284 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-30 05:28:26 +00:00
Igor Kudrin
ae40b57421 [DWARF][NFC] Add constants for reserved values of an initial length field.
Differential Revision: https://reviews.llvm.org/D65039


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366887 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-24 11:34:29 +00:00
Jonas Devlieghere
f79e8f94d2 [DWARF] Use 32-bit format specifier for offset
This should fix PR42730.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366859 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-23 22:34:21 +00:00
Jonas Devlieghere
bee5bcd674 [DWARF] Add more error handling to debug line parser.
This patch exnteds the error handling in the debug line parser to get
rid of the existing MD5 assertion. I want to reuse the debug line parser
from LLVM in LLDB where we cannot crash on invalid input.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366762 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-22 23:23:34 +00:00
Hsiangkai Wang
b6f810717a [DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366524 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-19 02:03:34 +00:00
Hsiangkai Wang
1b3d4c83af Revert "[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame."
This reverts commit 17e3cbf5fe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366444 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 15:06:50 +00:00
Hsiangkai Wang
17e3cbf5fe [DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366442 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 14:47:34 +00:00
Alex Bradbury
bfd9349162 [DWARF][RISCV] Add support for RISC-V relocations needed for debug info
When code relaxation is enabled many RISC-V fixups are not resolved but
instead relocations are emitted. This happens even for DWARF debug
sections. Therefore, to properly support the parsing of DWARF debug info
we need to be able to resolve RISC-V relocations. This patch adds:

* Support for RISC-V relocations in RelocationResolver
* DWARF support for two relocations per object file offset
* DWARF changes to support relocations in more DIE fields

The two relocations per offset change is needed because some RISC-V
relocations (used for label differences) come in pairs.

Relocations can also be emitted for DWARF fields where relocations were
not yet evaluated. Adding relocation support for some of these fields is
essencial. On the other hand, LLVM currently emits RISC-V relocations
for fixups that could be safely evaluated, since they can never be
affected by code relaxations. This patch also adds relocation support
for the fields affected by those extraneous relocations (the DWARF unit
entry Length, and the DWARF debug line entry TotalLength and
PrologueLength), for testing purposes.

Differential Revision: https://reviews.llvm.org/D62062
Patch by Luís Marques.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366402 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-18 05:22:55 +00:00
Igor Kudrin
f6f2d32c53 [DWARF] Fix the reserved values for unit length in DWARFDebugLine.
The DWARF3 documentation had inconsistency concerning the reserved range
for unit length values. The issue was fixed in DWARF4.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366190 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-16 07:01:08 +00:00