[PATCH v2] bfd: Use PRIu64 to print uint64_t in elf-attrs.c

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Jan 22 15:08:20 GMT 2026


Hi Jan,

>> Ok for trunk?
>
> Only almost.
>
>> --- a/bfd/elf-attrs.c
>> +++ b/bfd/elf-attrs.c
>> @@ -2749,8 +2749,8 @@ oav2_parse_subsection (bfd *abfd,
>>    cursor += F_SUBSECTION_LEN;
>>    if (subsection_len > max_read)
>>      {
>> -      _bfd_error_handler (_("%pB: error: bad subsection length (%u > max=%lu)"),
>> -			  abfd, subsection_len, max_read);
>> +      _bfd_error_handler (_("%pB: error: bad subsection length (%u > max=%"
>> +			    PRIu64 ")"), abfd, subsection_len, max_read);
>
> Please don't wrap the format string in such a case, and especially not like
> this. It running slightly past 80 chars ought to be okay(ish). Else move
> everything from the opening parenthesis onwards to the next line. In no case
> should more arguments follow on the same line that already continues an
> argument from an earlier one.
>
> (I'm sure I had pointed out this particular instance to Matthieu.)
>
> Okay with at least this adjustment, but read on.
>
> @@ -2908,7 +2908,7 @@ void
>      {
>        _bfd_error_handler
>  	(_("%pB: error: attribute section '%pA' too big: %" PRId64),
> -	 abfd, hdr->bfd_section, hdr->sh_size);
> +	 abfd, hdr->bfd_section, (uint64_t) hdr->sh_size);
>
> Could I talk you into switching PRId64 to PRIu64 here at the same time?

Sure, both included.

I guess this is ok now?

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


	bfd:
	* elf-attrs.c (oav2_parse_subsection): Use PRIu64 to print
	uint64_t.
	(_bfd_elf_parse_attributes): Use PRIu64.
	Cast bfd_size_t arg to uint64_t.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bfd-elf-attr-PRIu64.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260122/de7331c2/attachment.bin>


More information about the Binutils mailing list