[PATCH v2 03/10] BFD: Rename `*_set_reloc' to `*_finalize_section_relocs'

Jan Beulich jbeulich@suse.com
Fri Nov 7 14:53:44 GMT 2025


On 05.11.2025 03:46, Maciej W. Rozycki wrote:
> The `*_set_reloc' interface is to be called at the conclusion of section 
> relocation processing, however its name reflects a particular action to 
> take rather than the context of invocation.  Implementation is already 
> backend-specific.
> 
> 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.

> 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.

> --- 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.

Jan


More information about the Binutils mailing list