[PATCH v11 12/25] OAv2 merge: find first input containing an object attributes section

Matthieu Longo matthieu.longo@arm.com
Mon Jan 12 17:54:12 GMT 2026


On 08/01/2026 13:52, Jan Beulich wrote:
> On 31.12.2025 00:05, Matthieu Longo wrote:
>> --- a/bfd/elf-attrs.c
>> +++ b/bfd/elf-attrs.c
>> @@ -742,6 +742,41 @@ typedef struct
>>     asection *sec;
>>   } bfd_search_result_t;
>>   
>> +/* Checks whether a BFD contains object attributes, and if so search for the
>> +   relevant section storing them.  The name and type of the section have to
>> +   match with what the backend expects, i.e. elf_backend_obj_attrs_section and
>> +   elf_backend_obj_attrs_section_type, otherwise the object attributes section
>> +   won't be recognized as such, and will be skipped.
>> +   Return True if an object attribute section is found, False otherwise.  */
>> +static bool
>> +input_bfd_has_object_attributes (const struct bfd_link_info *info,
>> +				 bfd *abfd,
>> +				 bfd_search_result_t *res)
>> +{
>> +  /* The file may contain object attributes.  Save this candidate.  */
>> +  res->pbfd = abfd;
>> +
>> +  if (elf_obj_attr_subsections (abfd).size == 0)
>> +    return false;
>> +
>> +  res->has_object_attributes = true;
>> +
>> +  uint32_t sec_type = get_elf_backend_data (abfd)->obj_attrs_section_type;
>> +  const char *sec_name = get_elf_backend_data (abfd)->obj_attrs_section;
>> +  res->sec = bfd_get_section_by_name (abfd, sec_name);
>> +  if (res->sec != NULL)
>> +    {
>> +      if (elf_section_type (res->sec) != sec_type)
>> +	{
>> +	  info->callbacks->minfo
>> +	    (_("%X%pB: warning: ignoring section '%s' with unexpected type %#x\n"),
>> +	     abfd, elf_section_type (res->sec), sec_name);
> 
> Aren't the last two arguments the wrong way round for the format string?
> 

Indeed they are. Fixed.

Matthieu

> Okay with that adjustment (or not, in case I'm wrong here).
> 
> Jan



More information about the Binutils mailing list