This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix -z max-page-size
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 17 Jan 2007 08:46:46 -0800
- Subject: Re: [PATCH] Fix -z max-page-size
- References: <20070117145549.GG3819@sunsite.mff.cuni.cz>
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.