[PATCH v12 03/25] gas: implement parsing of object attributes v2

Matthieu Longo matthieu.longo@arm.com
Thu Jan 22 12:53:36 GMT 2026


On 22/01/2026 11:00, Jan Beulich wrote:
> On 19.01.2026 12:32, Jan Beulich wrote:
>> On 16.01.2026 19:59, Matthieu Longo wrote:
>>> +  /* If it is neither a string nor an identifier, it must be an expression.  */
>>> +  bool signedness_issue = false;
>>> +  bool success = extract_integer_literal (arg_out,
>>> +					  (low_ttype & UNSIGNED_INTEGER),
>>> +					  &signedness_issue);
>>> +  if (success && (low_ttype & (UNSIGNED_INTEGER | SIGNED_INTEGER)))
>>> +    return true;
>>> +
>>> +  char sbuffer[100];
>>> +  if (success)
>>> +    as_bad (_("unexpected integer '%lu', expected %s instead"),
>>> +	    arg_out->val.u64,
>>
>> As indicated before, %lu and alike aren't suitable to print uint64_t values.
> 
> So despite me pointing out this issue here and in other instances, you committed
> one or more patches with the issue unaddressed, now tripping up the builder:
> 
> ../../binutils-gdb/bfd/elf-attrs.c: In function ‘_bfd_obj_attr_v2_tag_to_string’:
> ../../binutils-gdb/bfd/elf-attrs.c:392:36: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘obj_attr_tag_t’ {aka ‘long long unsigned int’} [-Werror=format=]
>    392 |   return xasprintf ("Tag_unknown_%lu", tag);
>        |                                  ~~^   ~~~
>        |                                    |   |
>        |                                    |   obj_attr_tag_t {aka long long unsigned int}
>        |                                    long unsigned int
>        |                                  %llu
> cc1: all warnings being treated as errors
> make[3]: *** [Makefile:1763: elf-attrs.lo] Error 1
> make[3]: *** Waiting for unfinished jobs....
> 
> Jan

I am going to publish a fix for it.
FYI I am not detecting any of those issues on my machine, and I am struggling to spot them by reading the source.
If you know a tool to detect such issues, please let me know.

Matthieu



More information about the Binutils mailing list