[PATCH v9 02/19] gas: move code for object attribute parsing into obj-elf-attr.c
Jan Beulich
jbeulich@suse.com
Fri Oct 24 12:15:23 GMT 2025
On 01.09.2025 18:56, Matthieu Longo wrote:
> Gas, contrarilly to others binutils tools, is compiled for a specific
> target. Some targets don't support Object Attributes (OAs). For those
> cases, today the OA directive ".gnu_attribute" is still enabled but the
> processing would probably fail in most of cases because the named tag
> would be unknown. Most of the parsing code on such a target can be
> considered as dead code.
>
> This patch aims at removing this dead code from Gas when the target does
> not support the OAs by:
> - moving the code of OA parsing into a separate file under gas/config
> which is only included for the relevant targets supporting OAs.
> - disabling the code related to OAs on non-OA target via a TC_OBJ_ATTR
> macro.
>
> Adding/removing the OA feature from Gas for a specific target can easilly
> be done from tc-<arch>.h by changing the values of TC_OBJ_ATTR: 1 enabled,
> 0 disabled. You might also want to guard the enablement of OAs only for
> ELF targets with OBJ_ELF (see example below).
>
> \#ifdef OBJ_ELF
> /* The target supports Object Attributes. */
> \#define TC_OBJ_ATTR 1
> \#endif
Okay, albeit I'm wondering ...
> --- a/gas/config/obj-elf.c
> +++ b/gas/config/obj-elf.c
> @@ -71,7 +71,9 @@ static void obj_elf_visibility (int);
> static void obj_elf_symver (int);
> static void obj_elf_subsection (int);
> static void obj_elf_popsection (int);
> +#ifdef TC_OBJ_ATTR
> static void obj_elf_gnu_attribute (int);
> +#endif /* TC_OBJ_ATTR */
... this remains here. It would need to lose its static, yes, but otherwise
couldn't the function also move into the new file?
Jan
More information about the Binutils
mailing list