This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] Initialise the machine specific part of rtld bootstrap map


Sandra Loosemore <sandra@codesourcery.com> writes:
> On 10/26/2016 03:01 PM, Matthew Fortune wrote:
> > Joseph Myers <joseph@codesourcery.com> writes:
> >> On Wed, 26 Oct 2016, Matthew Fortune wrote:
> >>
> >>> +# ifdef ELF_MACHINE_INIT_MAP
> >>> +  ELF_MACHINE_INIT_MAP (bootstrap_map); # endif
> >>
> >> We don't encourage use of #ifdef like that.  It's better to have an
> >> inline function defined everywhere and used unconditionally, for
> >> which most systems have a dummy definition (see
> >> dl-machine-reject-phdr.h and elf_machine_reject_phdr_p for an example
> >> - if you have a header for a single function, you don't need to
> >> update lots of dl-machine.h headers, just add a generic version -
> >> which has the comments detailing the semantics of the function and
> when it's needed - and a MIPS version).
> >
> > Thanks Joseph. It's been a while since I did a glibc patch and
> > couldn't remember the recommended approach.
> >
> > Do you think I should add a whole new header for this? Or, since this
> > is directly related to the reject_phdr feature for MIPS and only MIPS
> > is affected then I could just add it to dl-machine-reject-phdr.h?
> 
> Wouldn't it be easier and more maintainable just to unconditionally
> zero-initialize the structure, as I did in the original patch?

I'd like to get some consensus on the best solution here before I do
another implementation.

We either go for:

1) The bare minimum to initialise just the fields that must be zero for
successful execution on a per architecture basis (and live with the
associated risk of missing some)

or

2) Unconditionally zero the whole l_mach link_map_machine structure

Or

3) Unconditionally zero the entire link_map

Given these I'd actually go for (2) as a good balance.

Thanks,
Matthew


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