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 6/9] [bfd] Introduce new section flag: SEC_ELF_OCTETS


Am Dienstag, 19. November 2019, 23:00:30 CET schrieben Sie:
> On Sun, Nov 17, 2019 at 12:21:27AM +0100, Christian Eggers wrote:
> > +unsigned int
> > +bfd_section_octets_per_byte (const asection *sec)
> > +{
> > +  unsigned int opb = bfd_octets_per_byte (sec->owner);
>
> If sec can be be the absolute section (and I think it can) then
> sec->owner will be NULL and this will segfault.  Instead of adding a
> new function, I think you'd be better off adding a section parameter
> to bfd_octets_per_byte and allow it to be NULL.  This will also force
> you to at least look at all current uses of bfd_octets_per_byte and
> perhaps see other places where you want the semantics of your new
> function.

In v2 I have removed the new function and added the section parameter
to bfd_octets_per_byte().

I would like to avoid adding a non NULL section parameter at further calls of
to bfd_octets_per_byte(), because this would probably not be hit by the
testsuite of my architecture. For instance I use the generic linker, so
changes in the ELF linker would not be tested.

Maybe the calls to bfd_octets_per_byte() should be removed from platform
specific files (e.g. arm, i386, mips, ...) where the number of octets is
always one (may improve readability).

> Some style nits need fixing.  There are repeated occurrences of the
> following in the whole series.
> [...]

I've tried my best to solve these issues in v2. Perhaps these problem could be
avoided if there were a guide like "sending-patches"...

regards
Christian




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