File indexing completed on 2026-05-10 08:43:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_INTERFACESTUB_IFSSTUB_H
0015 #define LLVM_INTERFACESTUB_IFSSTUB_H
0016
0017 #include "llvm/Support/VersionTuple.h"
0018 #include <optional>
0019 #include <vector>
0020
0021 namespace llvm {
0022 namespace ifs {
0023
0024 typedef uint16_t IFSArch;
0025
0026 enum class IFSSymbolType {
0027 NoType,
0028 Object,
0029 Func,
0030 TLS,
0031
0032
0033 Unknown = 16,
0034 };
0035
0036 enum class IFSEndiannessType {
0037 Little,
0038 Big,
0039
0040
0041 Unknown = 256,
0042 };
0043
0044 enum class IFSBitWidthType {
0045 IFS32,
0046 IFS64,
0047
0048
0049 Unknown = 256,
0050 };
0051
0052 struct IFSSymbol {
0053 IFSSymbol() = default;
0054 explicit IFSSymbol(std::string SymbolName) : Name(std::move(SymbolName)) {}
0055 std::string Name;
0056 std::optional<uint64_t> Size;
0057 IFSSymbolType Type = IFSSymbolType::NoType;
0058 bool Undefined = false;
0059 bool Weak = false;
0060 std::optional<std::string> Warning;
0061 bool operator<(const IFSSymbol &RHS) const { return Name < RHS.Name; }
0062 };
0063
0064 struct IFSTarget {
0065 std::optional<std::string> Triple;
0066 std::optional<std::string> ObjectFormat;
0067 std::optional<IFSArch> Arch;
0068 std::optional<std::string> ArchString;
0069 std::optional<IFSEndiannessType> Endianness;
0070 std::optional<IFSBitWidthType> BitWidth;
0071
0072 bool empty();
0073 };
0074
0075 inline bool operator==(const IFSTarget &Lhs, const IFSTarget &Rhs) {
0076 if (Lhs.Arch != Rhs.Arch || Lhs.BitWidth != Rhs.BitWidth ||
0077 Lhs.Endianness != Rhs.Endianness ||
0078 Lhs.ObjectFormat != Rhs.ObjectFormat || Lhs.Triple != Rhs.Triple)
0079 return false;
0080 return true;
0081 }
0082
0083 inline bool operator!=(const IFSTarget &Lhs, const IFSTarget &Rhs) {
0084 return !(Lhs == Rhs);
0085 }
0086
0087
0088
0089 struct IFSStub {
0090
0091 VersionTuple IfsVersion;
0092 std::optional<std::string> SoName;
0093 IFSTarget Target;
0094 std::vector<std::string> NeededLibs;
0095 std::vector<IFSSymbol> Symbols;
0096
0097 IFSStub() = default;
0098 IFSStub(const IFSStub &Stub);
0099 IFSStub(IFSStub &&Stub);
0100 virtual ~IFSStub() = default;
0101 };
0102
0103
0104
0105
0106
0107
0108 struct IFSStubTriple : IFSStub {
0109 IFSStubTriple() = default;
0110 IFSStubTriple(const IFSStub &Stub);
0111 IFSStubTriple(const IFSStubTriple &Stub);
0112 IFSStubTriple(IFSStubTriple &&Stub);
0113 };
0114
0115
0116
0117
0118
0119 uint8_t convertIFSBitWidthToELF(IFSBitWidthType BitWidth);
0120
0121
0122
0123
0124
0125 uint8_t convertIFSEndiannessToELF(IFSEndiannessType Endianness);
0126
0127
0128
0129
0130
0131 uint8_t convertIFSSymbolTypeToELF(IFSSymbolType SymbolType);
0132
0133
0134
0135
0136
0137
0138 IFSBitWidthType convertELFBitWidthToIFS(uint8_t BitWidth);
0139
0140
0141
0142
0143
0144
0145 IFSEndiannessType convertELFEndiannessToIFS(uint8_t Endianness);
0146
0147
0148
0149
0150
0151
0152
0153 IFSSymbolType convertELFSymbolTypeToIFS(uint8_t SymbolType);
0154 }
0155 }
0156
0157 #endif