Re: [PATCH] elf: Set text-segment address to the maximum page size

Nick Clifton <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
Hi H.J.

> 	PR ld/34184
> 	* ldexp.c (fold_binary): Set text-segment address to the maximum
> 	page size for ELF PDE output with -z max-page-size=SIZE.
> 	* testsuite/ld-elf/elf.exp: Add ld/34184 test.
> 	* testsuite/ld-elf/pr34184.c: New file.

I like this patch, but I do have a couple of comments:

> +      /* When generating Position Dependent Executable for ELF with the
> +	 maximum page size set on command-line, if text-segment address
> +	 is lower than the maximum page size, set text-segment address
> +	 to the maximum page size.  */
> +      if ((bfd_get_flavour (link_info.output_bfd)
> +	   == bfd_target_elf_flavour)
> +	  && bfd_link_pde (&link_info)
> +	  && link_info.maxpagesize_is_set
> +	  && link_info.maxpagesize > value
> +	  && strcmp (segment_name, "text-segment") == 0)
> +	value = link_info.maxpagesize;

I think that it would be helpful to inform the user that the text
segment address is being changed - *if* they have tried to set it
using --image-base or --Ttext-segment.  Otherwise they may wonder
why their command line option is being ignored.


> +    [list \
> +	"Run pr34184" \
> +	"-Wl,-z,max-page-size=0x800000" \
> +	"" \
> +	{pr34184.c} \
> +	"pr34184" \
> +	"pass.out" \
> +    ] \

As far as I can tell, this test does not actually check that
the text segment's address is now a multiple of the max page
size...


Cheers
   Nick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.