[PATCH v1] fix build failures due to incorrect format specifier for uint64_t
Matthieu Longo
matthieu.longo@arm.com
Thu Jan 22 16:31:36 GMT 2026
On 22/01/2026 15:41, Jan Beulich wrote:
> On 22.01.2026 16:30, Matthieu Longo wrote:
>> --- a/bfd/elf-attrs.c
>> +++ b/bfd/elf-attrs.c
>> @@ -2749,14 +2749,16 @@ 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);
>
> This looks to be taken care of by Rainer's patch already.
>
> Note further how you keep %u here for subsection_len, which then makes
> me wonder ...
>
>> goto error;
>> }
>> else if (subsection_len < F_MIN_SUBSECTION_DATA_LEN)
>> {
>> - _bfd_error_handler (_("%pB: error: subsection length of %u is too small"),
>> - abfd, subsection_len);
>> + _bfd_error_handler
>> + (_("%pB: error: subsection length of %"PRIu32" is too small"),
>> + abfd, subsection_len);
>
> ... why it would need changing here.
>
subsection_len is uint32_t.
I hadn't changed this one.
I will change it to unsigned int, and will keep '%u'.
>> @@ -2908,7 +2910,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
>> {
>> _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);
>
> This, again, Rainer took care of already.
>
>> --- a/gas/config/obj-elf-attr.c
>> +++ b/gas/config/obj-elf-attr.c
>> @@ -1004,17 +1004,19 @@ vendor_subsection_parse_args (unsigned int nargs, ...)
>> if (high_ttype == SUBSECTION_OPTION_1
>> && ! is_valid_comprehension (arg_out->val.u64))
>> {
>> - as_bad (
>> - _("invalid value '%lu', expected values for <comprehension> "
>> - "are 0 (=`required') or 1 (=`optional')"), arg_out->val.u64);
>> + as_bad
>> + (_("invalid value '%"PRIu64"', expected values for "
>> + "<comprehension> are 0 (=`required') or 1 (=`optional')"),
>> + arg_out->val.u64);
>> goto bad;
>> }
>> else if (high_ttype == SUBSECTION_OPTION_2
>> && ! is_valid_encoding (arg_out->val.u64))
>> {
>> - as_bad (
>> - _("invalid value '%lu', expected values for <encoding> are 0"
>> - " (=`ULEB128') or 1 (=`NTBS')"), arg_out->val.u64);
>> + as_bad
>> + (_("invalid value '%"PRIu64"', expected values for <encoding> "
>> + "are 0 (=`ULEB128') or 1 (=`NTBS')"),
>> + arg_out->val.u64);
>> goto bad;
>> }
>> }
>> @@ -1069,7 +1071,8 @@ obj_attr_v2_record (obj_attr_tag_t key, arg_t *arg_val)
>> && recorded_attr->val.uint != obj_attr->val.uint)
>> || (arg_val->vtype == VALUE_STRING
>> && strcmp (recorded_attr->val.string, obj_attr->val.string) != 0))
>> - as_bad (_("attribute '%lu' cannot be redefined"), recorded_attr->tag);
>> + as_bad (_("attribute '%"PRIu64"' cannot be redefined"),
>> + recorded_attr->tag);
>> skip_recording = true;
>> }
>
> All of these changes still look to be necessary (read: okay for this gas side
> part).
>
> Jan
More information about the Binutils
mailing list