diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2007-11-28 13:53:05 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2007-11-28 13:53:05 +0000 |
commit | 02cb1fd853c30addf67b6d39f8cf506737ed96ab (patch) | |
tree | e1649f0fd36a5d9bd1aefa896196745e19684c96 /include/elf/internal.h | |
parent | 547ad329b628ed176d3fdf43fe103447bddd5d0b (diff) | |
download | cygnal-02cb1fd853c30addf67b6d39f8cf506737ed96ab.tar.gz cygnal-02cb1fd853c30addf67b6d39f8cf506737ed96ab.tar.bz2 cygnal-02cb1fd853c30addf67b6d39f8cf506737ed96ab.zip |
* internal.h (ELF_IS_SECTION_IN_SEGMENT): Adjust to cope with
segments at the end of memory.
Diffstat (limited to 'include/elf/internal.h')
-rw-r--r-- | include/elf/internal.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/elf/internal.h b/include/elf/internal.h index f5380b8d5..93c2315e8 100644 --- a/include/elf/internal.h +++ b/include/elf/internal.h @@ -286,11 +286,12 @@ struct elf_segment_map || ((bfd_vma) sec_hdr->sh_offset >= segment->p_offset \ && (sec_hdr->sh_offset + ELF_SECTION_SIZE(sec_hdr, segment) \ <= segment->p_offset + segment->p_filesz))) \ - /* SHF_ALLOC sections must have VMAs within the segment. */ \ + /* SHF_ALLOC sections must have VMAs within the segment. Be \ + careful about segments right at the end of memory. */ \ && ((sec_hdr->sh_flags & SHF_ALLOC) == 0 \ || (sec_hdr->sh_addr >= segment->p_vaddr \ - && (sec_hdr->sh_addr + ELF_SECTION_SIZE(sec_hdr, segment) \ - <= segment->p_vaddr + segment->p_memsz)))) + && (sec_hdr->sh_addr - segment->p_vaddr \ + + ELF_SECTION_SIZE(sec_hdr, segment) <= segment->p_memsz)))) /* Decide if the given sec_hdr is in the given segment in file. */ #define ELF_IS_SECTION_IN_SEGMENT_FILE(sec_hdr, segment) \ |