[PATCH] Fix -z max-page-size

H. J. Lu hjl@lucon.org
Wed Jan 17 16:47:00 GMT 2007
On Wed, Jan 17, 2007 at 03:55:49PM +0100, Jakub Jelinek wrote:
> Hi!
> 
> When using -z max-page-size=N and/or -z common-page-size=N
> options in addition to -T script.lds, the linker script is
> parsed before bfd_emul_set_{max,common}pagesize is called
> and thus CONSTANT (MAXPAGESIZE) and CONSTANT (COMMONPAGESIZE)
> return the default rather than overridden values.
> 
> Below is one possible fix, the other would be to call
> bfd_emul_set_*pagesize immediately in *_handle_option
> rather than waiting until parse_args returns and yet another
> would be not to evaluate CONSTANT (MAXPAGESIZE) etc. when
> parsing the script, but at some later time.

Will it work with

# ld -Tscript.ld -z max-page-size=N

> 
> 2007-01-17  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* ldexp.c (fold_name): If config.maxpagesize resp.
> 	config.commonpagesize is non-zero, prefer that over
> 	bfd_emul_get_*pagesize.
> 	* emultempl/elf32.em (handle_option): Make sure -z max-page-size
> 	or -z common-page-size argument is a power of 2.
> 

I am not sure if it is a bug or feature. According to this thread:

http://sourceware.org/ml/binutils/2006-12/msg00248.html

it is a feature.  I think we should implement what was proposed in:

http://sourceware.org/ml/binutils/2006-12/msg00290.html

Then you can use the new switch to make sure that the linker script
will be processed after bfd_emul_set_{max,common}pagesize.


H.J.



More information about the Binutils mailing list