[PATCH v3 16/18] BFD: Add BFD pointer member to archive member references

Jan Beulich jbeulich@suse.com
Tue Jan 13 08:42:40 GMT 2026


On 13.01.2026 02:43, Maciej W. Rozycki wrote:
> On Tue, 9 Dec 2025, Jan Beulich wrote:
> 
>> On 20.11.2025 11:57, Maciej W. Rozycki wrote:
>>> --- binutils-gdb.orig/bfd/bfd.c
>>> +++ binutils-gdb/bfd/bfd.c
>>> @@ -326,12 +326,12 @@ CODE_FRAGMENT
>>>  .     contained in an archive.  *}
>>>  .  ufile_ptr origin;
>>>  .
>>> -.  {* The origin in the archive of the proxy entry.  This will
>>> +.  {* A reference in the archive for the proxy entry.  This will
>>>  .     normally be the same as origin, except for thin archives,
>>>  .     when it will contain the current offset of the proxy in the
>>>  .     thin archive rather than the offset of the bfd in its actual
>>>  .     container.  *}
>>> -.  ufile_ptr proxy_origin;
>>> +.  ufile_ptr_or_bfd proxy_handle;
>>
>> I might guess that it'll be changed later, but at this point the comment
>> still only talking of file offsets is irritating. Can there be some minimal
>> adjustment right away?
> 
>  I've added "Room for a BFD pointer is alternatively provided for future 
> use." in v4.
> 
>>> --- binutils-gdb.orig/binutils/bucomm.c
>>> +++ binutils-gdb/binutils/bucomm.c
>>> @@ -477,10 +477,12 @@ print_arelt_descr (FILE *file, bfd *abfd
>>>  
>>>    if (offsets)
>>>      {
>>> -      if (bfd_is_thin_archive (abfd) && abfd->proxy_origin)
>>> -        fprintf (file, " 0x%lx", (unsigned long) abfd->proxy_origin);
>>> +      if (bfd_is_thin_archive (abfd) && abfd->proxy_handle.file_offset)
>>> +	fprintf (file, " 0x%lx",
>>> +		 (unsigned long) abfd->proxy_handle.file_offset);
>>>        else if (!bfd_is_thin_archive (abfd) && abfd->origin)
>>> -        fprintf (file, " 0x%lx", (unsigned long) abfd->origin);
>>> +	fprintf (file, " 0x%lx",
>>> +		 (unsigned long) abfd->origin);
>>
>> Aiui you correct indentation here.
> 
>  Umm, no, the format specifier's corresponding argument has changed for 
> each `fprintf' invocation.  The new code has to conform to the GNU Coding 
> Standards of course, so broken indentation is naturally not preserved.

How is "(unsigned long) abfd->origin" different from
"(unsigned long) abfd->origin"?

>> May I, however, ask that you don't wrap
>> lines when there's no need to?
> 
>  Well, the first `fprintf' invocation now needs to be wrapped anyway and 
> the idea is to keep the two calls aligned WRT each other so as to improve 
> readability, as there is a pattern between them.  And I don't think there 
> is a requirement to keep lines at their maximum allowed length possible in 
> either the GNU Coding Standards or any extra rules that might apply to the 
> binutils project.  So I am going to keep this change as it stands, there's 
> nothing wrong with it.

As per above - the line in principle doesn't need touching at all.
Correcting its indentation is fine with me as you touch adjacent code, but
otherwise it wants leaving alone unless there actually is a reason not to.
(Keeping wrapping of arguments in sync in a non-goal imo, when the argument
lengths are sufficiently dissimilar.)

Jan


More information about the Binutils mailing list