Commit 57c0d77c authored by Alan Hayward's avatar Alan Hayward
Browse files

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.
parent 0d0b0ea2
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
......
......@@ -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) \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment