LLVM  8.0.1
ELFStub.h
Go to the documentation of this file.
1 //===- ELFStub.h ------------------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===-----------------------------------------------------------------------===/
9 ///
10 /// \file
11 /// This file defines an internal representation of an ELF stub.
12 ///
13 //===-----------------------------------------------------------------------===/
14 
15 #ifndef LLVM_TEXTAPI_ELF_ELFSTUB_H
16 #define LLVM_TEXTAPI_ELF_ELFSTUB_H
17 
18 #include "llvm/BinaryFormat/ELF.h"
20 #include <vector>
21 #include <set>
22 
23 namespace llvm {
24 namespace elfabi {
25 
26 typedef uint16_t ELFArch;
27 
28 enum class ELFSymbolType {
32  TLS = ELF::STT_TLS,
33 
34  // Type information is 4 bits, so 16 is safely out of range.
35  Unknown = 16,
36 };
37 
38 struct ELFSymbol {
39  ELFSymbol(std::string SymbolName) : Name(SymbolName) {}
40  std::string Name;
41  uint64_t Size;
43  bool Undefined;
44  bool Weak;
46  bool operator<(const ELFSymbol &RHS) const {
47  return Name < RHS.Name;
48  }
49 };
50 
51 // A cumulative representation of ELF stubs.
52 // Both textual and binary stubs will read into and write from this object.
53 class ELFStub {
54 // TODO: Add support for symbol versioning.
55 public:
58  ELFArch Arch;
59  std::vector<std::string> NeededLibs;
60  std::set<ELFSymbol> Symbols;
61 
62  ELFStub() {}
63  ELFStub(const ELFStub &Stub);
64  ELFStub(ELFStub &&Stub);
65 };
66 } // end namespace elfabi
67 } // end namespace llvm
68 
69 #endif // LLVM_TEXTAPI_ELF_ELFSTUB_H
std::set< ELFSymbol > Symbols
Definition: ELFStub.h:60
This class represents lattice values for constants.
Definition: AllocatorList.h:24
std::string Name
Definition: ELFStub.h:40
amdgpu Simplify well known AMD library false Value Value const Twine & Name
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
Optional< std::string > Warning
Definition: ELFStub.h:45
Optional< std::string > SoName
Definition: ELFStub.h:57
bool operator<(const ELFSymbol &RHS) const
Definition: ELFStub.h:46
std::vector< std::string > NeededLibs
Definition: ELFStub.h:59
ELFSymbolType Type
Definition: ELFStub.h:42
uint16_t ELFArch
Definition: ELFStub.h:26
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:27
ELFSymbol(std::string SymbolName)
Definition: ELFStub.h:39
Defines the llvm::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
VersionTuple TbeVersion
Definition: ELFStub.h:56