[PATCH v1] fix build failures due to incorrect format specifier for uint64_t

Matthieu Longo matthieu.longo@arm.com
Thu Jan 22 15:30:56 GMT 2026


---
 bfd/elf-attrs.c           | 12 +++++++-----
 gas/config/obj-elf-attr.c | 17 ++++++++++-------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
index fe85f4b4712..9177f07271b 100644
--- 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);
       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);
       goto error;
     }
 
@@ -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);
       bfd_set_error (bfd_error_invalid_operation);
       return;
     }
diff --git a/gas/config/obj-elf-attr.c b/gas/config/obj-elf-attr.c
index 1b91c11158c..6ddf1919b29 100644
--- 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;
     }
 
-- 
2.52.0



More information about the Binutils mailing list