mirror of
https://github.com/serge1/ELFIO.git
synced 2024-11-19 11:14:46 +00:00
Relate TLS sections to TLS segments only
This commit is contained in:
parent
5dd192cce6
commit
bb3a08a4b9
@ -595,6 +595,14 @@ class elfio
|
||||
segVEndAddr )
|
||||
: is_sect_in_seg( psec->get_offset(), psec->get_size(),
|
||||
segBaseOffset, segEndOffset ) ) {
|
||||
|
||||
// If it is a TLS segment, add TLS sections only and vice versa
|
||||
if ( ( ( seg->get_type() == PT_TLS ) &&
|
||||
( ( psec->get_flags() & SHF_TLS ) != SHF_TLS ) ) ||
|
||||
( ( ( psec->get_flags() & SHF_TLS ) == SHF_TLS ) &&
|
||||
( seg->get_type() != PT_TLS ) ) )
|
||||
continue;
|
||||
|
||||
// Alignment of segment shall not be updated, to preserve original value
|
||||
// It will be re-calculated on saving.
|
||||
seg->add_section_index( psec->get_index(), 0 );
|
||||
@ -796,9 +804,9 @@ class elfio
|
||||
Elf64_Off cur_page_alignment = current_file_pos % align;
|
||||
Elf64_Off req_page_alignment =
|
||||
seg->get_virtual_address() % align;
|
||||
Elf64_Off error = req_page_alignment - cur_page_alignment;
|
||||
Elf64_Off adjustment = req_page_alignment - cur_page_alignment;
|
||||
|
||||
current_file_pos += ( seg->get_align() + error ) % align;
|
||||
current_file_pos += ( seg->get_align() + adjustment ) % align;
|
||||
seg_start_pos = current_file_pos;
|
||||
}
|
||||
else if ( seg->get_sections_num() > 0 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user