ELFAttributes.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //===-- ELFAttributes.h - ELF Attributes ------------------------*- C++ -*-===//
  2. //
  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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_SUPPORT_ELFATTRIBUTES_H
  9. #define LLVM_SUPPORT_ELFATTRIBUTES_H
  10. #include "llvm/ADT/ArrayRef.h"
  11. #include "llvm/ADT/StringRef.h"
  12. namespace llvm {
  13. struct TagNameItem {
  14. unsigned attr;
  15. StringRef tagName;
  16. };
  17. using TagNameMap = ArrayRef<TagNameItem>;
  18. namespace ELFAttrs {
  19. enum AttrType : unsigned { File = 1, Section = 2, Symbol = 3 };
  20. StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap,
  21. bool hasTagPrefix = true);
  22. Optional<unsigned> attrTypeFromString(StringRef tag, TagNameMap tagNameMap);
  23. // Magic numbers for ELF attributes.
  24. enum AttrMagic { Format_Version = 0x41 };
  25. } // namespace ELFAttrs
  26. } // namespace llvm
  27. #endif