Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===- DWARFRelocMap.h ------------------------------------------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_DEBUGINFO_DWARF_DWARFRELOCMAP_H |
| 10 | #define LLVM_DEBUGINFO_DWARF_DWARFRELOCMAP_H |
| 11 | |
| 12 | #include "llvm/ADT/DenseMap.h" |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 13 | #include "llvm/Object/RelocationResolver.h" |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 14 | #include <cstdint> |
| 15 | |
| 16 | namespace llvm { |
| 17 | |
| 18 | /// RelocAddrEntry contains relocated value and section index. |
| 19 | /// Section index is -1LL if relocation points to absolute symbol. |
| 20 | struct RelocAddrEntry { |
| 21 | uint64_t SectionIndex; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 22 | object::RelocationRef Reloc; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 23 | uint64_t SymbolValue; |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 24 | Optional<object::RelocationRef> Reloc2; |
| 25 | uint64_t SymbolValue2; |
| 26 | object::RelocationResolver Resolver; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | /// In place of applying the relocations to the data we've read from disk we use |
| 30 | /// a separate mapping table to the side and checking that at locations in the |
| 31 | /// dwarf where we expect relocated values. This adds a bit of complexity to the |
| 32 | /// dwarf parsing/extraction at the benefit of not allocating memory for the |
| 33 | /// entire size of the debug info sections. |
| 34 | using RelocAddrMap = DenseMap<uint64_t, RelocAddrEntry>; |
| 35 | |
| 36 | } // end namespace llvm |
| 37 | |
| 38 | #endif // LLVM_DEBUGINFO_DWARF_DWARFRELOCMAP_H |