[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
[llvm-core.git] / include / llvm / TextAPI / ELF / ELFStub.h
blob76b2af121662890bb82e276e35f81acc57fc8e35
1 //===- ELFStub.h ------------------------------------------------*- 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 /// \file
10 /// This file defines an internal representation of an ELF stub.
11 ///
12 //===-----------------------------------------------------------------------===/
14 #ifndef LLVM_TEXTAPI_ELF_ELFSTUB_H
15 #define LLVM_TEXTAPI_ELF_ELFSTUB_H
17 #include "llvm/BinaryFormat/ELF.h"
18 #include "llvm/Support/VersionTuple.h"
19 #include <vector>
20 #include <set>
22 namespace llvm {
23 namespace elfabi {
25 typedef uint16_t ELFArch;
27 enum class ELFSymbolType {
28 NoType = ELF::STT_NOTYPE,
29 Object = ELF::STT_OBJECT,
30 Func = ELF::STT_FUNC,
31 TLS = ELF::STT_TLS,
33 // Type information is 4 bits, so 16 is safely out of range.
34 Unknown = 16,
37 struct ELFSymbol {
38 ELFSymbol(std::string SymbolName) : Name(SymbolName) {}
39 std::string Name;
40 uint64_t Size;
41 ELFSymbolType Type;
42 bool Undefined;
43 bool Weak;
44 Optional<std::string> Warning;
45 bool operator<(const ELFSymbol &RHS) const {
46 return Name < RHS.Name;
50 // A cumulative representation of ELF stubs.
51 // Both textual and binary stubs will read into and write from this object.
52 class ELFStub {
53 // TODO: Add support for symbol versioning.
54 public:
55 VersionTuple TbeVersion;
56 Optional<std::string> SoName;
57 ELFArch Arch;
58 std::vector<std::string> NeededLibs;
59 std::set<ELFSymbol> Symbols;
61 ELFStub() {}
62 ELFStub(const ELFStub &Stub);
63 ELFStub(ELFStub &&Stub);
65 } // end namespace elfabi
66 } // end namespace llvm
68 #endif // LLVM_TEXTAPI_ELF_ELFSTUB_H