[PATCH] Use offsets instead of addresses in ELF_SECTION_IN_SEGMENT

Alan Modra amodra@gmail.com
Wed Jun 20 22:59:00 GMT 2018


On Mon, Jun 18, 2018 at 02:29:05PM +0000, Alan Hayward wrote:
> 	* include/elf/internal.h (ELF_SECTION_IN_SEGMENT): Don’t check
> 	addresses for non SHT_NOBITS.
> 
> 
> diff --git a/include/elf/internal.h b/include/elf/internal.h
> index 05f9fab89cbe2aee94006d18a689cb01e101776f..b012820f6cf9c7e6b5879748b0b05685594987bb 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)						\

This looks reasonable to me.  OK to apply.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list