[PATCH v9 04/19] gas: implement parsing of object attributes v2
Matthieu Longo
matthieu.longo@arm.com
Thu Nov 20 16:29:58 GMT 2025
On 20/11/2025 15:41, Jan Beulich wrote:
> On 20.11.2025 16:08, Matthieu Longo wrote:
>> On 06/11/2025 17:05, Jan Beulich wrote:
>>>>>> + return true;
>>>>>> +}
>>>>>> +#endif /* TC_OBJ_ATTR_v2 */
>>>>>> +
>>>>>> +#if (TC_OBJ_ATTR_v1)
>>>>>> +/* Look up attribute tags defined in the backend (object attribute v1). */
>>>>>> +static bool
>>>>>> +obj_attr_v1_lookup_known_attr_tag_symbol (const char *identifier,
>>>>>> + arg_token_t token_type,
>>>>>> + arg_t *val_out)
>>>>>> +{
>>>>>> +#ifndef CONVERT_SYMBOLIC_ATTRIBUTE
>>>>>> +#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
>>>>>> + (void) identifier;
>>>>> As indicated in v8 review - the common way is use of ATTRIBUTE_UNUSED.
>>>> Fixed but unsure about the formatting (see below).
>>>>
>>>> diff --git a/gas/config/obj-elf-attr.c b/gas/config/obj-elf-attr.c
>>>> index 82ec6a79783..b574d46b80c 100644
>>>> --- a/gas/config/obj-elf-attr.c
>>>> +++ b/gas/config/obj-elf-attr.c
>>>> @@ -354,15 +354,16 @@ resolve_if_matching (const char *identifier,
>>>> #if (TC_OBJ_ATTR_v1)
>>>> /* Look up attribute tags defined in the backend (object attribute
>>>> v1). */
>>>> static bool
>>>> -obj_attr_v1_lookup_known_attr_tag_symbol (const char *identifier,
>>>> - arg_token_t token_type,
>>>> - arg_t *val_out)
>>>> -{
>>>> +obj_attr_v1_lookup_known_attr_tag_symbol (
>>>> #ifndef CONVERT_SYMBOLIC_ATTRIBUTE
>>>> -#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
>>>> - (void) identifier;
>>>> + #define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
>>>> + const char *identifier ATTRIBUTE_UNUSED,
>>>> +#else
>>>> + const char *identifier,
>>> Well, no. See other uses of ATTRIBUTE_UNUSED: It's applied if any build
>>> configuration would leave a parameter unused. No #ifdef-ary like this.
>>
>> If you absolutely want me to not use ATTRIBUTE_UNUSED in this case, how am I supposed to do for targets that don't define CONVERT_SYMBOLIC_ATTRIBUTE like m68k ?
> Perhaps a misunderstanding? I don't mind the ATTRIBUTE_UNUSED; what I do mind is the
> #ifdef-ary trying to avoid its use in certain configurations. What I was trying to
> point out is that elsewhere, if in _some_ configuration an item is unused, it'll
> have the attribute applied, even if in other configurations it is used.
> read.c:s_mri_sect() and read.c:do_parse_cons_expression() may be good examples for
> you to look at.
>
> Jan
Oh I see. It makes sense now.
Fixed in the next revision.
Matthieu.
More information about the Binutils
mailing list