DWARFRelocMap.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/ObjectFile.h"
  17. #include "llvm/Object/RelocationResolver.h"
  18. #include <cstdint>
  19. namespace llvm {
  20. /// RelocAddrEntry contains relocated value and section index.
  21. /// Section index is -1LL if relocation points to absolute symbol.
  22. struct RelocAddrEntry {
  23. uint64_t SectionIndex;
  24. object::RelocationRef Reloc;
  25. uint64_t SymbolValue;
  26. std::optional<object::RelocationRef> Reloc2;
  27. uint64_t SymbolValue2;
  28. object::RelocationResolver Resolver;
  29. };
  30. /// In place of applying the relocations to the data we've read from disk we use
  31. /// a separate mapping table to the side and checking that at locations in the
  32. /// dwarf where we expect relocated values. This adds a bit of complexity to the
  33. /// dwarf parsing/extraction at the benefit of not allocating memory for the
  34. /// entire size of the debug info sections.
  35. using RelocAddrMap = DenseMap<uint64_t, RelocAddrEntry>;
  36. } // end namespace llvm
  37. #endif // LLVM_DEBUGINFO_DWARF_DWARFRELOCMAP_H
  38. #ifdef __GNUC__
  39. #pragma GCC diagnostic pop
  40. #endif