PT_GNU_RELRO flags

Jose E. Marchesi jose.marchesi@oracle.com
Fri Oct 9 16:47:00 GMT 2015


Hi hackers!  The following commit:

commit 2d16d28e5c20aacc9637f589558c118d6fe1a17c
Author: Doug Kwan <dougkwan@google.com>
Date:   Tue May 8 17:18:21 2012 +0000

    2012-05-08  Ben Cheng  <bccheng@google.com>

        * bfd/elf.c: Preserve the original p_align and p_flags if they
        are valid.

Makes ld to not derive the PT_GNU_RELRO segment flags from its covering
PT_LOAD segment when it already contains "valid" flags (bfd creates them
with "R" flags, whereas gold creates them with "RW").  As a result, it
is no longer generally true that `RELRO->p_flags & ~PF_W ==
LOAD->p_flags & ~PF_W'.

The thing is, eu-elflint checks precisely for that, and complains for
shared objects linked with -zrelro:

  loadable segment [5] flags do not match GNU_RELRO [1] flags

Was this change intended?  Does it makes sense to have RELRO=R/LOAD=RWE
pairs in elf files? (RELRO segments contain .plt sections in sparc, for
example, and I would expect these to be executable...).



More information about the Binutils mailing list