public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils <binutils@sources.redhat.com>
Subject: Re: PATCH: PR ld/10569: -z max-page-size may not work for linker  	scripts
Date: Fri, 28 Aug 2009 15:05:00 -0000	[thread overview]
Message-ID: <6dc9ffc80908280737q3b02c3e1ybfec435dd9307512@mail.gmail.com> (raw)
In-Reply-To: <20090828143141.GK19523@bubble.grove.modra.org>

On Fri, Aug 28, 2009 at 7:31 AM, Alan Modra<amodra@bigpond.net.au> wrote:
> On Fri, Aug 28, 2009 at 06:40:42AM -0700, H.J. Lu wrote:
>> On Thu, Aug 27, 2009 at 10:50 PM, Alan Modra<amodra@bigpond.net.au> wrote:
>> > On Thu, Aug 27, 2009 at 08:55:46PM -0700, H.J. Lu wrote:
>> >> On Thu, Aug 27, 2009 at 8:32 PM, H.J. Lu<hjl.tools@gmail.com> wrote:
>> >> > On Thu, Aug 27, 2009 at 8:14 PM, Alan Modra<amodra@bigpond.net.au> wrote:
>> >> >> I think this is the wrong place to call bfd_emul_set_maxpagesize
>> >> >> (and the current call in elf32.em is wrong too).  You probably should
>> >> >> be calling bfd_emul_set_maxpagesize in open_output.  Also,
>> >> >
>> >> > Will open_output be called before any linker scripts are processed?
>> >
>> > Depends on what you mean by processed.  Yes, they are parsed and
>> > converted to internal format before open_output, but why does it
>> > matter?  Nothing much depends on maxpagesize until
>> > lang_size_sections.
>>
>> This linker script:
>>
>> ---
>> SECTIONS
>> {
>>   .text : {*(.text)}
>>   . = ALIGN(CONSTANT (MAXPAGESIZE));
>>   .data : {*(.data)}
>>   /DISCARD/ : {*(*)}
>> }
>> ---
>>
>> calls fold_name on MAXPAGESIZE before open_output is called.
>
> You are allowed to fail in fold_name if output_target is not set.  See
> many other examples where we return !result.valid_p if attempting to
> evaluate early in the link.

This is from one of linker tests. If I don't set page sizes in
gld${EMULATION_NAME}_handle_option, 2 linker tests will fail.

>> > Why can't you use output_target?
>> >
>>
>> We may set and get page sizes in linker. In linker script, we should use
>> emulation target, which may be different from output target, to get
>> page size, We need to set page size for emulation target in
>> gld${EMULATION_NAME}_handle_option. We also need to set page
>> size for output target in ldemul_set_output_arch.
>
> If you accept a fail in fold_name, then I think your argument
> collapses.  After output_target has been set, that's the right target
> to use.
>

Output target can be different from emulation target. Emulation target
may be ELF, which supports page sizes, while output target may not support
page sizes at all. We need to page sizes for both.


-- 
H.J.

  reply	other threads:[~2009-08-28 14:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-28  0:40 H.J. Lu
2009-08-28  3:55 ` Alan Modra
2009-08-28  5:50   ` H.J. Lu
2009-08-28  8:01     ` H.J. Lu
2009-08-28  8:09       ` Alan Modra
2009-08-28 14:31         ` H.J. Lu
2009-08-28 14:48           ` Alan Modra
2009-08-28 15:05             ` H.J. Lu [this message]
2009-08-30 13:51               ` Alan Modra
2009-08-31  2:02                 ` H.J. Lu
2009-08-31  2:50                   ` Alan Modra
2009-08-31  6:19                     ` H.J. Lu
2009-08-31  9:09                       ` Alan Modra
2009-08-31 18:16                       ` H.J. Lu
2009-09-01  0:00                         ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6dc9ffc80908280737q3b02c3e1ybfec435dd9307512@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).