2007-07-29 Jan Kratochvil * bfd/elf.c (_bfd_elf_new_section_hook): New comment for ET_CORE files with p_filesz shorter than p_memsz. Behave for such split sections in a backward compatible way for both its parts. --- bfd/elf.c 26 Jul 2007 18:15:46 -0000 1.401 +++ bfd/elf.c 29 Jul 2007 13:46:21 -0000 @@ -2225,6 +2225,9 @@ _bfd_elf_new_section_hook (bfd *abfd, as by the difference between the two sizes. In effect, the segment is split into it's initialized and uninitialized parts. + This notion does not apply in ET_CORE files, where a shorter p_filesz means + that the data is not available in the dump. + */ bfd_boolean @@ -2286,10 +2289,20 @@ _bfd_elf_make_section_from_phdr (bfd *ab return FALSE; newsect->vma = hdr->p_vaddr + hdr->p_filesz; newsect->lma = hdr->p_paddr + hdr->p_filesz; - newsect->size = hdr->p_memsz - hdr->p_filesz; + if (abfd->format != bfd_core) + newsect->size = hdr->p_memsz - hdr->p_filesz; + else + { + newsect->size = 0; + newsect->filepos = hdr->p_offset; + newsect->flags |= SEC_HAS_CONTENTS; + newsect->alignment_power = bfd_log2 (hdr->p_align); + } if (hdr->p_type == PT_LOAD) { newsect->flags |= SEC_ALLOC; + if (abfd->format == bfd_core) + newsect->flags |= SEC_LOAD; if (hdr->p_flags & PF_X) newsect->flags |= SEC_CODE; }