DWARFRelocMap.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DWARFRelocMap.h ------------------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_DWARF_DWARFRELOCMAP_H
  14. #define LLVM_DEBUGINFO_DWARF_DWARFRELOCMAP_H
  15. #include "llvm/ADT/DenseMap.h"
  16. #include "llvm/Object/RelocationResolver.h"
  17. #include <cstdint>
  18. namespace llvm {
  19. /// RelocAddrEntry contains relocated value and section index.
  20. /// Section index is -1LL if relocation points to absolute symbol.
  21. struct RelocAddrEntry {
  22. uint64_t SectionIndex;
  23. object::RelocationRef Reloc;
  24. uint64_t SymbolValue;
  25. Optional<object::RelocationRef> Reloc2;
  26. uint64_t SymbolValue2;
  27. object::RelocationResolver Resolver;
  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. } // end namespace llvm
  36. #endif // LLVM_DEBUGINFO_DWARF_DWARFRELOCMAP_H
  37. #ifdef __GNUC__
  38. #pragma GCC diagnostic pop
  39. #endif