[PATCH v5 02/20] gas: move code for object attribute parsing into obj-elf-attr.c
Richard Earnshaw (lists)
Richard.Earnshaw@arm.com
Wed Jul 9 10:02:02 GMT 2025
On 07/07/2025 17:49, 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 gas/config/obj-elf-attr.h by using the TC_<arch> define (see
> existing examples in the header).
> ---
> gas/Makefile.am | 2 +
> gas/Makefile.in | 5 +
> gas/config/obj-elf-attr.c | 239 ++++++++++++++++++++++++++++++++++++++
> gas/config/obj-elf-attr.h | 52 +++++++++
> gas/config/obj-elf.c | 225 +++--------------------------------
> gas/config/obj-elf.h | 4 +-
> gas/configure | 13 +++
> gas/configure.ac | 13 +++
> gas/doc/as.texi | 2 +-
> 9 files changed, 339 insertions(+), 216 deletions(-)
> create mode 100644 gas/config/obj-elf-attr.c
> create mode 100644 gas/config/obj-elf-attr.h
>
> diff --git a/gas/Makefile.am b/gas/Makefile.am
> index 5d0358ce345..f9b2e6891ab 100644
> --- a/gas/Makefile.am
> +++ b/gas/Makefile.am
> @@ -291,6 +291,8 @@ TARGET_CPU_HFILES = \
>
> TARGET_EXTRA_FILES = \
> config/bfin-lex-wrapper.c \
> + config/obj-elf-attr.c \
> + config/obj-elf-attr.h \
> config/xtensa-relax.c \
> config/xtensa-relax.h \
> config/kvx-parse.h \
> diff --git a/gas/Makefile.in b/gas/Makefile.in
> index 1f24d4a5bbc..741621206da 100644
> --- a/gas/Makefile.in
> +++ b/gas/Makefile.in
> @@ -790,6 +790,8 @@ TARGET_CPU_HFILES = \
>
> TARGET_EXTRA_FILES = \
> config/bfin-lex-wrapper.c \
> + config/obj-elf-attr.c \
> + config/obj-elf-attr.h \
> config/xtensa-relax.c \
> config/xtensa-relax.h \
> config/kvx-parse.h \
> @@ -1244,6 +1246,8 @@ config/tc-z8k.$(OBJEXT): config/$(am__dirstamp) \
> config/$(DEPDIR)/$(am__dirstamp)
> config/bfin-lex-wrapper.$(OBJEXT): config/$(am__dirstamp) \
> config/$(DEPDIR)/$(am__dirstamp)
> +config/obj-elf-attr.$(OBJEXT): config/$(am__dirstamp) \
> + config/$(DEPDIR)/$(am__dirstamp)
> config/xtensa-relax.$(OBJEXT): config/$(am__dirstamp) \
> config/$(DEPDIR)/$(am__dirstamp)
> config/kvx-parse.$(OBJEXT): config/$(am__dirstamp) \
> @@ -1363,6 +1367,7 @@ distclean-compile:
> @AMDEP_TRUE@@am__include@ @am__quote@config/$(DEPDIR)/obj-aout.Po@am__quote@
> @AMDEP_TRUE@@am__include@ @am__quote@config/$(DEPDIR)/obj-coff.Po@am__quote@
> @AMDEP_TRUE@@am__include@ @am__quote@config/$(DEPDIR)/obj-ecoff.Po@am__quote@
> +@AMDEP_TRUE@@am__include@ @am__quote@config/$(DEPDIR)/obj-elf-attr.Po@am__quote@
> @AMDEP_TRUE@@am__include@ @am__quote@config/$(DEPDIR)/obj-elf.Po@am__quote@
> @AMDEP_TRUE@@am__include@ @am__quote@config/$(DEPDIR)/obj-evax.Po@am__quote@
> @AMDEP_TRUE@@am__include@ @am__quote@config/$(DEPDIR)/obj-fdpicelf.Po@am__quote@
> diff --git a/gas/config/obj-elf-attr.c b/gas/config/obj-elf-attr.c
> new file mode 100644
> index 00000000000..4bfbf973ea5
> --- /dev/null
> +++ b/gas/config/obj-elf-attr.c
> @@ -0,0 +1,239 @@
> +/* Object attributes parsing.
> + Copyright (C) 2025 Free Software Foundation, Inc.
> +
> + This file is part of GAS, the GNU Assembler.
> +
> + GAS is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3, or (at your option)
> + any later version.
> +
> + GAS is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with GAS; see the file COPYING. If not, write to the Free
> + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
> + 02110-1301, USA. */
> +
> +#include "obj-elf-attr.h"
> +
> +#ifdef TC_OBJ_ATTR
> +#include "safe-ctype.h"
> +
> +#define skip_whitespace(str) do { if (is_whitespace (*(str))) ++(str); } while (0)
> +
> +static inline bool
> +skip_past_char (char ** str, char c)
> +{
> + if (**str == c)
> + {
> + (*str)++;
> + return true;
> + }
> + else
> + return false;
> +}
> +#define skip_past_comma(str) skip_past_char (str, ',')
> +
> +/* A list of attributes that have been explicitly set by the assembly code.
> + VENDOR is the vendor id, BASE is the tag shifted right by the number
> + of bits in MASK, and bit N of MASK is set if tag BASE+N has been set. */
> +typedef struct recorded_attribute_info_t {
> + struct recorded_attribute_info_t *next;
> + obj_attr_vendor_t vendor;
> + unsigned int base;
> + unsigned long mask;
> +} recorded_attribute_info_t;
> +static recorded_attribute_info_t *recorded_attributes;
> +
> +static void
> +oav1_attr_info_free (recorded_attribute_info_t *node)
> +{
> + recorded_attribute_info_t *next;
> + while (node != NULL)
> + {
> + next = node->next;
> + free (node);
> + node = next;
> + }
> +}
> +
> +void
> +oav1_attr_info_init ()
> +{
> + /* Note: this "constructor" was added for symetry with oav1_attr_info_exit.
> + recorded_attributes is a static variable which is automatically initialized
> + to NULL. There is no need to initialize it another time except for a
> + cosmetic reason. */
> + recorded_attributes = NULL;
> +}
> +
> +void
> +oav1_attr_info_exit ()
> +{
> + oav1_attr_info_free (recorded_attributes);
> +}
> +
> +/* Record that we have seen an explicit specification of attribute TAG
> + for vendor VENDOR. */
> +
> +static void
> +oav1_attr_record_seen (obj_attr_vendor_t vendor, obj_attr_tag_t tag)
> +{
> + unsigned int base;
> + unsigned long mask;
> + recorded_attribute_info_t *rai;
> +
> + base = tag / (8 * sizeof (rai->mask));
> + mask = 1UL << (tag % (8 * sizeof (rai->mask)));
> + for (rai = recorded_attributes; rai; rai = rai->next)
> + if (rai->vendor == vendor && rai->base == base)
> + {
> + rai->mask |= mask;
> + return;
> + }
> +
> + rai = XNEW (recorded_attribute_info_t);
> + rai->next = recorded_attributes;
> + rai->vendor = vendor;
> + rai->base = base;
> + rai->mask = mask;
> + recorded_attributes = rai;
> +}
> +
> +/* Return true if we have seen an explicit specification of attribute TAG
> + for vendor VENDOR. */
> +
> +bool
> +oav1_attr_seen (obj_attr_vendor_t vendor, obj_attr_tag_t tag)
> +{
> + unsigned int base;
> + unsigned long mask;
> + recorded_attribute_info_t *rai;
> +
> + base = tag / (8 * sizeof (rai->mask));
> + mask = 1UL << (tag % (8 * sizeof (rai->mask)));
> + for (rai = recorded_attributes; rai; rai = rai->next)
> + if (rai->vendor == vendor && rai->base == base)
> + return (rai->mask & mask) != 0;
> + return false;
> +}
> +
> +/* Parse an attribute directive for VENDOR.
> + Returns the attribute number read, or zero on error. */
> +
> +obj_attr_tag_t
> +obj_attr_v1_process_attribute (obj_attr_vendor_t vendor)
> +{
> + expressionS exp;
> + int type;
> + int tag;
> + unsigned int i = 0;
> + char *s = NULL;
> +
> + /* Read the first number or name. */
> + skip_whitespace (input_line_pointer);
> + s = input_line_pointer;
> + if (ISDIGIT (*input_line_pointer))
> + {
> + expression (& exp);
> + if (exp.X_op != O_constant)
> + goto bad;
> + tag = exp.X_add_number;
> + }
> + else
> + {
> + char *name;
> +
> + /* A name may contain '_', but no other punctuation. */
> + for (; ISALNUM (*input_line_pointer) || *input_line_pointer == '_';
> + ++input_line_pointer)
> + i++;
> + if (i == 0)
> + goto bad;
> +
> + name = xmemdup0 (s, i);
> +
> +#ifndef CONVERT_SYMBOLIC_ATTRIBUTE
> +#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
> +#endif
> +
> + tag = CONVERT_SYMBOLIC_ATTRIBUTE (name);
> + if (tag == -1)
> + {
> + as_bad (_("Attribute name not recognised: %s"), name);
> + ignore_rest_of_line ();
> + free (name);
> + return 0;
> + }
> + free (name);
> + }
> +
> + type = _bfd_elf_obj_attrs_arg_type (stdoutput, vendor, tag);
> +
> + if (! skip_past_comma (&input_line_pointer))
> + goto bad;
> + if (type & 1)
> + {
> + expression (& exp);
> + if (exp.X_op != O_constant)
> + {
> + as_bad (_("expected numeric constant"));
> + ignore_rest_of_line ();
> + return 0;
> + }
> + i = exp.X_add_number;
> + }
> + if ((type & 3) == 3
> + && ! skip_past_comma (&input_line_pointer))
> + {
> + as_bad (_("expected comma"));
> + ignore_rest_of_line ();
> + return 0;
> + }
> + if (type & 2)
> + {
> + int len;
> +
> + skip_whitespace (input_line_pointer);
> + if (*input_line_pointer != '"')
> + goto bad_string;
> + s = demand_copy_C_string (&len);
> + }
> +
> + oav1_attr_record_seen (vendor, tag);
> + bool ok = false;
> + switch (type & 3)
> + {
> + case 3:
> + ok = bfd_elf_add_obj_attr_int_string (stdoutput, vendor, tag, i, s);
> + break;
> + case 2:
> + ok = bfd_elf_add_obj_attr_string (stdoutput, vendor, tag, s);
> + break;
> + case 1:
> + ok = bfd_elf_add_obj_attr_int (stdoutput, vendor, tag, i);
> + break;
> + default:
> + abort ();
> + }
> + if (!ok)
> + as_fatal (_("error adding attribute: %s"),
> + bfd_errmsg (bfd_get_error ()));
> +
> + demand_empty_rest_of_line ();
> + return tag;
> + bad_string:
> + as_bad (_("bad string constant"));
> + ignore_rest_of_line ();
> + return 0;
> + bad:
> + as_bad (_("expected <tag> , <value>"));
> + ignore_rest_of_line ();
> + return 0;
> +}
> +
> +#endif /* TC_OBJ_ATTR */
> diff --git a/gas/config/obj-elf-attr.h b/gas/config/obj-elf-attr.h
> new file mode 100644
> index 00000000000..e7631b8b05c
> --- /dev/null
> +++ b/gas/config/obj-elf-attr.h
> @@ -0,0 +1,52 @@
> +/* Object attributes parsing.
> + Copyright (C) 2025 Free Software Foundation, Inc.
> +
> + This file is part of GAS, the GNU Assembler.
> +
> + GAS is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3, or (at your option)
> + any later version.
> +
> + GAS is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with GAS; see the file COPYING. If not, write to the Free
> + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
> + 02110-1301, USA. */
> +
> +#ifndef _OBJ_ELF_ATTR_H
> +#define _OBJ_ELF_ATTR_H
> +
> +#include "as.h"
> +#include "bfd/elf-bfd.h"
> +
> +/* The target supports Object Attributes v1. */
> +#if OBJ_ELF \
I don't think you need to test OBJ_ELF now, this file is only built when that is true.
> + && (defined (TC_ARC) \
> + || defined (TC_ARM) \
> + || defined (TC_CSKY) \
> + || defined (TC_M68K) \
> + || defined (TC_MIPS) \
> + || defined (TC_MSP430) \
> + || defined (TC_PPC) \
> + || defined (TC_RISCV) \
> + || defined (TC_S390) \
> + || defined (TC_SPARC) \
> + || defined (TC_TIC6X))
> +#define TC_OBJ_ATTR 1
> +#endif
> +
> +#ifdef TC_OBJ_ATTR
> +
> +extern void oav1_attr_info_init (void);
> +extern void oav1_attr_info_exit (void);
> +extern bool oav1_attr_seen (obj_attr_vendor_t, obj_attr_tag_t);
> +extern obj_attr_tag_t obj_attr_v1_process_attribute (obj_attr_vendor_t);
> +
> +#endif /* TC_OBJ_ATTR */
> +
> +#endif /* _OBJ_ELF_ATTR_H */
> diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
> index 68e1b515103..3f8ee6feb50 100644
> --- a/gas/config/obj-elf.c
> +++ b/gas/config/obj-elf.c
> @@ -25,6 +25,7 @@
> #include "obstack.h"
> #include "dwarf2dbg.h"
> #include "ginsn.h"
> +#include "obj-elf-attr.h"
>
> #ifndef ECOFF_DEBUGGING
> #define ECOFF_DEBUGGING 0
> @@ -71,7 +72,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 */
> static void obj_elf_tls_common (int);
> static void obj_elf_lcomm (int);
> static void obj_elf_struct (int);
> @@ -116,7 +119,9 @@ static const pseudo_typeS elf_pseudo_table[] =
> {"vtable_entry", obj_elf_vtable_entry, 0},
>
> /* A GNU extension for object attributes. */
> +#ifdef TC_OBJ_ATTR
> {"gnu_attribute", obj_elf_gnu_attribute, 0},
> +#endif /* TC_OBJ_ATTR */
>
> /* These are used for dwarf2. */
> { "file", dwarf2_directive_file, 0 },
> @@ -2043,218 +2048,7 @@ obj_elf_vtable_entry (int ignore ATTRIBUTE_UNUSED)
> (void) obj_elf_get_vtable_entry ();
> }
>
> -#define skip_whitespace(str) do { if (is_whitespace (*(str))) ++(str); } while (0)
> -
> -static inline int
> -skip_past_char (char ** str, char c)
> -{
> - if (**str == c)
> - {
> - (*str)++;
> - return 0;
> - }
> - else
> - return -1;
> -}
> -#define skip_past_comma(str) skip_past_char (str, ',')
> -
> -/* A list of attributes that have been explicitly set by the assembly code.
> - VENDOR is the vendor id, BASE is the tag shifted right by the number
> - of bits in MASK, and bit N of MASK is set if tag BASE+N has been set. */
> -typedef struct recorded_attribute_info_t {
> - struct recorded_attribute_info_t *next;
> - obj_attr_vendor_t vendor;
> - unsigned int base;
> - unsigned long mask;
> -} recorded_attribute_info_t;
> -static recorded_attribute_info_t *recorded_attributes;
> -
> -static void
> -oav1_attr_info_free (recorded_attribute_info_t *node)
> -{
> - recorded_attribute_info_t *next;
> - while (node != NULL)
> - {
> - next = node->next;
> - free (node);
> - node = next;
> - }
> -}
> -
> -static void
> -oav1_attr_info_init (void)
> -{
> - /* Note: this "constructor" was added for symetry with oav1_attr_info_exit.
> - recorded_attributes is a static variable which is automatically initialized
> - to NULL. There is no need to initialize it another time except for a
> - cosmetic reason. */
> - recorded_attributes = NULL;
> -}
> -
> -static void
> -oav1_attr_info_exit (void)
> -{
> - oav1_attr_info_free (recorded_attributes);
> -}
> -
> -/* Record that we have seen an explicit specification of attribute TAG
> - for vendor VENDOR. */
> -
> -static void
> -oav1_attr_record_seen (obj_attr_vendor_t vendor, obj_attr_tag_t tag)
> -{
> - unsigned int base;
> - unsigned long mask;
> - recorded_attribute_info_t *rai;
> -
> - base = tag / (8 * sizeof (rai->mask));
> - mask = 1UL << (tag % (8 * sizeof (rai->mask)));
> - for (rai = recorded_attributes; rai; rai = rai->next)
> - if (rai->vendor == vendor && rai->base == base)
> - {
> - rai->mask |= mask;
> - return;
> - }
> -
> - rai = XNEW (recorded_attribute_info_t);
> - rai->next = recorded_attributes;
> - rai->vendor = vendor;
> - rai->base = base;
> - rai->mask = mask;
> - recorded_attributes = rai;
> -}
> -
> -/* Return true if we have seen an explicit specification of attribute TAG
> - for vendor VENDOR. */
> -
> -bool
> -oav1_attr_seen (obj_attr_vendor_t vendor, obj_attr_tag_t tag)
> -{
> - unsigned int base;
> - unsigned long mask;
> - recorded_attribute_info_t *rai;
> -
> - base = tag / (8 * sizeof (rai->mask));
> - mask = 1UL << (tag % (8 * sizeof (rai->mask)));
> - for (rai = recorded_attributes; rai; rai = rai->next)
> - if (rai->vendor == vendor && rai->base == base)
> - return (rai->mask & mask) != 0;
> - return false;
> -}
> -
> -/* Parse an attribute directive for VENDOR.
> - Returns the attribute number read, or zero on error. */
> -
> -obj_attr_tag_t
> -obj_attr_v1_process_attribute (obj_attr_vendor_t vendor)
> -{
> - expressionS exp;
> - int type;
> - int tag;
> - unsigned int i = 0;
> - char *s = NULL;
> -
> - /* Read the first number or name. */
> - skip_whitespace (input_line_pointer);
> - s = input_line_pointer;
> - if (ISDIGIT (*input_line_pointer))
> - {
> - expression (& exp);
> - if (exp.X_op != O_constant)
> - goto bad;
> - tag = exp.X_add_number;
> - }
> - else
> - {
> - char *name;
> -
> - /* A name may contain '_', but no other punctuation. */
> - for (; ISALNUM (*input_line_pointer) || *input_line_pointer == '_';
> - ++input_line_pointer)
> - i++;
> - if (i == 0)
> - goto bad;
> -
> - name = xmemdup0 (s, i);
> -
> -#ifndef CONVERT_SYMBOLIC_ATTRIBUTE
> -#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
> -#endif
> -
> - tag = CONVERT_SYMBOLIC_ATTRIBUTE (name);
> - if (tag == -1)
> - {
> - as_bad (_("Attribute name not recognised: %s"), name);
> - ignore_rest_of_line ();
> - free (name);
> - return 0;
> - }
> - free (name);
> - }
> -
> - type = _bfd_elf_obj_attrs_arg_type (stdoutput, vendor, tag);
> -
> - if (skip_past_comma (&input_line_pointer) == -1)
> - goto bad;
> - if (type & 1)
> - {
> - expression (& exp);
> - if (exp.X_op != O_constant)
> - {
> - as_bad (_("expected numeric constant"));
> - ignore_rest_of_line ();
> - return 0;
> - }
> - i = exp.X_add_number;
> - }
> - if ((type & 3) == 3
> - && skip_past_comma (&input_line_pointer) == -1)
> - {
> - as_bad (_("expected comma"));
> - ignore_rest_of_line ();
> - return 0;
> - }
> - if (type & 2)
> - {
> - int len;
> -
> - skip_whitespace (input_line_pointer);
> - if (*input_line_pointer != '"')
> - goto bad_string;
> - s = demand_copy_C_string (&len);
> - }
> -
> - oav1_attr_record_seen (vendor, tag);
> - bool ok = false;
> - switch (type & 3)
> - {
> - case 3:
> - ok = bfd_elf_add_obj_attr_int_string (stdoutput, vendor, tag, i, s);
> - break;
> - case 2:
> - ok = bfd_elf_add_obj_attr_string (stdoutput, vendor, tag, s);
> - break;
> - case 1:
> - ok = bfd_elf_add_obj_attr_int (stdoutput, vendor, tag, i);
> - break;
> - default:
> - abort ();
> - }
> - if (!ok)
> - as_fatal (_("error adding attribute: %s"),
> - bfd_errmsg (bfd_get_error ()));
> -
> - demand_empty_rest_of_line ();
> - return tag;
> - bad_string:
> - as_bad (_("bad string constant"));
> - ignore_rest_of_line ();
> - return 0;
> - bad:
> - as_bad (_("expected <tag> , <value>"));
> - ignore_rest_of_line ();
> - return 0;
> -}
> +#ifdef TC_OBJ_ATTR
>
> /* Parse a .gnu_attribute directive. */
>
> @@ -2264,6 +2058,8 @@ obj_elf_gnu_attribute (int ignored ATTRIBUTE_UNUSED)
> obj_attr_v1_process_attribute (OBJ_ATTR_GNU);
> }
>
> +#endif /* TC_OBJ_ATTR */
> +
> void
> elf_obj_read_begin_hook (void)
> {
> @@ -3195,7 +2991,9 @@ elf_begin (void)
> comment_section = NULL;
> memset (&groups, 0, sizeof (groups));
>
> +#ifdef TC_OBJ_ATTR
> oav1_attr_info_init ();
> +#endif /* TC_OBJ_ATTR */
> }
>
> void
> @@ -3212,7 +3010,10 @@ elf_end (void)
> htab_delete (groups.indexes);
> free (groups.head);
> }
> +
> +#ifdef TC_OBJ_ATTR
> oav1_attr_info_exit ();
> +#endif /* TC_OBJ_ATTR */
> }
>
> #ifdef USE_EMULATIONS
> diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h
> index 637243f9ffd..913921bfead 100644
> --- a/gas/config/obj-elf.h
> +++ b/gas/config/obj-elf.h
> @@ -205,9 +205,7 @@ extern void obj_elf_vtable_entry (int);
> extern struct fix * obj_elf_get_vtable_inherit (void);
> extern struct fix * obj_elf_get_vtable_entry (void);
>
> -/* Object attributes v1. */
> -extern bool oav1_attr_seen (obj_attr_vendor_t, obj_attr_tag_t);
> -extern obj_attr_tag_t obj_attr_v1_process_attribute (obj_attr_vendor_t);
> +#include "obj-elf-attr.h"
>
> /* BFD wants to write the udata field, which is a no-no for the
> predefined section symbols in bfd/section.c. They are read-only. */
> diff --git a/gas/configure b/gas/configure
> index e39c965b465..a8267993da1 100755
> --- a/gas/configure
> +++ b/gas/configure
> @@ -12349,6 +12349,19 @@ _ACEOF
> ;;
> esac
>
> + # Does the target support Object Attributes ?
> + case ${cpu_type} in
> + aarch64* | arc* | arm* | csky | m68k | mips* | msp430 | powerpc* \
> + | riscv* | s390* | sparc* | tic6x)
> + for f in config/obj-elf-attr.o; do
> + case " $extra_objects " in
> + *" $f "*) ;;
> + *) extra_objects="$extra_objects $f" ;;
> + esac
> + done
> + ;;
> + esac
> +
> # Any other special object files needed ?
> case ${cpu_type} in
>
> diff --git a/gas/configure.ac b/gas/configure.ac
> index e1d32c3b530..719f0039099 100644
> --- a/gas/configure.ac
> +++ b/gas/configure.ac
> @@ -454,6 +454,19 @@ changequote([,])dnl
> ;;
> esac
>
> + # Does the target support Object Attributes ?
> + case ${cpu_type} in
> + aarch64* | arc* | arm* | csky | m68k | mips* | msp430 | powerpc* \
> + | riscv* | s390* | sparc* | tic6x)
> + for f in config/obj-elf-attr.o; do
> + case " $extra_objects " in
> + *" $f "*) ;;
> + *) extra_objects="$extra_objects $f" ;;
> + esac
> + done
> + ;;
> + esac
> +
> # Any other special object files needed ?
> case ${cpu_type} in
>
> diff --git a/gas/doc/as.texi b/gas/doc/as.texi
> index 70c25405f87..52f863f26b8 100644
> --- a/gas/doc/as.texi
> +++ b/gas/doc/as.texi
> @@ -7985,7 +7985,7 @@ architecture-dependent ones.
>
> @subsection Common @sc{gnu} attributes
>
> -These attributes are valid on all architectures.
> +These attributes are valid on all the architectures that support OAv1.
"OAv1" will be meaningless to normal users of the tools. Perhaps something like:
The following attribute is supported on all targets that support processor-specific attribute tags as described below
>
> @table @r
> @item Tag_compatibility (32)
R.
More information about the Binutils
mailing list