This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Reduce file size for PT_GNU_RELRO segment


On Mon, Mar 30, 2015 at 5:39 AM, Alan Modra <amodra@gmail.com> 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 <amodra@gmail.com> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]