This is the mail archive of the 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 Sat, Mar 28, 2015 at 03:46:49PM -0700, H.J. Lu wrote:
> On Sat, Mar 28, 2015 at 11:30 AM, H.J. Lu <> wrote:
> > On Fri, Mar 27, 2015 at 9:15 PM, Alan Modra <> wrote:
> >> On Fri, Mar 27, 2015 at 01:00:20PM -0700, H.J. Lu wrote:
> >>> On Wed, Mar 25, 2015 at 7:22 PM, Alan Modra <> wrote:
> >>> > Isn't this just re-inventing the commonpage adjustment done for
> >>> > DATA_SEGMENT_ALIGN?  Why didn't the existing code in ldexp.c work for
> >>> > you?
> >>>
> >>> segment.  In order to properly align PT_GNU_RELRO segmnet, we pad the first
> >>> section of PT_GNU_RELRO segment by
> >>
> >> Adjusting the start of the first section of the PT_GNU_RELRO segment
> >> is exactly what DATA_SEGMENT_ALIGN is supposed to do.  You are
> >> patching the wrong place.  Any adjustment to the start of the relro
> >> segment belongs in ldexp.c code evaluating DATA_SEGMENT_ALIGN.
> >
> > Since output_section_statement isn't passed to ldexp.c, I don't see how
> > DATA_SEGMENT_ALIGN  in ldexp.c can check the section address and size.
> lang_size_sections aligns expld.dataseg.base:

You're correct.  I thought I knew this code well enough to review your
patch without looking at the existing code.  Obviously not.

Howver, I'm glad you also had to look at the entirety of the relro
code as that should make you realize that the patch you posted isn't
very elegant.  For instance, there is no need for
output_prev_load_sec_find since the end of the previous section is
available in expld.dataseg.min_base.  Also, the bulk of the patch
still belongs with the other relro code handling DATA_SEGMENT_ALIGN
(not in ldexp.c as I wrongly claimed before, but in
lang_size_sections).  I think it important that we keep the relro base
alignment code all in one place.

Alan Modra
Australia Development Lab, IBM

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