LLVM 22.0.0git
ELFAttributes.h
Go to the documentation of this file.
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
9#ifndef LLVM_SUPPORT_ELFATTRIBUTES_H
10#define LLVM_SUPPORT_ELFATTRIBUTES_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/ADT/StringRef.h"
15#include <optional>
16
17namespace llvm {
18
19// Tag to string: ELF compact build attribute section
21 unsigned attr;
23};
24
26
27// Build Attribute storage for ELF extended attribute section
29 enum Types : uint8_t {
33 unsigned Tag;
34 unsigned IntValue;
35 std::string StringValue;
36 BuildAttributeItem(Types Ty, unsigned Tg, unsigned IV, std::string SV)
37 : Type(Ty), Tag(Tg), IntValue(IV), StringValue(std::move(SV)) {}
38};
40 std::string Name;
41 unsigned IsOptional;
42 unsigned ParameterType;
44};
45
46// Tag to string: ELF extended build attribute section
49 unsigned Tag;
52 : SubsectionName(SN), Tag(Tg), TagName(TN) {}
53};
54
55namespace ELFAttrs {
56
57enum AttrType : unsigned { File = 1, Section = 2, Symbol = 3 };
58
59LLVM_ABI StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap,
60 bool hasTagPrefix = true);
61LLVM_ABI std::optional<unsigned> attrTypeFromString(StringRef tag,
62 TagNameMap tagNameMap);
63
64// Magic numbers for ELF attributes.
65enum AttrMagic { Format_Version = 0x41 };
66
67} // namespace ELFAttrs
68} // namespace llvm
69#endif
#define LLVM_ABI
Definition: Compiler.h:213
static const uint32_t IV[8]
Definition: blake3_impl.h:83
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM_ABI std::optional< unsigned > attrTypeFromString(StringRef tag, TagNameMap tagNameMap)
LLVM_ABI StringRef attrTypeAsString(unsigned attr, TagNameMap tagNameMap, bool hasTagPrefix=true)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1886
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:856
BuildAttributeItem(Types Ty, unsigned Tg, unsigned IV, std::string SV)
Definition: ELFAttributes.h:36
enum llvm::BuildAttributeItem::Types Type
SmallVector< BuildAttributeItem, 64 > Content
Definition: ELFAttributes.h:43
SubsectionAndTagToTagName(StringRef SN, unsigned Tg, StringRef TN)
Definition: ELFAttributes.h:51