ELFAttributes.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. namespace llvm {
  18. struct TagNameItem {
  19. unsigned attr;
  20. StringRef tagName;
  21. };
  22. using TagNameMap = ArrayRef<TagNameItem>;
  23. namespace ELFAttrs {
  24. enum AttrType : unsigned { File = 1, Section = 2, Symbol = 3 };
  25. StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap,
  26. bool hasTagPrefix = true);
  27. Optional<unsigned> attrTypeFromString(StringRef tag, TagNameMap tagNameMap);
  28. // Magic numbers for ELF attributes.
  29. enum AttrMagic { Format_Version = 0x41 };
  30. } // namespace ELFAttrs
  31. } // namespace llvm
  32. #endif
  33. #ifdef __GNUC__
  34. #pragma GCC diagnostic pop
  35. #endif