Files
archived-llvm/include/llvm/TextAPI/ELF/ELFStub.h
Chandler Carruth 6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00

69 lines
1.7 KiB
C++

//===- ELFStub.h ------------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===-----------------------------------------------------------------------===/
///
/// \file
/// This file defines an internal representation of an ELF stub.
///
//===-----------------------------------------------------------------------===/
#ifndef LLVM_TEXTAPI_ELF_ELFSTUB_H
#define LLVM_TEXTAPI_ELF_ELFSTUB_H
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/VersionTuple.h"
#include <vector>
#include <set>
namespace llvm {
namespace elfabi {
typedef uint16_t ELFArch;
enum class ELFSymbolType {
NoType = ELF::STT_NOTYPE,
Object = ELF::STT_OBJECT,
Func = ELF::STT_FUNC,
TLS = ELF::STT_TLS,
// Type information is 4 bits, so 16 is safely out of range.
Unknown = 16,
};
struct ELFSymbol {
ELFSymbol(std::string SymbolName) : Name(SymbolName) {}
std::string Name;
uint64_t Size;
ELFSymbolType Type;
bool Undefined;
bool Weak;
Optional<std::string> Warning;
bool operator<(const ELFSymbol &RHS) const {
return Name < RHS.Name;
}
};
// A cumulative representation of ELF stubs.
// Both textual and binary stubs will read into and write from this object.
class ELFStub {
// TODO: Add support for symbol versioning.
public:
VersionTuple TbeVersion;
Optional<std::string> SoName;
ELFArch Arch;
std::vector<std::string> NeededLibs;
std::set<ELFSymbol> Symbols;
ELFStub() {}
ELFStub(const ELFStub &Stub);
ELFStub(ELFStub &&Stub);
};
} // end namespace elfabi
} // end namespace llvm
#endif // LLVM_TEXTAPI_ELF_ELFSTUB_H