diff options
author | Alan Hayward <alan.hayward@arm.com> | 2018-06-21 09:37:58 +0100 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2018-06-21 09:37:58 +0100 |
commit | 57c0d77c2ce5e583dab322e05f8291bcbad0ccd3 (patch) | |
tree | 285687451f3e8b296f404aa8990b95df36472835 /include | |
parent | 0d0b0ea29af6abc0790d22f843a3d0cb09424a3a (diff) | |
download | gdb-57c0d77c2ce5e583dab322e05f8291bcbad0ccd3.zip gdb-57c0d77c2ce5e583dab322e05f8291bcbad0ccd3.tar.gz gdb-57c0d77c2ce5e583dab322e05f8291bcbad0ccd3.tar.bz2 |
Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT for non SHT_NOBITS
For sections that are not SHT_NOBITS, use sh_offset and p_offset instead of
sh_addr and p_vaddr when calculating if a section fits in a segment. Both
methods are valid when using the GNU linker.
include/
* elf/internal.h (ELF_SECTION_IN_SEGMENT): Don’t check addresses
for non SHT_NOBITS.
Diffstat (limited to 'include')
-rw-r--r-- | include/ChangeLog | 5 | ||||
-rw-r--r-- | include/elf/internal.h | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index b8a0a23..f5fdf43 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2018-06-21 Alan Hayward <alan.hayward@arm.com> + + * elf/internal.h (ELF_SECTION_IN_SEGMENT): Don’t check addresses + for non SHT_NOBITS. + 2018-06-19 Simon Marchi <simon.marchi@ericsson.com> Sync with GCC diff --git a/include/elf/internal.h b/include/elf/internal.h index 05f9fab..b012820 100644 --- a/include/elf/internal.h +++ b/include/elf/internal.h @@ -342,8 +342,10 @@ struct elf_segment_map && (((sec_hdr)->sh_offset - (segment)->p_offset \ + ELF_SECTION_SIZE(sec_hdr, segment)) \ <= (segment)->p_filesz))) \ - /* SHF_ALLOC sections must have VMAs within the segment. */ \ + /* SHT_NOBITS sections with SHF_ALLOC must have VMAs within the \ + segment. */ \ && (!(check_vma) \ + || (sec_hdr)->sh_type != SHT_NOBITS \ || ((sec_hdr)->sh_flags & SHF_ALLOC) == 0 \ || ((sec_hdr)->sh_addr >= (segment)->p_vaddr \ && (!(strict) \ |