[PATCH v2 23/28] gnu directives: parse gnu_attribute and gnu_subsection in BAv2 context

Jan Beulich jbeulich@suse.com
Wed Jun 25 14:00:29 GMT 2025


On 25.06.2025 14:52, Richard Earnshaw (lists) wrote:
> On 02/05/2025 14:50, Jan Beulich wrote:
>> On 02.05.2025 12:32, Matthieu Longo wrote:
>>> @@ -2065,6 +2067,22 @@ obj_elf_gnu_attribute (int ignored ATTRIBUTE_UNUSED)
>>>    obj_attr_process_attribute (OBJ_ATTR_GNU);
>>>  }
>>>  
>>> +/* Parse a .gnu_subsection directive.  */
>>> +
>>> +static void
>>> +obj_elf_gnu_subsection (int ignored ATTRIBUTE_UNUSED)
>>> +{
>>> +  obj_attr_version_t version = elf_obj_attr_version (stdoutput);
>>> +  if (version < OBJ_ATTR_V2)
>>> +    {
>>> +      as_bad (("gnu_subsection is only available with object attributes v2, and"
>>> +	      " the current target only supports object attributes v1"));
>>
>> I appreciate the desire to make this generically usable, but taking x86: If
>> this message didn't trigger upon use of the directive, I expect that would
>> be wrong. But if it does trigger, it's wrong too: x86 doesn't support v1
>> either. 
> 
> According to the manual:
> 
>   8.1 gnu Object Attributes  
> 
>   The .gnu_attribute directive records an object attribute with vendor `gnu'.  
> 
>   [...]
> 
>   8.1.1 Common gnu attributes
> 
>   These attributes are valid on all architectures.
> 
>   Tag_compatibility (32)
> 
> So technically even x86 should support this, though it appears that readelf doesn't recognize it correctly.  Perhaps the manual is just wrong, or perhaps the x86 support wasn't wired up correctly.

My guess would be that "all" means "all supporting Object Attributes in principle".
I.e. meaning that "Common gnu attributes" are common to all _such_ architectures. I
also don't expect x86 to be the only affected arch here; I merely used that as an
example, assuming that typically I know by know what we (do not) support there. I
also can't spot any arch-independent testcase (using that directive) in gas'es
testsuite.

Jan


More information about the Binutils mailing list