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

Matthieu Longo matthieu.longo@arm.com
Thu Jan 22 17:57:24 GMT 2026


---
 bfd/elf-attrs.c           |  7 ++++---
 bfd/elfxx-aarch64.c       |  4 ++--
 gas/config/obj-elf-attr.c | 17 ++++++++++-------
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
index 4689bedb38e..0dcff17e874 100644
--- a/bfd/elf-attrs.c
+++ b/bfd/elf-attrs.c
@@ -2743,7 +2743,7 @@ oav2_parse_subsection (bfd *abfd,
       goto error;
     }
 
-  const uint32_t subsection_len = bfd_get_32 (abfd, cursor);
+  const unsigned int subsection_len = bfd_get_32 (abfd, cursor);
   const bfd_byte *const end = cursor + subsection_len;
   total_read += F_SUBSECTION_LEN;
   cursor += F_SUBSECTION_LEN;
@@ -2756,8 +2756,9 @@ oav2_parse_subsection (bfd *abfd,
     }
   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 %u is too small"),
+	 abfd, subsection_len);
       goto error;
     }
 
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index 8352545b7b9..c09e8521333 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -1100,8 +1100,8 @@ _bfd_aarch64_oav2_attr_merge (const struct bfd_link_info *info,
       if (attr_info == NULL)
 	{
 	  info->callbacks->einfo
-	    (_("%pB: warning: cannot merge unknown tag 'Tag_unknown_%u' "
-	       "(=0x%x) in subsection '%s'.\n"),
+	    (_("%pB: warning: cannot merge unknown tag 'Tag_unknown_%" PRIu64 "'"
+	       " (=0x%" PRIx32 ") in subsection '%s'.\n"),
 	     abfd, rhs->tag, rhs->val.uint, subsec->name);
 	  res.reason = OAv2_MERGE_UNSUPPORTED;
 	  return res;
diff --git a/gas/config/obj-elf-attr.c b/gas/config/obj-elf-attr.c
index 1b91c11158c..7a4493d673c 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