From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12863 invoked by alias); 28 Aug 2009 14:37:33 -0000 Received: (qmail 12854 invoked by uid 22791); 28 Aug 2009 14:37:32 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-ew0-f224.google.com (HELO mail-ew0-f224.google.com) (209.85.219.224) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Aug 2009 14:37:26 +0000 Received: by ewy24 with SMTP id 24so2207710ewy.23 for ; Fri, 28 Aug 2009 07:37:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.20.210 with SMTP id p60mr222347wep.172.1251470243125; Fri, 28 Aug 2009 07:37:23 -0700 (PDT) In-Reply-To: <20090828143141.GK19523@bubble.grove.modra.org> References: <20090828000233.GA23692@lucon.org> <20090828031410.GC19523@bubble.grove.modra.org> <6dc9ffc80908272032p5b5a54a6h75caad74a27ffeda@mail.gmail.com> <6dc9ffc80908272055l3daa1368l1f84cfafcc07c2de@mail.gmail.com> <20090828055016.GE19523@bubble.grove.modra.org> <6dc9ffc80908280640q35b52922gda316d43127b7ab7@mail.gmail.com> <20090828143141.GK19523@bubble.grove.modra.org> Date: Fri, 28 Aug 2009 15:05:00 -0000 Message-ID: <6dc9ffc80908280737q3b02c3e1ybfec435dd9307512@mail.gmail.com> Subject: Re: PATCH: PR ld/10569: -z max-page-size may not work for linker scripts From: "H.J. Lu" To: binutils Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2009-08/txt/msg00533.txt.bz2 On Fri, Aug 28, 2009 at 7:31 AM, Alan Modra 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 wrot= e: >> > 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 wrote: >> >> > On Thu, Aug 27, 2009 at 8:14 PM, Alan Modra = wrote: >> >> >> I think this is the wrong place to call bfd_emul_set_maxpagesize >> >> >> (and the current call in elf32.em is wrong too). =A0You probably s= hould >> >> >> be calling bfd_emul_set_maxpagesize in open_output. =A0Also, >> >> > >> >> > Will open_output be called before any linker scripts are processed? >> > >> > Depends on what you mean by processed. =A0Yes, they are parsed and >> > converted to internal format before open_output, but why does it >> > matter? =A0Nothing much depends on maxpagesize until >> > lang_size_sections. >> >> This linker script: >> >> --- >> SECTIONS >> { >> =A0 .text : {*(.text)} >> =A0 . =3D ALIGN(CONSTANT (MAXPAGESIZE)); >> =A0 .data : {*(.data)} >> =A0 /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. =A0See > 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. =A0After 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. --=20 H.J.