mirror of
https://github.com/serge1/ELFIO.git
synced 2024-12-26 09:14:29 +00:00
Just formatting
This commit is contained in:
parent
bb572fb848
commit
41f4012d49
@ -820,22 +820,22 @@ constexpr unsigned R_386_GOT32X = 43;
|
|||||||
constexpr unsigned R_X86_64_GNU_VTINHERIT = 250;
|
constexpr unsigned R_X86_64_GNU_VTINHERIT = 250;
|
||||||
constexpr unsigned R_X86_64_GNU_VTENTRY = 251;
|
constexpr unsigned R_X86_64_GNU_VTENTRY = 251;
|
||||||
// Arm
|
// Arm
|
||||||
constexpr unsigned R_ARM_NONE = 0;
|
constexpr unsigned R_ARM_NONE = 0;
|
||||||
constexpr unsigned R_ARM_PC24 = 1;
|
constexpr unsigned R_ARM_PC24 = 1;
|
||||||
constexpr unsigned R_ARM_ABS32 = 2;
|
constexpr unsigned R_ARM_ABS32 = 2;
|
||||||
constexpr unsigned R_ARM_REL32 = 3;
|
constexpr unsigned R_ARM_REL32 = 3;
|
||||||
constexpr unsigned R_ARM_CALL = 28;
|
constexpr unsigned R_ARM_CALL = 28;
|
||||||
constexpr unsigned R_ARM_JUMP24 = 29;
|
constexpr unsigned R_ARM_JUMP24 = 29;
|
||||||
constexpr unsigned R_ARM_TARGET1 = 38;
|
constexpr unsigned R_ARM_TARGET1 = 38;
|
||||||
constexpr unsigned R_ARM_V4BX = 40;
|
constexpr unsigned R_ARM_V4BX = 40;
|
||||||
constexpr unsigned R_ARM_PREL31 = 42;
|
constexpr unsigned R_ARM_PREL31 = 42;
|
||||||
constexpr unsigned R_ARM_MOVW_ABS_NC = 43;
|
constexpr unsigned R_ARM_MOVW_ABS_NC = 43;
|
||||||
constexpr unsigned R_ARM_MOVT_ABS = 44;
|
constexpr unsigned R_ARM_MOVT_ABS = 44;
|
||||||
constexpr unsigned R_ARM_MOVW_PREL_NC = 45;
|
constexpr unsigned R_ARM_MOVW_PREL_NC = 45;
|
||||||
constexpr unsigned R_ARM_MOVT_PREL = 46;
|
constexpr unsigned R_ARM_MOVT_PREL = 46;
|
||||||
constexpr unsigned R_ARM_ALU_PC_G0_NC = 57;
|
constexpr unsigned R_ARM_ALU_PC_G0_NC = 57;
|
||||||
constexpr unsigned R_ARM_ALU_PC_G1_NC = 59;
|
constexpr unsigned R_ARM_ALU_PC_G1_NC = 59;
|
||||||
constexpr unsigned R_ARM_LDR_PC_G2 = 63;
|
constexpr unsigned R_ARM_LDR_PC_G2 = 63;
|
||||||
// Arm thumb
|
// Arm thumb
|
||||||
constexpr unsigned R_ARM_THM_CALL = 10;
|
constexpr unsigned R_ARM_THM_CALL = 10;
|
||||||
constexpr unsigned R_ARM_THM_JUMP24 = 30;
|
constexpr unsigned R_ARM_THM_JUMP24 = 30;
|
||||||
|
@ -284,8 +284,8 @@ template <class T> class section_impl : public section
|
|||||||
( *translator )[( *convertor )( header.sh_offset )];
|
( *translator )[( *convertor )( header.sh_offset )];
|
||||||
Elf_Xword size = get_size();
|
Elf_Xword size = get_size();
|
||||||
if ( nullptr == data && SHT_NULL != get_type() &&
|
if ( nullptr == data && SHT_NULL != get_type() &&
|
||||||
SHT_NOBITS != get_type() &&
|
SHT_NOBITS != get_type() && sh_offset <= get_stream_size() &&
|
||||||
sh_offset <= get_stream_size() && size <= (get_stream_size() - sh_offset)) {
|
size <= ( get_stream_size() - sh_offset ) ) {
|
||||||
data.reset( new ( std::nothrow ) char[size_t( size ) + 1] );
|
data.reset( new ( std::nothrow ) char[size_t( size ) + 1] );
|
||||||
|
|
||||||
if ( ( 0 != size ) && ( nullptr != data ) ) {
|
if ( ( 0 != size ) && ( nullptr != data ) ) {
|
||||||
|
@ -68,8 +68,8 @@ int main( int argc, char** argv )
|
|||||||
std::ifstream proc_maps( std::string( "/proc/" ) + argv[1] + "/maps" );
|
std::ifstream proc_maps( std::string( "/proc/" ) + argv[1] + "/maps" );
|
||||||
if ( !proc_maps ) {
|
if ( !proc_maps ) {
|
||||||
std::cout << "Can't open "
|
std::cout << "Can't open "
|
||||||
<< std::string( "/proc/" ) + argv[1] + "/maps"
|
<< std::string( "/proc/" ) + argv[1] + "/maps" << " file"
|
||||||
<< " file" << std::endl;
|
<< std::endl;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,17 +1009,17 @@ class mock_wiiu_compression : public compression_interface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<char[]>
|
std::unique_ptr<char[]>
|
||||||
inflate( const char* data,
|
inflate( const char* data,
|
||||||
const endianness_convertor* convertor,
|
const endianness_convertor* convertor,
|
||||||
Elf_Xword compressed_size,
|
Elf_Xword compressed_size,
|
||||||
Elf_Xword& uncompressed_size ) const override
|
Elf_Xword& uncompressed_size ) const override
|
||||||
{
|
{
|
||||||
uncompressed_size = 2 * compressed_size;
|
uncompressed_size = 2 * compressed_size;
|
||||||
return std::unique_ptr<char[]>(
|
return std::unique_ptr<char[]>(
|
||||||
new ( std::nothrow ) char[uncompressed_size + 1] );
|
new ( std::nothrow ) char[uncompressed_size + 1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<char[]> deflate( const char* data,
|
std::unique_ptr<char[]> deflate( const char* data,
|
||||||
const endianness_convertor* convertor,
|
const endianness_convertor* convertor,
|
||||||
Elf_Xword decompressed_size,
|
Elf_Xword decompressed_size,
|
||||||
Elf_Xword& compressed_size ) const override
|
Elf_Xword& compressed_size ) const override
|
||||||
@ -1198,7 +1198,7 @@ TEST( ELFIOTest, test_segment_resize_bug )
|
|||||||
* 09 .tdata .init_array .fini_array .data.rel.ro .got
|
* 09 .tdata .init_array .fini_array .data.rel.ro .got
|
||||||
*/
|
*/
|
||||||
|
|
||||||
auto checkElf = [](auto &reader) {
|
auto checkElf = [](auto &reader) {
|
||||||
const auto &segments = reader.segments;
|
const auto &segments = reader.segments;
|
||||||
ASSERT_EQ( segments.size(), 10 );
|
ASSERT_EQ( segments.size(), 10 );
|
||||||
checkSegment(segments[0], PT_LOAD, 0x400000, 0x400000, 0x518, 0x518, PF_R, 0x1000);
|
checkSegment(segments[0], PT_LOAD, 0x400000, 0x400000, 0x518, 0x518, PF_R, 0x1000);
|
||||||
@ -1213,9 +1213,9 @@ TEST( ELFIOTest, test_segment_resize_bug )
|
|||||||
checkSegment(segments[9], PT_GNU_RELRO, 0x4bd0c0, 0x4bd0c0, 0x2f40, 0x2f40, PF_R, 0x1);
|
checkSegment(segments[9], PT_GNU_RELRO, 0x4bd0c0, 0x4bd0c0, 0x2f40, 0x2f40, PF_R, 0x1);
|
||||||
};
|
};
|
||||||
|
|
||||||
checkElf(reader);
|
checkElf( reader );
|
||||||
|
|
||||||
ASSERT_EQ( reader.save("elf_examples/x86_64_static.save"), true );
|
ASSERT_EQ( reader.save( "elf_examples/x86_64_static.save" ), true );
|
||||||
ASSERT_EQ( reader.load( "elf_examples/x86_64_static.save" ), true );
|
ASSERT_EQ( reader.load( "elf_examples/x86_64_static.save" ), true );
|
||||||
|
|
||||||
// Comment out the assertion. The question is - how the original segment size was calculated
|
// Comment out the assertion. The question is - how the original segment size was calculated
|
||||||
|
@ -91,7 +91,7 @@ bool write_obj_i386( bool is64bit )
|
|||||||
|
|
||||||
symbol_section_accessor symbol_writer( writer, sym_sec );
|
symbol_section_accessor symbol_writer( writer, sym_sec );
|
||||||
Elf_Word nSymIndex = symbol_writer.add_symbol(
|
Elf_Word nSymIndex = symbol_writer.add_symbol(
|
||||||
nStrIndex, 0, 0, STB_LOCAL, STT_NOTYPE, 0, data_sec->get_index() );
|
nStrIndex, 0, 0, STB_LOCAL, STT_NOTYPE, 0, data_sec->get_index() );
|
||||||
|
|
||||||
// Another way to add symbol
|
// Another way to add symbol
|
||||||
symbol_writer.add_symbol( str_writer, "_start", 0x00000000, 0, STB_WEAK,
|
symbol_writer.add_symbol( str_writer, "_start", 0x00000000, 0, STB_WEAK,
|
||||||
@ -679,7 +679,7 @@ TEST( ELFIOTest, rearrange_local_symbols )
|
|||||||
symbols.add_symbol( str_writer, name.c_str(), value, size, bind, type,
|
symbols.add_symbol( str_writer, name.c_str(), value, size, bind, type,
|
||||||
other, section_index );
|
other, section_index );
|
||||||
|
|
||||||
ASSERT_EQ( symbols.get_symbols_num(), sym_num + 9);
|
ASSERT_EQ( symbols.get_symbols_num(), sym_num + 9 );
|
||||||
|
|
||||||
symbols.arrange_local_symbols( [&]( Elf_Xword first, Elf_Xword ) -> void {
|
symbols.arrange_local_symbols( [&]( Elf_Xword first, Elf_Xword ) -> void {
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user