Loading...
Searching...
No Matches
Elf.h
Go to the documentation of this file.
#ifndef HALIDE_ELF_H
#define HALIDE_ELF_H
#include <algorithm>
#include <cstdint>
#include <iterator>
#include <list>
#include <memory>
#include <string>
#include <utility>
#include <vector>
namespace Halide {
namespace Internal {
namespace Elf {
// This ELF parser mostly deserializes the object into a graph
// structure in memory. It replaces indices into tables (sections,
// symbols, etc.) with a weakly referenced graph of pointers. The
// Object datastructure owns all of the objects. This namespace exists
// because it is very difficult to use LLVM's object parser to modify
// an object (it's fine for parsing only). This was built using
// http://www.skyfree.org/linux/references/ELF_Format.pdf as a reference
// for the ELF structs and constants.
class Object;
class Symbol;
class Section;
class Relocation;
// Helpful wrapper to allow range-based for loops.
template<typename T>
class iterator_range {
T b, e;
public:
iterator_range(T b, T e)
: b(b), e(e) {
}
T begin() const {
return b;
}
T end() const {
return e;
}
};
/** Describes a symbol */
class Symbol {
public:
enum Binding : uint8_t {
STB_LOCAL = 0,
STB_GLOBAL = 1,
STB_WEAK = 2,
STB_LOPROC = 13,
STB_HIPROC = 15,
};
enum Type : uint8_t {
STT_NOTYPE = 0,
STT_OBJECT = 1,
STT_FUNC = 2,
STT_SECTION = 3,
STT_FILE = 4,
STT_LOPROC = 13,
STT_HIPROC = 15,
};
enum Visibility : uint8_t {
STV_DEFAULT = 0,
STV_INTERNAL = 1,
STV_HIDDEN = 2,
STV_PROTECTED = 3,
};
private:
std::string name;
const Section *definition = nullptr;
uint64_t offset = 0;
uint32_t size = 0;
Binding binding = STB_LOCAL;
Type type = STT_NOTYPE;
Visibility visibility = STV_DEFAULT;
public:
Symbol() = default;
Symbol(const std::string &name)
: name(name) {
}
/** Accesses the name of this symbol. */
///@{
Symbol &set_name(const std::string &name) {
this->name = name;
return *this;
}
const std::string &get_name() const {
return name;
}
///@}
/** Accesses the type of this symbol. */
///@{
Symbol &set_type(Type type) {
this->type = type;
return *this;
}
Type get_type() const {
return type;
}
///@}
/** Accesses the properties that describe the definition of this symbol. */
///@{
Symbol &define(const Section *section, uint64_t offset, uint32_t size) {
this->definition = section;
this->offset = offset;
this->size = size;
return *this;
}
bool is_defined() const {
return definition != nullptr;
}
const Section *get_section() const {
return definition;
}
uint64_t get_offset() const {
return offset;
}
uint32_t get_size() const {
return size;
}
///@}
/** Access the binding and visibility of this symbol. See the ELF
* spec for more information about these properties. */
///@{
Symbol &set_binding(Binding binding) {
this->binding = binding;
return *this;
}
Symbol &set_visibility(Visibility visibility) {
this->visibility = visibility;
return *this;
}
Binding get_binding() const {
return binding;
}
Visibility get_visibility() const {
return visibility;
}
///@}
};
/** Describes a relocation to be applied to an offset of a section in
* an Object. */
class Relocation {
uint32_t type = 0;
uint64_t offset = 0;
int64_t addend = 0;
const Symbol *symbol = nullptr;
public:
Relocation() = default;
Relocation(uint32_t type, uint64_t offset, int64_t addend, const Symbol *symbol)
: type(type), offset(offset), addend(addend), symbol(symbol) {
}
/** The type of relocation to be applied. The meaning of this
* value depends on the machine of the object. */
///@{
Relocation &set_type(uint32_t type) {
this->type = type;
return *this;
}
uint32_t get_type() const {
return type;
}
///@}
/** Where to apply the relocation. This is relative to the section
* the relocation belongs to. */
///@{
Relocation &set_offset(uint64_t offset) {
this->offset = offset;
return *this;
}
uint64_t get_offset() const {
return offset;
}
///@}
/** The value to replace with the relocation is the address of the symbol plus the addend. */
///@{
Relocation &set_symbol(const Symbol *symbol) {
this->symbol = symbol;
return *this;
}
Relocation &set_addend(int64_t addend) {
this->addend = addend;
return *this;
}
const Symbol *get_symbol() const {
return symbol;
}
int64_t get_addend() const {
return addend;
}
///@}
};
/** Describes a section of an object file. */
class Section {
public:
enum Type : uint32_t {
SHT_NULL = 0,
SHT_PROGBITS = 1,
SHT_SYMTAB = 2,
SHT_STRTAB = 3,
SHT_RELA = 4,
SHT_HASH = 5,
SHT_DYNAMIC = 6,
SHT_NOTE = 7,
SHT_NOBITS = 8,
SHT_REL = 9,
SHT_SHLIB = 10,
SHT_DYNSYM = 11,
SHT_LOPROC = 0x70000000u,
SHT_HIPROC = 0x7fffffffu,
SHT_LOUSER = 0x80000000u,
SHT_HIUSER = 0xffffffffu,
};
enum Flag : uint32_t {
SHF_WRITE = 0x1,
SHF_ALLOC = 0x2,
SHF_EXECINSTR = 0x4,
SHF_MASKPROC = 0xf0000000u,
};
typedef std::vector<Relocation> RelocationList;
typedef RelocationList::iterator relocation_iterator;
typedef RelocationList::const_iterator const_relocation_iterator;
typedef std::vector<char>::iterator contents_iterator;
typedef std::vector<char>::const_iterator const_contents_iterator;
private:
std::string name;
Type type = SHT_NULL;
uint32_t flags = 0;
std::vector<char> contents;
// Sections may have a size larger than the contents.
uint64_t size = 0;
uint64_t alignment = 1;
RelocationList relocs;
public:
Section() = default;
Section(const std::string &name, Type type)
: name(name), type(type) {
}
Section &set_name(const std::string &name) {
this->name = name;
return *this;
}
const std::string &get_name() const {
return name;
}
Section &set_type(Type type) {
this->type = type;
return *this;
}
Type get_type() const {
return type;
}
Section &set_flag(Flag flag) {
this->flags |= flag;
return *this;
}
Section &remove_flag(Flag flag) {
this->flags &= ~flag;
return *this;
}
Section &set_flags(uint32_t flags) {
this->flags = flags;
return *this;
}
uint32_t get_flags() const {
return flags;
}
bool is_alloc() const {
return (flags & SHF_ALLOC) != 0;
}
bool is_writable() const {
return (flags & SHF_WRITE) != 0;
}
/** Get or set the size of the section. The size may be larger
* than the content. */
///@{
Section &set_size(uint64_t size) {
this->size = size;
return *this;
}
uint64_t get_size() const {
return std::max((uint64_t)size, (uint64_t)contents.size());
}
///@}
Section &set_alignment(uint64_t alignment) {
this->alignment = alignment;
return *this;
}
uint64_t get_alignment() const {
return alignment;
}
Section &set_contents(std::vector<char> contents) {
this->contents = std::move(contents);
return *this;
}
template<typename It>
Section &set_contents(It begin, It end) {
this->contents.assign(begin, end);
return *this;
}
template<typename It>
Section &append_contents(It begin, It end) {
this->contents.insert(this->contents.end(), begin, end);
return *this;
}
template<typename It>
Section &prepend_contents(It begin, It end) {
typedef typename std::iterator_traits<It>::value_type T;
uint64_t size_bytes = std::distance(begin, end) * sizeof(T);
this->contents.insert(this->contents.begin(), begin, end);
// When we add data to the start of the section, we need to fix up
// the offsets of the relocations linked to this section.
for (Relocation &r : relocations()) {
r.set_offset(r.get_offset() + size_bytes);
}
return *this;
}
/** Set, append or prepend an object to the contents, assuming T is a
* trivially copyable datatype. */
template<typename T>
Section &set_contents(const std::vector<T> &contents) {
this->contents.assign((const char *)contents.data(), (const char *)(contents.data() + contents.size()));
return *this;
}
template<typename T>
Section &append_contents(const T &x) {
return append_contents((const char *)&x, (const char *)(&x + 1));
}
template<typename T>
Section &prepend_contents(const T &x) {
return prepend_contents((const char *)&x, (const char *)(&x + 1));
}
const std::vector<char> &get_contents() const {
return contents;
}
contents_iterator contents_begin() {
return contents.begin();
}
contents_iterator contents_end() {
return contents.end();
}
const_contents_iterator contents_begin() const {
return contents.begin();
}
const_contents_iterator contents_end() const {
return contents.end();
}
const char *contents_data() const {
return contents.data();
}
size_t contents_size() const {
return contents.size();
}
bool contents_empty() const {
return contents.empty();
}
Section &set_relocations(std::vector<Relocation> relocs) {
this->relocs = std::move(relocs);
return *this;
}
template<typename It>
Section &set_relocations(It begin, It end) {
this->relocs.assign(begin, end);
return *this;
}
void add_relocation(const Relocation &reloc) {
relocs.push_back(reloc);
}
relocation_iterator relocations_begin() {
return relocs.begin();
}
relocation_iterator relocations_end() {
return relocs.end();
}
iterator_range<relocation_iterator> relocations() {
return {relocs.begin(), relocs.end()};
}
const_relocation_iterator relocations_begin() const {
return relocs.begin();
}
const_relocation_iterator relocations_end() const {
return relocs.end();
}
iterator_range<const_relocation_iterator> relocations() const {
return {relocs.begin(), relocs.end()};
}
size_t relocations_size() const {
return relocs.size();
}
};
/** Base class for a target architecture to implement the target
* specific aspects of linking. */
class Linker {
public:
virtual ~Linker() = default;
virtual uint16_t get_machine() = 0;
virtual uint32_t get_flags() = 0;
virtual uint32_t get_version() = 0;
virtual void append_dynamic(Section &dynamic) = 0;
/** Add or get an entry to the global offset table (GOT) with a
* relocation pointing to sym. */
virtual uint64_t get_got_entry(Section &got, const Symbol &sym) = 0;
/** Check to see if this relocation should go through the PLT. */
virtual bool needs_plt_entry(const Relocation &reloc) = 0;
/** Add a PLT entry for a symbol sym defined externally. Returns a
* symbol representing the PLT entry. */
virtual Symbol add_plt_entry(const Symbol &sym, Section &plt, Section &got,
const Symbol &got_sym) = 0;
/** Perform a relocation. This function may opt to not apply the
* relocation, and return a new relocation to be performed at
* runtime. This requires that the section to apply the relocation
* to is writable at runtime. */
virtual Relocation relocate(uint64_t fixup_offset, char *fixup_addr, uint64_t type,
const Symbol *sym, uint64_t sym_offset, int64_t addend,
Section &got) = 0;
};
/** Holds all of the relevant sections and symbols for an object. */
class Object {
public:
enum Type : uint16_t {
ET_NONE = 0,
ET_REL = 1,
ET_EXEC = 2,
ET_DYN = 3,
ET_CORE = 4,
ET_LOPROC = 0xff00u,
ET_HIPROC = 0xffffu,
};
// We use lists for sections and symbols to avoid iterator
// invalidation when we modify the containers.
typedef std::list<Section> SectionList;
typedef typename SectionList::iterator section_iterator;
typedef typename SectionList::const_iterator const_section_iterator;
typedef std::list<Symbol> SymbolList;
typedef typename SymbolList::iterator symbol_iterator;
typedef typename SymbolList::const_iterator const_symbol_iterator;
private:
SectionList secs;
SymbolList syms;
Type type = ET_NONE;
uint16_t machine = 0;
uint32_t version = 0;
uint64_t entry = 0;
uint32_t flags = 0;
Object(const Object &);
void operator=(const Object &);
public:
Object() = default;
Type get_type() const {
return type;
}
uint16_t get_machine() const {
return machine;
}
uint32_t get_version() const {
return version;
}
uint64_t get_entry() const {
return entry;
}
uint32_t get_flags() const {
return flags;
}
Object &set_type(Type type) {
this->type = type;
return *this;
}
Object &set_machine(uint16_t machine) {
this->machine = machine;
return *this;
}
Object &set_version(uint32_t version) {
this->version = version;
return *this;
}
Object &set_entry(uint64_t entry) {
this->entry = entry;
return *this;
}
Object &set_flags(uint32_t flags) {
this->flags = flags;
return *this;
}
/** Parse an object in memory to an Object. */
static std::unique_ptr<Object> parse_object(const char *data, size_t size);
/** Write a shared object in memory. */
std::vector<char> write_shared_object(Linker *linker, const std::vector<std::string> &depedencies = {},
const std::string &soname = "");
section_iterator sections_begin() {
return secs.begin();
}
section_iterator sections_end() {
return secs.end();
}
iterator_range<section_iterator> sections() {
return {secs.begin(), secs.end()};
}
const_section_iterator sections_begin() const {
return secs.begin();
}
const_section_iterator sections_end() const {
return secs.end();
}
iterator_range<const_section_iterator> sections() const {
return {secs.begin(), secs.end()};
}
size_t sections_size() const {
return secs.size();
}
section_iterator find_section(const std::string &name);
section_iterator add_section(const std::string &name, Section::Type type);
section_iterator add_relocation_section(const Section &for_section);
section_iterator erase_section(section_iterator i) {
return secs.erase(i);
}
section_iterator merge_sections(const std::vector<section_iterator> &sections);
section_iterator merge_text_sections();
symbol_iterator symbols_begin() {
return syms.begin();
}
symbol_iterator symbols_end() {
return syms.end();
}
iterator_range<symbol_iterator> symbols() {
return {syms.begin(), syms.end()};
}
const_symbol_iterator symbols_begin() const {
return syms.begin();
}
const_symbol_iterator symbols_end() const {
return syms.end();
}
iterator_range<const_symbol_iterator> symbols() const {
return {syms.begin(), syms.end()};
}
size_t symbols_size() const {
return syms.size();
}
symbol_iterator find_symbol(const std::string &name);
const_symbol_iterator find_symbol(const std::string &name) const;
symbol_iterator add_symbol(const std::string &name);
};
} // namespace Elf
} // namespace Internal
} // namespace Halide
#endif
Halide::Internal::Elf::Linker
Base class for a target architecture to implement the target specific aspects of linking.
Definition Elf.h:428
Halide::Internal::Elf::Linker::add_plt_entry
virtual Symbol add_plt_entry(const Symbol &sym, Section &plt, Section &got, const Symbol &got_sym)=0
Add a PLT entry for a symbol sym defined externally.
Halide::Internal::Elf::Linker::append_dynamic
virtual void append_dynamic(Section &dynamic)=0
Halide::Internal::Elf::Linker::needs_plt_entry
virtual bool needs_plt_entry(const Relocation &reloc)=0
Check to see if this relocation should go through the PLT.
Halide::Internal::Elf::Linker::get_flags
virtual uint32_t get_flags()=0
Halide::Internal::Elf::Linker::~Linker
virtual ~Linker()=default
Halide::Internal::Elf::Linker::get_version
virtual uint32_t get_version()=0
Halide::Internal::Elf::Linker::get_got_entry
virtual uint64_t get_got_entry(Section &got, const Symbol &sym)=0
Add or get an entry to the global offset table (GOT) with a relocation pointing to sym.
Halide::Internal::Elf::Linker::get_machine
virtual uint16_t get_machine()=0
Halide::Internal::Elf::Linker::relocate
virtual Relocation relocate(uint64_t fixup_offset, char *fixup_addr, uint64_t type, const Symbol *sym, uint64_t sym_offset, int64_t addend, Section &got)=0
Perform a relocation.
Halide::Internal::Elf::Object
Holds all of the relevant sections and symbols for an object.
Definition Elf.h:459
Halide::Internal::Elf::Object::get_machine
uint16_t get_machine() const
Definition Elf.h:500
Halide::Internal::Elf::Object::symbols_end
symbol_iterator symbols_end()
Definition Elf.h:576
Halide::Internal::Elf::Object::Type
Type
Definition Elf.h:461
Halide::Internal::Elf::Object::ET_CORE
@ ET_CORE
Definition Elf.h:466
Halide::Internal::Elf::Object::ET_NONE
@ ET_NONE
Definition Elf.h:462
Halide::Internal::Elf::Object::ET_REL
@ ET_REL
Definition Elf.h:463
Halide::Internal::Elf::Object::ET_DYN
@ ET_DYN
Definition Elf.h:465
Halide::Internal::Elf::Object::ET_EXEC
@ ET_EXEC
Definition Elf.h:464
Halide::Internal::Elf::Object::ET_HIPROC
@ ET_HIPROC
Definition Elf.h:468
Halide::Internal::Elf::Object::ET_LOPROC
@ ET_LOPROC
Definition Elf.h:467
Halide::Internal::Elf::Object::erase_section
section_iterator erase_section(section_iterator i)
Definition Elf.h:566
Halide::Internal::Elf::Object::set_type
Object & set_type(Type type)
Definition Elf.h:513
Halide::Internal::Elf::Object::find_symbol
symbol_iterator find_symbol(const std::string &name)
Halide::Internal::Elf::Object::set_flags
Object & set_flags(uint32_t flags)
Definition Elf.h:529
Halide::Internal::Elf::Object::sections_begin
const_section_iterator sections_begin() const
Definition Elf.h:550
Halide::Internal::Elf::Object::sections_end
section_iterator sections_end()
Definition Elf.h:544
Halide::Internal::Elf::Object::parse_object
static std::unique_ptr< Object > parse_object(const char *data, size_t size)
Parse an object in memory to an Object.
Halide::Internal::Elf::Object::const_symbol_iterator
SymbolList::const_iterator const_symbol_iterator
Definition Elf.h:479
Halide::Internal::Elf::Object::sections
iterator_range< const_section_iterator > sections() const
Definition Elf.h:556
Halide::Internal::Elf::Object::set_entry
Object & set_entry(uint64_t entry)
Definition Elf.h:525
Halide::Internal::Elf::Object::find_section
section_iterator find_section(const std::string &name)
Halide::Internal::Elf::Object::write_shared_object
std::vector< char > write_shared_object(Linker *linker, const std::vector< std::string > &depedencies={}, const std::string &soname="")
Write a shared object in memory.
Halide::Internal::Elf::Object::sections
iterator_range< section_iterator > sections()
Definition Elf.h:547
Halide::Internal::Elf::Object::symbols
iterator_range< symbol_iterator > symbols()
Definition Elf.h:579
Halide::Internal::Elf::Object::add_section
section_iterator add_section(const std::string &name, Section::Type type)
Halide::Internal::Elf::Object::get_flags
uint32_t get_flags() const
Definition Elf.h:509
Halide::Internal::Elf::Object::set_machine
Object & set_machine(uint16_t machine)
Definition Elf.h:517
Halide::Internal::Elf::Object::symbol_iterator
SymbolList::iterator symbol_iterator
Definition Elf.h:478
Halide::Internal::Elf::Object::get_type
Type get_type() const
Definition Elf.h:497
Halide::Internal::Elf::Object::Object
Object()=default
Halide::Internal::Elf::Object::find_symbol
const_symbol_iterator find_symbol(const std::string &name) const
Halide::Internal::Elf::Object::sections_end
const_section_iterator sections_end() const
Definition Elf.h:553
Halide::Internal::Elf::Object::const_section_iterator
SectionList::const_iterator const_section_iterator
Definition Elf.h:475
Halide::Internal::Elf::Object::symbols_begin
const_symbol_iterator symbols_begin() const
Definition Elf.h:582
Halide::Internal::Elf::Object::set_version
Object & set_version(uint32_t version)
Definition Elf.h:521
Halide::Internal::Elf::Object::add_relocation_section
section_iterator add_relocation_section(const Section &for_section)
Halide::Internal::Elf::Object::symbols_size
size_t symbols_size() const
Definition Elf.h:591
Halide::Internal::Elf::Object::merge_text_sections
section_iterator merge_text_sections()
Halide::Internal::Elf::Object::get_entry
uint64_t get_entry() const
Definition Elf.h:506
Halide::Internal::Elf::Object::merge_sections
section_iterator merge_sections(const std::vector< section_iterator > &sections)
Halide::Internal::Elf::Object::symbols_end
const_symbol_iterator symbols_end() const
Definition Elf.h:585
Halide::Internal::Elf::Object::SymbolList
std::list< Symbol > SymbolList
Definition Elf.h:477
Halide::Internal::Elf::Object::add_symbol
symbol_iterator add_symbol(const std::string &name)
Halide::Internal::Elf::Object::symbols_begin
symbol_iterator symbols_begin()
Definition Elf.h:573
Halide::Internal::Elf::Object::sections_size
size_t sections_size() const
Definition Elf.h:559
Halide::Internal::Elf::Object::get_version
uint32_t get_version() const
Definition Elf.h:503
Halide::Internal::Elf::Object::sections_begin
section_iterator sections_begin()
Definition Elf.h:541
Halide::Internal::Elf::Object::section_iterator
SectionList::iterator section_iterator
Definition Elf.h:474
Halide::Internal::Elf::Object::symbols
iterator_range< const_symbol_iterator > symbols() const
Definition Elf.h:588
Halide::Internal::Elf::Object::SectionList
std::list< Section > SectionList
Definition Elf.h:473
Halide::Internal::Elf::Relocation
Describes a relocation to be applied to an offset of a section in an Object.
Definition Elf.h:158
Halide::Internal::Elf::Relocation::get_addend
int64_t get_addend() const
The value to replace with the relocation is the address of the symbol plus the addend.
Definition Elf.h:207
Halide::Internal::Elf::Relocation::Relocation
Relocation(uint32_t type, uint64_t offset, int64_t addend, const Symbol *symbol)
Definition Elf.h:166
Halide::Internal::Elf::Relocation::Relocation
Relocation()=default
Halide::Internal::Elf::Relocation::set_symbol
Relocation & set_symbol(const Symbol *symbol)
The value to replace with the relocation is the address of the symbol plus the addend.
Definition Elf.h:196
Halide::Internal::Elf::Relocation::set_type
Relocation & set_type(uint32_t type)
The type of relocation to be applied.
Definition Elf.h:173
Halide::Internal::Elf::Relocation::set_addend
Relocation & set_addend(int64_t addend)
The value to replace with the relocation is the address of the symbol plus the addend.
Definition Elf.h:200
Halide::Internal::Elf::Relocation::get_offset
uint64_t get_offset() const
Where to apply the relocation.
Definition Elf.h:189
Halide::Internal::Elf::Relocation::set_offset
Relocation & set_offset(uint64_t offset)
Where to apply the relocation.
Definition Elf.h:185
Halide::Internal::Elf::Relocation::get_symbol
const Symbol * get_symbol() const
The value to replace with the relocation is the address of the symbol plus the addend.
Definition Elf.h:204
Halide::Internal::Elf::Relocation::get_type
uint32_t get_type() const
The type of relocation to be applied.
Definition Elf.h:177
Halide::Internal::Elf::Section
Describes a section of an object file.
Definition Elf.h:214
Halide::Internal::Elf::Section::Flag
Flag
Definition Elf.h:235
Halide::Internal::Elf::Section::SHF_MASKPROC
@ SHF_MASKPROC
Definition Elf.h:239
Halide::Internal::Elf::Section::SHF_EXECINSTR
@ SHF_EXECINSTR
Definition Elf.h:238
Halide::Internal::Elf::Section::SHF_WRITE
@ SHF_WRITE
Definition Elf.h:236
Halide::Internal::Elf::Section::SHF_ALLOC
@ SHF_ALLOC
Definition Elf.h:237
Halide::Internal::Elf::Section::contents_empty
bool contents_empty() const
Definition Elf.h:387
Halide::Internal::Elf::Section::prepend_contents
Section & prepend_contents(It begin, It end)
Definition Elf.h:338
Halide::Internal::Elf::Section::relocations_size
size_t relocations_size() const
Definition Elf.h:421
Halide::Internal::Elf::Section::append_contents
Section & append_contents(It begin, It end)
Definition Elf.h:333
Halide::Internal::Elf::Section::get_alignment
uint64_t get_alignment() const
Definition Elf.h:319
Halide::Internal::Elf::Section::Section
Section()=default
Halide::Internal::Elf::Section::contents_size
size_t contents_size() const
Definition Elf.h:384
Halide::Internal::Elf::Section::set_contents
Section & set_contents(const std::vector< T > &contents)
Set, append or prepend an object to the contents, assuming T is a trivially copyable datatype.
Definition Elf.h:354
Halide::Internal::Elf::Section::relocations_end
relocation_iterator relocations_end()
Definition Elf.h:406
Halide::Internal::Elf::Section::get_flags
uint32_t get_flags() const
Definition Elf.h:293
Halide::Internal::Elf::Section::set_relocations
Section & set_relocations(std::vector< Relocation > relocs)
Definition Elf.h:391
Halide::Internal::Elf::Section::set_contents
Section & set_contents(std::vector< char > contents)
Definition Elf.h:323
Halide::Internal::Elf::Section::get_size
uint64_t get_size() const
Get or set the size of the section.
Definition Elf.h:310
Halide::Internal::Elf::Section::set_flags
Section & set_flags(uint32_t flags)
Definition Elf.h:289
Halide::Internal::Elf::Section::contents_iterator
std::vector< char >::iterator contents_iterator
Definition Elf.h:246
Halide::Internal::Elf::Section::relocations_begin
relocation_iterator relocations_begin()
Definition Elf.h:403
Halide::Internal::Elf::Section::add_relocation
void add_relocation(const Relocation &reloc)
Definition Elf.h:400
Halide::Internal::Elf::Section::get_contents
const std::vector< char > & get_contents() const
Definition Elf.h:366
Halide::Internal::Elf::Section::relocation_iterator
RelocationList::iterator relocation_iterator
Definition Elf.h:243
Halide::Internal::Elf::Section::const_relocation_iterator
RelocationList::const_iterator const_relocation_iterator
Definition Elf.h:244
Halide::Internal::Elf::Section::set_contents
Section & set_contents(It begin, It end)
Definition Elf.h:328
Halide::Internal::Elf::Section::contents_begin
const_contents_iterator contents_begin() const
Definition Elf.h:375
Halide::Internal::Elf::Section::set_size
Section & set_size(uint64_t size)
Get or set the size of the section.
Definition Elf.h:306
Halide::Internal::Elf::Section::contents_begin
contents_iterator contents_begin()
Definition Elf.h:369
Halide::Internal::Elf::Section::get_name
const std::string & get_name() const
Definition Elf.h:269
Halide::Internal::Elf::Section::contents_end
contents_iterator contents_end()
Definition Elf.h:372
Halide::Internal::Elf::Section::relocations_begin
const_relocation_iterator relocations_begin() const
Definition Elf.h:412
Halide::Internal::Elf::Section::relocations
iterator_range< relocation_iterator > relocations()
Definition Elf.h:409
Halide::Internal::Elf::Section::set_type
Section & set_type(Type type)
Definition Elf.h:273
Halide::Internal::Elf::Section::const_contents_iterator
std::vector< char >::const_iterator const_contents_iterator
Definition Elf.h:247
Halide::Internal::Elf::Section::remove_flag
Section & remove_flag(Flag flag)
Definition Elf.h:285
Halide::Internal::Elf::Section::append_contents
Section & append_contents(const T &x)
Definition Elf.h:359
Halide::Internal::Elf::Section::Section
Section(const std::string &name, Type type)
Definition Elf.h:261
Halide::Internal::Elf::Section::set_flag
Section & set_flag(Flag flag)
Definition Elf.h:281
Halide::Internal::Elf::Section::set_name
Section & set_name(const std::string &name)
Definition Elf.h:265
Halide::Internal::Elf::Section::get_type
Type get_type() const
Definition Elf.h:277
Halide::Internal::Elf::Section::RelocationList
std::vector< Relocation > RelocationList
Definition Elf.h:242
Halide::Internal::Elf::Section::is_writable
bool is_writable() const
Definition Elf.h:299
Halide::Internal::Elf::Section::is_alloc
bool is_alloc() const
Definition Elf.h:296
Halide::Internal::Elf::Section::prepend_contents
Section & prepend_contents(const T &x)
Definition Elf.h:363
Halide::Internal::Elf::Section::contents_end
const_contents_iterator contents_end() const
Definition Elf.h:378
Halide::Internal::Elf::Section::set_relocations
Section & set_relocations(It begin, It end)
Definition Elf.h:396
Halide::Internal::Elf::Section::relocations_end
const_relocation_iterator relocations_end() const
Definition Elf.h:415
Halide::Internal::Elf::Section::relocations
iterator_range< const_relocation_iterator > relocations() const
Definition Elf.h:418
Halide::Internal::Elf::Section::contents_data
const char * contents_data() const
Definition Elf.h:381
Halide::Internal::Elf::Section::Type
Type
Definition Elf.h:216
Halide::Internal::Elf::Section::SHT_NULL
@ SHT_NULL
Definition Elf.h:217
Halide::Internal::Elf::Section::SHT_STRTAB
@ SHT_STRTAB
Definition Elf.h:220
Halide::Internal::Elf::Section::SHT_NOTE
@ SHT_NOTE
Definition Elf.h:224
Halide::Internal::Elf::Section::SHT_SHLIB
@ SHT_SHLIB
Definition Elf.h:227
Halide::Internal::Elf::Section::SHT_DYNAMIC
@ SHT_DYNAMIC
Definition Elf.h:223
Halide::Internal::Elf::Section::SHT_HIUSER
@ SHT_HIUSER
Definition Elf.h:232
Halide::Internal::Elf::Section::SHT_NOBITS
@ SHT_NOBITS
Definition Elf.h:225
Halide::Internal::Elf::Section::SHT_LOPROC
@ SHT_LOPROC
Definition Elf.h:229
Halide::Internal::Elf::Section::SHT_PROGBITS
@ SHT_PROGBITS
Definition Elf.h:218
Halide::Internal::Elf::Section::SHT_SYMTAB
@ SHT_SYMTAB
Definition Elf.h:219
Halide::Internal::Elf::Section::SHT_REL
@ SHT_REL
Definition Elf.h:226
Halide::Internal::Elf::Section::SHT_HASH
@ SHT_HASH
Definition Elf.h:222
Halide::Internal::Elf::Section::SHT_RELA
@ SHT_RELA
Definition Elf.h:221
Halide::Internal::Elf::Section::SHT_LOUSER
@ SHT_LOUSER
Definition Elf.h:231
Halide::Internal::Elf::Section::SHT_HIPROC
@ SHT_HIPROC
Definition Elf.h:230
Halide::Internal::Elf::Section::SHT_DYNSYM
@ SHT_DYNSYM
Definition Elf.h:228
Halide::Internal::Elf::Section::set_alignment
Section & set_alignment(uint64_t alignment)
Definition Elf.h:315
Halide::Internal::Elf::Symbol
Describes a symbol.
Definition Elf.h:50
Halide::Internal::Elf::Symbol::Symbol
Symbol(const std::string &name)
Definition Elf.h:88
Halide::Internal::Elf::Symbol::get_offset
uint64_t get_offset() const
Accesses the properties that describe the definition of this symbol.
Definition Elf.h:128
Halide::Internal::Elf::Symbol::Symbol
Symbol()=default
Halide::Internal::Elf::Symbol::get_section
const Section * get_section() const
Accesses the properties that describe the definition of this symbol.
Definition Elf.h:125
Halide::Internal::Elf::Symbol::get_visibility
Visibility get_visibility() const
Access the binding and visibility of this symbol.
Definition Elf.h:150
Halide::Internal::Elf::Symbol::get_type
Type get_type() const
Accesses the type of this symbol.
Definition Elf.h:109
Halide::Internal::Elf::Symbol::set_visibility
Symbol & set_visibility(Visibility visibility)
Access the binding and visibility of this symbol.
Definition Elf.h:143
Halide::Internal::Elf::Symbol::Visibility
Visibility
Definition Elf.h:70
Halide::Internal::Elf::Symbol::STV_HIDDEN
@ STV_HIDDEN
Definition Elf.h:73
Halide::Internal::Elf::Symbol::STV_INTERNAL
@ STV_INTERNAL
Definition Elf.h:72
Halide::Internal::Elf::Symbol::STV_DEFAULT
@ STV_DEFAULT
Definition Elf.h:71
Halide::Internal::Elf::Symbol::STV_PROTECTED
@ STV_PROTECTED
Definition Elf.h:74
Halide::Internal::Elf::Symbol::define
Symbol & define(const Section *section, uint64_t offset, uint32_t size)
Accesses the properties that describe the definition of this symbol.
Definition Elf.h:116
Halide::Internal::Elf::Symbol::set_type
Symbol & set_type(Type type)
Accesses the type of this symbol.
Definition Elf.h:105
Halide::Internal::Elf::Symbol::is_defined
bool is_defined() const
Accesses the properties that describe the definition of this symbol.
Definition Elf.h:122
Halide::Internal::Elf::Symbol::set_name
Symbol & set_name(const std::string &name)
Accesses the name of this symbol.
Definition Elf.h:94
Halide::Internal::Elf::Symbol::Binding
Binding
Definition Elf.h:52
Halide::Internal::Elf::Symbol::STB_LOPROC
@ STB_LOPROC
Definition Elf.h:56
Halide::Internal::Elf::Symbol::STB_LOCAL
@ STB_LOCAL
Definition Elf.h:53
Halide::Internal::Elf::Symbol::STB_HIPROC
@ STB_HIPROC
Definition Elf.h:57
Halide::Internal::Elf::Symbol::STB_GLOBAL
@ STB_GLOBAL
Definition Elf.h:54
Halide::Internal::Elf::Symbol::STB_WEAK
@ STB_WEAK
Definition Elf.h:55
Halide::Internal::Elf::Symbol::set_binding
Symbol & set_binding(Binding binding)
Access the binding and visibility of this symbol.
Definition Elf.h:139
Halide::Internal::Elf::Symbol::get_name
const std::string & get_name() const
Accesses the name of this symbol.
Definition Elf.h:98
Halide::Internal::Elf::Symbol::Type
Type
Definition Elf.h:60
Halide::Internal::Elf::Symbol::STT_SECTION
@ STT_SECTION
Definition Elf.h:64
Halide::Internal::Elf::Symbol::STT_HIPROC
@ STT_HIPROC
Definition Elf.h:67
Halide::Internal::Elf::Symbol::STT_OBJECT
@ STT_OBJECT
Definition Elf.h:62
Halide::Internal::Elf::Symbol::STT_NOTYPE
@ STT_NOTYPE
Definition Elf.h:61
Halide::Internal::Elf::Symbol::STT_LOPROC
@ STT_LOPROC
Definition Elf.h:66
Halide::Internal::Elf::Symbol::STT_FUNC
@ STT_FUNC
Definition Elf.h:63
Halide::Internal::Elf::Symbol::STT_FILE
@ STT_FILE
Definition Elf.h:65
Halide::Internal::Elf::Symbol::get_size
uint32_t get_size() const
Accesses the properties that describe the definition of this symbol.
Definition Elf.h:131
Halide::Internal::Elf::Symbol::get_binding
Binding get_binding() const
Access the binding and visibility of this symbol.
Definition Elf.h:147
Halide::Internal::Elf::iterator_range
Definition Elf.h:33
Halide::Internal::Elf::iterator_range::begin
T begin() const
Definition Elf.h:41
Halide::Internal::Elf::iterator_range::iterator_range
iterator_range(T b, T e)
Definition Elf.h:37
Halide::Internal::Elf::iterator_range::end
T end() const
Definition Elf.h:44
Halide::Internal::Elf
Definition Elf.h:15
Halide::Internal
Definition AbstractGenerator.h:24
Halide::Internal::begin
auto begin(reverse_adaptor< T > i)
Definition Util.h:471
Halide::Internal::end
auto end(reverse_adaptor< T > i)
Definition Util.h:476
Halide
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
Definition AbstractGenerator.h:19
uint64_t
unsigned __INT64_TYPE__ uint64_t
Definition runtime_internal.h:23
int64_t
signed __INT64_TYPE__ int64_t
Definition runtime_internal.h:22
uint8_t
unsigned __INT8_TYPE__ uint8_t
Definition runtime_internal.h:29
uint16_t
unsigned __INT16_TYPE__ uint16_t
Definition runtime_internal.h:27
uint32_t
unsigned __INT32_TYPE__ uint32_t
Definition runtime_internal.h:25
Halide::Type
Types in the halide type system.
Definition Type.h:283