LLVM  10.0.0svn
ELFStub.h
Go to the documentation of this file.
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 //===-----------------------------------------------------------------------===/
13 
14 #ifndef LLVM_TEXTAPI_ELF_ELFSTUB_H
15 #define LLVM_TEXTAPI_ELF_ELFSTUB_H
16 
17 #include "llvm/BinaryFormat/ELF.h"
19 #include <vector>
20 #include <set>
21 
22 namespace llvm {
23 namespace elfabi {
24 
25 typedef uint16_t ELFArch;
26 
27 enum class ELFSymbolType {
31  TLS = ELF::STT_TLS,
32 
33  // Type information is 4 bits, so 16 is safely out of range.
34  Unknown = 16,
35 };
36 
37 struct ELFSymbol {
38  ELFSymbol(std::string SymbolName) : Name(SymbolName) {}
39  std::string Name;
40  uint64_t Size;
42  bool Undefined;
43  bool Weak;
45  bool operator<(const ELFSymbol &RHS) const {
46  return Name < RHS.Name;
47  }
48 };
49 
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:
57  ELFArch Arch;
58  std::vector<std::string> NeededLibs;
59  std::set<ELFSymbol> Symbols;
60 
61  ELFStub() {}
62  ELFStub(const ELFStub &Stub);
63  ELFStub(ELFStub &&Stub);
64 };
65 } // end namespace elfabi
66 } // end namespace llvm
67 
68 #endif // LLVM_TEXTAPI_ELF_ELFSTUB_H
std::set< ELFSymbol > Symbols
Definition: ELFStub.h:59
This class represents lattice values for constants.
Definition: AllocatorList.h:23
std::string Name
Definition: ELFStub.h:39
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
Optional< std::string > Warning
Definition: ELFStub.h:44
Optional< std::string > SoName
Definition: ELFStub.h:56
bool operator<(const ELFSymbol &RHS) const
Definition: ELFStub.h:45
std::vector< std::string > NeededLibs
Definition: ELFStub.h:58
ELFSymbolType Type
Definition: ELFStub.h:41
uint16_t ELFArch
Definition: ELFStub.h:25
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:26
ELFSymbol(std::string SymbolName)
Definition: ELFStub.h:38
Defines the llvm::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
VersionTuple TbeVersion
Definition: ELFStub.h:55