1 //===- ELFStub.h ------------------------------------------------*- C++ -*-===//
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
7 //===-----------------------------------------------------------------------===/
10 /// This file defines an internal representation of an ELF stub.
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"
25 typedef uint16_t ELFArch;
27 enum class ELFSymbolType {
28 NoType = ELF::STT_NOTYPE,
29 Object = ELF::STT_OBJECT,
33 // Type information is 4 bits, so 16 is safely out of range.
38 ELFSymbol(std::string SymbolName) : Name(SymbolName) {}
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.
53 // TODO: Add support for symbol versioning.
55 VersionTuple TbeVersion;
56 Optional<std::string> SoName;
58 std::vector<std::string> NeededLibs;
59 std::set<ELFSymbol> Symbols;
62 ELFStub(const ELFStub &Stub);
63 ELFStub(ELFStub &&Stub);
65 } // end namespace elfabi
66 } // end namespace llvm
68 #endif // LLVM_TEXTAPI_ELF_ELFSTUB_H