29 #ifndef COFFI_RELOCATION_HPP
30 #define COFFI_RELOCATION_HPP
49 : stn_{stn}, sym_{sym}, arch_{arch}
54 COFFI_GET_SET_ACCESS(uint32_t, virtual_address);
55 COFFI_GET_ACCESS(uint32_t, symbol_table_index);
56 COFFI_GET_SET_ACCESS(uint32_t, type);
57 COFFI_GET_SET_ACCESS(uint16_t, reserved);
61 const std::string& get_symbol()
const {
return symbol_name; }
64 void set_symbol(uint32_t symbol_table_index)
66 header.symbol_table_index = symbol_table_index;
70 symbol_name = sym->get_name();
75 void load(std::istream& stream)
77 std::fill_n(
reinterpret_cast<char*
>(&header),
sizeof(header),
'\0');
83 stream.read((
char*)&(h),
sizeof(h));
84 header.virtual_address = h.virtual_address;
85 header.symbol_table_index = h.symbol_table_index;
87 header.reserved = h.reserved;
93 stream.read((
char*)&(h),
sizeof(h));
94 header.virtual_address = h.virtual_address;
95 header.symbol_table_index = h.symbol_table_index;
102 stream.read((
char*)&(h),
sizeof(h));
103 header.virtual_address = h.virtual_address;
104 header.symbol_table_index = h.symbol_table_index;
105 header.type = h.type;
110 set_symbol(get_symbol_table_index());
114 void save(std::ostream& stream)
120 h.virtual_address = header.virtual_address;
121 h.symbol_table_index = header.symbol_table_index;
122 h.type = header.type;
123 h.reserved = header.reserved;
124 stream.write((
char*)&(h),
sizeof(h));
130 h.virtual_address = header.virtual_address;
131 h.symbol_table_index = header.symbol_table_index;
132 h.type = header.type;
133 stream.write((
char*)&(h),
sizeof(h));
139 h.virtual_address = header.virtual_address;
140 h.symbol_table_index = header.symbol_table_index;
141 h.type = header.type;
142 stream.write((
char*)&(h),
sizeof(h));
149 uint32_t get_sizeof()
const
169 std::string symbol_name;
Interface for architecture information.
virtual coffi_architecture_t get_architecture() const =0
Returns the coffi object architecture.
Class for accessing a COFF section relocation entry.
Interface for accessing to the string table.
Interface for accessing to the symbol table.
virtual const symbol * get_symbol(uint32_t index) const =0
Gets a symbol from its index.
Class for accessing a COFF symbol.
COFFI library classes for the COFF symbols and symbol table.
@ COFFI_ARCHITECTURE_CEVA
CEVA Inc.
@ COFFI_ARCHITECTURE_TI
Texas Instruments.
Structure capable of storing all the architecture-specific relocation entry structures.
Texas Instruments relocation entry.