[PATCH v2 03/10] BFD: Rename `*_set_reloc' to `*_finalize_section_relocs'
Maciej W. Rozycki
macro@orcam.me.uk
Sat Nov 8 14:59:28 GMT 2025
On Fri, 7 Nov 2025, Jan Beulich wrote:
> > Rename the interface such as not to make its name artificially limit the
> > intended purpose. Update the callers and documentation accordingly. No
> > functional change.
>
> I don't particularly mind the name change, but I also don't view it as
> particularly necessary. Hooks doing more than what their names say (and
> what was originally their purpose) is a pretty common thing, I think.
I don't find past sloppiness a good excuse. Names of internal interfaces
should reflect their semantics and not random past applications.
> > Overriding backends are supposed to continue taking the original actions
> > in addition to any new ones, such as by calling the generic handler.
>
> I have to admit that it's not quite clear what you mean to express here.
> You don't alter behavior, so I view it as natural that nothing changes
> from a logical / operation sequence perspective.
The meaning is if any backend overrides the BFD default, it is expected
to call `_bfd_generic_finalize_section_relocs', or replicate its actions.
> > --- binutils-gdb.orig/bfd/bfd-in2.h
> > +++ binutils-gdb/bfd/bfd-in2.h
> > @@ -2620,11 +2620,12 @@ long bfd_get_reloc_upper_bound (bfd *abf
> > long bfd_canonicalize_reloc
> > (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
> >
> > -void bfd_set_reloc
> > +void bfd_finalize_section_relocs
> > (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
>
> What use is this declaration? Can't it be dropped rather than being
> modified? All callers ...
>
> > -#define bfd_set_reloc(abfd, asect, location, count) \
> > - BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count))
> > +#define bfd_finalize_section_relocs(abfd, asect, location, count) \
> > + BFD_SEND (abfd, _bfd_finalize_section_relocs, \
> > + (abfd, asect, location, count))
>
> ... end up using this macro anyway, afaict.
It's a mechanical change and not a code cleanup. Please feel free to
investigate whether the prototype is needed or not and offer a separate
change if desired. I don't think such an investigation ought to be a
prerequisite for this change to be accepted.
Maciej
More information about the Binutils
mailing list