mirror of
https://github.com/serge1/ELFIO.git
synced 2025-04-16 14:42:39 +00:00
Adjust stream size when section data changes
This commit is contained in:
parent
36f78fbf28
commit
ed2523f095
@ -140,6 +140,9 @@ template <class T> class section_impl : public section
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_size( data_size );
|
set_size( data_size );
|
||||||
|
if ( translator->empty() ) {
|
||||||
|
set_stream_size( data_size );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -171,6 +174,9 @@ template <class T> class section_impl : public section
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
set_size( get_size() + size );
|
set_size( get_size() + size );
|
||||||
|
if ( translator->empty() ) {
|
||||||
|
set_stream_size( get_stream_size() + size );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,7 @@ template <class S> class symbol_section_accessor_template
|
|||||||
{
|
{
|
||||||
Elf_Xword nRet = 0;
|
Elf_Xword nRet = 0;
|
||||||
if ( 0 != symbol_section->get_entry_size() &&
|
if ( 0 != symbol_section->get_entry_size() &&
|
||||||
true ) {
|
symbol_section->get_size() <= symbol_section->get_stream_size() ) {
|
||||||
// symbol_section->get_size() < symbol_section->get_stream_size() ) {
|
|
||||||
nRet =
|
nRet =
|
||||||
symbol_section->get_size() / symbol_section->get_entry_size();
|
symbol_section->get_size() / symbol_section->get_entry_size();
|
||||||
}
|
}
|
||||||
|
@ -685,19 +685,6 @@ BOOST_AUTO_TEST_CASE( rearrange_local_symbols )
|
|||||||
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;
|
||||||
BOOST_CHECK_EQUAL( first, ++counter );
|
BOOST_CHECK_EQUAL( first, ++counter );
|
||||||
// std::string name = "";
|
|
||||||
// ELFIO::Elf64_Addr value = 0;
|
|
||||||
// ELFIO::Elf_Xword size = 0;
|
|
||||||
// unsigned char bind = STB_LOCAL;
|
|
||||||
// unsigned char type = STT_FUNC;
|
|
||||||
// ELFIO::Elf_Half section_index = 0;
|
|
||||||
// unsigned char other = 0;
|
|
||||||
|
|
||||||
// std::cout << first << " " << second << std::endl;
|
|
||||||
// symbols.get_symbol(first, name, value, size, bind, type, section_index, other);
|
|
||||||
// std::cout << " " << name;
|
|
||||||
// symbols.get_symbol(second, name, value, size, bind, type, section_index, other);
|
|
||||||
// std::cout << " " << name << std::endl;
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( writer.save( file_name ), true );
|
BOOST_REQUIRE_EQUAL( writer.save( file_name ), true );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user