From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127238 invoked by alias); 30 Mar 2015 13:00:24 -0000 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 Received: (qmail 127223 invoked by uid 89); 30 Mar 2015 13:00:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=4.1 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ob0-f180.google.com Received: from mail-ob0-f180.google.com (HELO mail-ob0-f180.google.com) (209.85.214.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 30 Mar 2015 13:00:22 +0000 Received: by obvd1 with SMTP id d1so56223831obv.0 for ; Mon, 30 Mar 2015 06:00:20 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.133.144 with SMTP id pc16mr15684946oeb.0.1427720420216; Mon, 30 Mar 2015 06:00:20 -0700 (PDT) Received: by 10.76.134.102 with HTTP; Mon, 30 Mar 2015 06:00:20 -0700 (PDT) In-Reply-To: <20150330123934.GJ26234@bubble.grove.modra.org> References: <20150319130244.GA22592@intel.com> <20150326022246.GU26234@bubble.grove.modra.org> <20150328041540.GE26234@bubble.grove.modra.org> <20150329034858.GH26234@bubble.grove.modra.org> <20150330123934.GJ26234@bubble.grove.modra.org> Date: Mon, 30 Mar 2015 13:00:00 -0000 Message-ID: Subject: Re: [PATCH] Reduce file size for PT_GNU_RELRO segment From: "H.J. Lu" To: Binutils Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00442.txt.bz2 On Mon, Mar 30, 2015 at 5:39 AM, Alan Modra wrote: > On Sun, Mar 29, 2015 at 06:58:45AM -0700, H.J. Lu wrote: >> On Sat, Mar 28, 2015 at 8:48 PM, Alan Modra wrote: >> > lang_size_sections). I think it important that we keep the relro base >> > alignment code all in one place. >> >> It is not about the base alignment. It is about setting the address of >> the first section in PT_GNU_RELRO segment, given the addresses >> of PT_GNU_RELRO segment. It is impossible to set address of the first >> section in PT_GNU_RELRO segment from lang_size_sections. > > Look again at the code for exp_dataseg_relro_adjust. If you change > expld.dataseg.base there you will change addresses of sections in the > relro segment. But I don't want to change expld.dataseg.base. I just want to bump the address of the first section a bit. Currently I have bfd_vma pad = ((newdot - expld.dataseg.min_base) % expld.dataseg.maxpagesize); if (pad) { bfd_vma nextdot = expld.dataseg.maxpagesize - pad; nextdot = align_power (newdot + nextdot, section_alignment); if (((nextdot - newdot) < expld.dataseg.pagesize) && pad > (expld.dataseg.maxpagesize - expld.dataseg.pagesize)) newdot = nextdot; } I can keep the address increase, nextdot - newdot, even lower than the page size. -- H.J.