ELFAttributes.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- ELFAttributes.h - ELF Attributes ------------------------*- 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_SUPPORT_ELFATTRIBUTES_H
  14. #define LLVM_SUPPORT_ELFATTRIBUTES_H
  15. #include "llvm/ADT/ArrayRef.h"
  16. #include "llvm/ADT/StringRef.h"
  17. #include <optional>
  18. namespace llvm {
  19. struct TagNameItem {
  20. unsigned attr;
  21. StringRef tagName;
  22. };
  23. using TagNameMap = ArrayRef<TagNameItem>;
  24. namespace ELFAttrs {
  25. enum AttrType : unsigned { File = 1, Section = 2, Symbol = 3 };
  26. StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap,
  27. bool hasTagPrefix = true);
  28. std::optional<unsigned> attrTypeFromString(StringRef tag, TagNameMap tagNameMap);
  29. // Magic numbers for ELF attributes.
  30. enum AttrMagic { Format_Version = 0x41 };
  31. } // namespace ELFAttrs
  32. } // namespace llvm
  33. #endif
  34. #ifdef __GNUC__
  35. #pragma GCC diagnostic pop
  36. #endif