[PATCH v8 03/19] Object Attributes v2: new abstractions for subsections and attributes

Jan Beulich jbeulich@suse.com
Thu Jul 31 12:19:09 GMT 2025


On 31.07.2025 14:18, Jan Beulich wrote:
> On 15.07.2025 13:39, Matthieu Longo wrote:
>> @@ -834,8 +867,218 @@ _bfd_elf_merge_unknown_attribute_list (bfd *ibfd, bfd *obfd)
>>    return result;
>>  }
>>  
>> -bool _bfd_elf_write_section_build_attributes (bfd *abfd,
>> -					      struct bfd_link_info *info ATTRIBUTE_UNUSED)
>> +/* Create a new object attribute with key TAG and value VALS.
>> +   Return a pointer to it.  */
>> +
>> +obj_attr_v2 *
>> +_bfd_elf_obj_attr_v2_init (obj_attr_tag_t tag,
>> +			   union obj_attr_value_v2 vals)
>> +{
>> +  obj_attr_v2 *attr = (obj_attr_v2 *) malloc (sizeof (*attr));
> 
> No need for a cast? Also, if you don't ...
> 
>> +  memset (attr, 0, sizeof (*attr));
> 
> ... check the return value before use, likely you mean xmalloc()? Or, as you
> want the array zeroed, e.g. XCNEW()?

s/array/item/ of course.

Jan


More information about the Binutils mailing list