From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17585 invoked by alias); 2 Sep 2009 15:37:35 -0000 Received: (qmail 17535 invoked by uid 22791); 2 Sep 2009 15:37:34 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_13,J_CHICKENPOX_72,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-ew0-f216.google.com (HELO mail-ew0-f216.google.com) (209.85.219.216) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Sep 2009 15:37:26 +0000 Received: by ewy12 with SMTP id 12so915846ewy.0 for ; Wed, 02 Sep 2009 08:37:24 -0700 (PDT) Received: by 10.216.89.9 with SMTP id b9mr537876wef.61.1251905843466; Wed, 02 Sep 2009 08:37:23 -0700 (PDT) Received: from ?192.168.2.99? (cpc2-cmbg8-0-0-cust61.cmbg.cable.ntl.com [82.6.108.62]) by mx.google.com with ESMTPS id 10sm35073eyd.10.2009.09.02.08.37.21 (version=SSLv3 cipher=RC4-MD5); Wed, 02 Sep 2009 08:37:21 -0700 (PDT) Message-ID: <4A9E9474.7070000@gmail.com> Date: Wed, 02 Sep 2009 15:37:00 -0000 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Dave Korn , "binutils@sourceware.org" Subject: Re: ld big trouble. References: <4A9E7AD6.7040101@gmail.com> <20090902144621.GH518@bubble.grove.modra.org> In-Reply-To: <20090902144621.GH518@bubble.grove.modra.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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-09/txt/msg00065.txt.bz2 Alan Modra wrote: > On Wed, Sep 02, 2009 at 03:01:58PM +0100, Dave Korn wrote: >> GCC's partitioning options generate sections with names like ".text.unlikely", >> or ".text.cold" and ".text.hot". Shouldn't these text sections be governed by >> the same text_read_only flag? It breaks auto-import on PE platforms, because >> that requires that all text sections (well, all that have fixup imports >> anyway) be writable. > > Input .text.* sections are usually merged in to the .text output > section on a final link. Right. The PE scripts only include *(.text), and my initial plan was to just add *(.text.*). But then it occurred to me: the reasoning behind this partitioning is to gain benefits from caching of frequently used stuff, and on that line of reasoning it might make sense to keep them as separate sections, so they can be allocated in separate memory pages that most OS's VMMs will swap out of the working set when they don't get frequently accessed. >> "text_read_only" member appears to have been added without being mentioned in > > It's main use was to make .text writable for omagic a.out binaries. IIRC a.out only supports a single section each for text, data and bss, so making the code alter the flags for other text sections wouldn't make any difference there. But I notice that both generic.em and elf32.em at least respect it and use it to select alternate default linker scripts (haven't yet checked to see if there are *actually* any differences in the generated scripts), so I wouldn't want to do anything that might surprise anyone there. > I suspect that on !link_info.relocatable && !config.text_read_only you > could loop over all output sections removing SEC_READONLY, and do > nothing otherwise. .text ought to be SEC_READONLY by default. All output sections? Surely we wouldn't want to e.g. remove SEC_READONLY from .rdata and such? I'm leaning toward leaving the PE linker script alone and adding a second pass over all sections in the PE emulation to remove SEC_READONLY from any of the other non-default .text secitons. But maybe the gain from having the cold text in entirely separate memory pages is minimal enough that I should just change the scripts; I don't really know. cheers, DaveK