]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd: rename parsing methods of object attribute v1 API
authorMatthieu Longo <matthieu.longo@arm.com>
Thu, 17 Apr 2025 10:05:16 +0000 (11:05 +0100)
committerMatthieu Longo <matthieu.longo@arm.com>
Mon, 24 Nov 2025 10:15:33 +0000 (10:15 +0000)
This patch is a preparation for the introduction of object attributes
v2. It aims at:
- making clear what methods are used to parse OAv1
- adding more constaints on parameters type by using enums instead of
defines.
- hiding the attribute tag type behind a typedef.
- preparing the move of object attributes's parsing code to another
  file.

Note: the name obj_attr_v1_process_attribute is exposed in the API.
Ideally, the version should not be part of the name, and be hidden
behind a macro. However, a later patch will unify the parsing of
OAv1 and OAv2, and will make the use of such a macro obsolete.

17 files changed:
bfd/elf-attrs.c
bfd/elf-bfd.h
bfd/elf32-arc.c
bfd/elf32-arm.c
bfd/elf32-csky.c
bfd/elf32-msp430.c
bfd/elf32-tic6x.c
bfd/elfnn-riscv.c
gas/config/obj-elf.c
gas/config/obj-elf.h
gas/config/tc-arc.c
gas/config/tc-arm.c
gas/config/tc-m68k.c
gas/config/tc-mips.c
gas/config/tc-ppc.c
gas/config/tc-riscv.c
gas/config/tc-tic6x.c

index c9d2d5dbae53251df0a04cfe8cef6a114f51fc6d..7b675ab53965875f494ec603b17c6f67a99c6c35 100644 (file)
@@ -236,7 +236,7 @@ bfd_elf_set_obj_attr_contents (bfd *abfd, bfd_byte *buffer, bfd_vma size)
 
 /* Allocate/find an object attribute.  */
 static obj_attribute *
-elf_new_obj_attr (bfd *abfd, int vendor, unsigned int tag)
+elf_new_obj_attr (bfd *abfd, obj_attr_vendor_t vendor, obj_attr_tag_t tag)
 {
   obj_attribute *attr;
   obj_attribute_list *list;
@@ -276,7 +276,9 @@ elf_new_obj_attr (bfd *abfd, int vendor, unsigned int tag)
 
 /* Return the value of an integer object attribute.  */
 int
-bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, unsigned int tag)
+bfd_elf_get_obj_attr_int (bfd *abfd,
+                         obj_attr_vendor_t vendor,
+                         obj_attr_tag_t tag)
 {
   obj_attribute_list *p;
 
@@ -302,7 +304,10 @@ bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, unsigned int tag)
 
 /* Add an integer object attribute.  */
 obj_attribute *
-bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, unsigned int tag, unsigned int i)
+bfd_elf_add_obj_attr_int (bfd *abfd,
+                         obj_attr_vendor_t vendor,
+                         obj_attr_tag_t tag,
+                         unsigned int value)
 {
   obj_attribute *attr;
 
@@ -310,7 +315,7 @@ bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, unsigned int tag, unsigned int
   if (attr != NULL)
     {
       attr->type = bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
-      attr->i = i;
+      attr->i = value;
     }
   return attr;
 }
@@ -344,7 +349,7 @@ _bfd_elf_attr_strdup (bfd *abfd, const char *s)
 
 /* Add a string object attribute.  */
 static obj_attribute *
-elf_add_obj_attr_string (bfd *abfd, int vendor, unsigned int tag,
+elf_add_obj_attr_string (bfd *abfd, obj_attr_vendor_t vendor, obj_attr_tag_t tag,
                         const char *s, const char *end)
 {
   obj_attribute *attr;
@@ -361,7 +366,9 @@ elf_add_obj_attr_string (bfd *abfd, int vendor, unsigned int tag,
 }
 
 obj_attribute *
-bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, unsigned int tag,
+bfd_elf_add_obj_attr_string (bfd *abfd,
+                            obj_attr_vendor_t vendor,
+                            obj_attr_tag_t tag,
                             const char *s)
 {
   return elf_add_obj_attr_string (abfd, vendor, tag, s, NULL);
@@ -369,8 +376,12 @@ bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, unsigned int tag,
 
 /* Add a int+string object attribute.  */
 static obj_attribute *
-elf_add_obj_attr_int_string (bfd *abfd, int vendor, unsigned int tag,
-                            unsigned int i, const char *s, const char *end)
+elf_add_obj_attr_int_string (bfd *abfd,
+                            obj_attr_vendor_t vendor,
+                            obj_attr_tag_t tag,
+                            unsigned int i,
+                            const char *s,
+                            const char *end)
 {
   obj_attribute *attr;
 
@@ -387,8 +398,11 @@ elf_add_obj_attr_int_string (bfd *abfd, int vendor, unsigned int tag,
 }
 
 obj_attribute *
-bfd_elf_add_obj_attr_int_string (bfd *abfd, int vendor, unsigned int tag,
-                                unsigned int i, const char *s)
+bfd_elf_add_obj_attr_int_string (bfd *abfd,
+                                obj_attr_vendor_t vendor,
+                                obj_attr_tag_t tag,
+                                unsigned int i,
+                                const char *s)
 {
   return elf_add_obj_attr_int_string (abfd, vendor, tag, i, s, NULL);
 }
@@ -401,7 +415,7 @@ _bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd)
   obj_attribute *out_attr;
   obj_attribute_list *list;
   int i;
-  int vendor;
+  obj_attr_vendor_t vendor;
 
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
@@ -459,7 +473,7 @@ _bfd_elf_copy_obj_attributes (bfd *ibfd, bfd *obfd)
 /* Determine whether a GNU object attribute tag takes an integer, a
    string or both.  */
 static int
-gnu_obj_attrs_arg_type (unsigned int tag)
+gnu_obj_attrs_arg_type (obj_attr_tag_t tag)
 {
   /* Except for Tag_compatibility, for GNU attributes we follow the
      same rule ARM ones > 32 follow: odd-numbered tags take strings
@@ -474,7 +488,9 @@ gnu_obj_attrs_arg_type (unsigned int tag)
 
 /* Determine what arguments an attribute tag takes.  */
 int
-bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, unsigned int tag)
+bfd_elf_obj_attrs_arg_type (bfd *abfd,
+                           obj_attr_vendor_t vendor,
+                           obj_attr_tag_t tag)
 {
   switch (vendor)
     {
index b8daceaff7f6d8c237d317759663cdd5f2af17f3..3a7784e3bcdffa8910c403f27cb478cd59b77f4a 100644 (file)
@@ -994,6 +994,8 @@ struct elf_find_verdep_info
 
 struct bfd_elf_section_reloc_data;
 
+typedef uint32_t obj_attr_tag_t;
+
 struct elf_backend_data
 {
   /* The architecture for this backend.  */
@@ -1641,7 +1643,7 @@ struct elf_backend_data
 
   /* Return 1, 2 or 3 to indicate what type of arguments a
      processor-specific tag takes.  */
-  int (*obj_attrs_arg_type) (int);
+  int (*obj_attrs_arg_type) (obj_attr_tag_t);
 
   /* The section type to use for an attributes section.  */
   unsigned int obj_attrs_section_type;
@@ -1953,15 +1955,17 @@ typedef struct obj_attribute
 typedef struct obj_attribute_list
 {
   struct obj_attribute_list *next;
-  unsigned int tag;
+  obj_attr_tag_t tag;
   obj_attribute attr;
 } obj_attribute_list;
 
 /* Object attributes may either be defined by the processor ABI, index
    OBJ_ATTR_PROC in the *_obj_attributes arrays, or be GNU-specific
    (and possibly also processor-specific), index OBJ_ATTR_GNU.  */
-#define OBJ_ATTR_PROC 0
-#define OBJ_ATTR_GNU 1
+typedef enum {
+  OBJ_ATTR_PROC,
+  OBJ_ATTR_GNU,
+} obj_attr_vendor_t;
 #define OBJ_ATTR_FIRST OBJ_ATTR_PROC
 #define OBJ_ATTR_LAST OBJ_ATTR_GNU
 
@@ -3103,29 +3107,29 @@ extern bfd *_bfd_elf64_bfd_from_remote_memory
 
 extern bfd_vma bfd_elf_obj_attr_size (bfd *);
 extern void bfd_elf_set_obj_attr_contents (bfd *, bfd_byte *, bfd_vma);
-extern int bfd_elf_get_obj_attr_int (bfd *, int, unsigned int);
+extern int bfd_elf_get_obj_attr_int (bfd *, obj_attr_vendor_t, obj_attr_tag_t);
 extern obj_attribute *bfd_elf_add_obj_attr_int
-  (bfd *, int, unsigned int, unsigned int);
+  (bfd *, obj_attr_vendor_t, obj_attr_tag_t, unsigned int);
 #define bfd_elf_add_proc_attr_int(BFD, TAG, VALUE) \
   bfd_elf_add_obj_attr_int ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
 extern obj_attribute *bfd_elf_add_obj_attr_string
-  (bfd *, int, unsigned int, const char *);
+  (bfd *, obj_attr_vendor_t, obj_attr_tag_t, const char *);
 #define bfd_elf_add_proc_attr_string(BFD, TAG, VALUE) \
   bfd_elf_add_obj_attr_string ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
 extern obj_attribute *bfd_elf_add_obj_attr_int_string
-  (bfd *, int, unsigned int, unsigned int, const char *);
+  (bfd *, obj_attr_vendor_t, obj_attr_tag_t, unsigned int, const char *);
 #define bfd_elf_add_proc_attr_int_string(BFD, TAG, INTVAL, STRVAL) \
   bfd_elf_add_obj_attr_int_string ((BFD), OBJ_ATTR_PROC, (TAG), \
                                   (INTVAL), (STRVAL))
 
-extern bool _bfd_elf_write_section_build_attributes
+extern bool _bfd_elf_write_section_object_attributes
   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
 extern char *_bfd_elf_attr_strdup
   (bfd *, const char *) ATTRIBUTE_HIDDEN;
 extern void _bfd_elf_copy_obj_attributes
   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
 extern int bfd_elf_obj_attrs_arg_type
-  (bfd *, int, unsigned int);
+  (bfd *, obj_attr_vendor_t, obj_attr_tag_t);
 extern void _bfd_elf_parse_attributes
   (bfd *, Elf_Internal_Shdr *) ATTRIBUTE_HIDDEN;
 extern bool _bfd_elf_merge_object_attributes
index ee68cfd530ce7920ff49f141132b2082a8a5028e..b5c2d9bd1dac70677e8c0f7d7fd91228f04c2bc9 100644 (file)
@@ -2909,7 +2909,7 @@ elf32_arc_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
    string or both.  */
 
 static int
-elf32_arc_obj_attrs_arg_type (int tag)
+elf32_arc_obj_attrs_arg_type (obj_attr_tag_t tag)
 {
   if (tag == Tag_ARC_CPU_name
           || tag == Tag_ARC_ISA_config
index 045837d5c42a5298d47d9a66f6374c8e608432a2..16a7544bf17523bf74b777f709097546d9faaddd 100644 (file)
@@ -13958,7 +13958,7 @@ enum
    string or both.  */
 
 static int
-elf32_arm_obj_attrs_arg_type (int tag)
+elf32_arm_obj_attrs_arg_type (obj_attr_tag_t tag)
 {
   if (tag == Tag_compatibility)
     return ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL;
index e49f8b3635545cbba5b7bcca213e305b6e11f096..239cf72fdb060de11df01660efb1023b08661f9d 100644 (file)
@@ -5253,7 +5253,7 @@ csky_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
    string or both.  */
 
 static int
-elf32_csky_obj_attrs_arg_type (int tag)
+elf32_csky_obj_attrs_arg_type (obj_attr_tag_t tag)
 {
   switch (tag)
     {
index 3b356bfe4e258ca39fcb29126ea66e12f1038db2..e6bd9ea62fba85dda6969d8a6fd4be35538a929b 100644 (file)
@@ -2680,7 +2680,7 @@ elf32_msp430_obj_attrs_handle_unknown (bfd *abfd, int tag)
    string or both.  */
 
 static int
-elf32_msp430_obj_attrs_arg_type (int tag)
+elf32_msp430_obj_attrs_arg_type (obj_attr_tag_t tag)
 {
   if (tag == Tag_compatibility)
     return ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL;
index 81ca6057e44f47cb48f3581bd132411c27aae0a7..564bb72b3e89403638ce0e2cb0987d729be35e2c 100644 (file)
@@ -3460,7 +3460,7 @@ elf32_tic6x_plt_sym_val (bfd_vma i, const asection *plt,
 }
 
 static int
-elf32_tic6x_obj_attrs_arg_type (int tag)
+elf32_tic6x_obj_attrs_arg_type (obj_attr_tag_t tag)
 {
   if (tag == Tag_ABI_compatibility)
     return ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL;
index a6bb6cfb589401a75c9ef19e55f67a95f69b3f93..a81a99014b3769f212d6037faad9745db0aa5aca 100644 (file)
@@ -5835,7 +5835,7 @@ riscv_elf_object_p (bfd *abfd)
    string or both.  */
 
 static int
-riscv_elf_obj_attrs_arg_type (int tag)
+riscv_elf_obj_attrs_arg_type (obj_attr_tag_t tag)
 {
   return (tag & 1) != 0 ? ATTR_TYPE_FLAG_STR_VAL : ATTR_TYPE_FLAG_INT_VAL;
 }
index cc1f485ae5415047bc2d9a569ed6833d99b55a9e..3b3bb645f3b952a5d9cc1807c73a3714fc8180b4 100644 (file)
@@ -2075,7 +2075,7 @@ obj_elf_vtable_entry (int ignore ATTRIBUTE_UNUSED)
 #define skip_whitespace(str)  do { if (is_whitespace (*(str))) ++(str); } while (0)
 
 static inline int
-skip_past_char (char ** str, char c)
+skip_past_char (char **str, char c)
 {
   if (**str == c)
     {
@@ -2090,23 +2090,50 @@ skip_past_char (char ** str, char c)
 /* 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.  */
-struct recorded_attribute_info {
+typedef struct recorded_attribute_info {
   struct recorded_attribute_info *next;
-  int vendor;
+  obj_attr_vendor_t vendor;
   unsigned int base;
   unsigned long mask;
-};
-static struct recorded_attribute_info *recorded_attributes;
+} recorded_attribute_info_t;
+static recorded_attribute_info_t *recorded_attributes;
+
+static void
+oav1_attr_info_free (recorded_attribute_info_t *node)
+{
+  while (node != NULL)
+    {
+      recorded_attribute_info_t *next = node->next;
+      free (node);
+      node = next;
+    }
+}
+
+static void
+oav1_attr_info_init (void)
+{
+  /* Note: this "constructor" was added for symmetry 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 and to possibly help fuzzing.  */
+  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
-record_attribute (int vendor, unsigned int tag)
+oav1_attr_record_seen (obj_attr_vendor_t vendor, obj_attr_tag_t tag)
 {
   unsigned int base;
   unsigned long mask;
-  struct recorded_attribute_info *rai;
+  recorded_attribute_info_t *rai;
 
   base = tag / (8 * sizeof (rai->mask));
   mask = 1UL << (tag % (8 * sizeof (rai->mask)));
@@ -2117,7 +2144,7 @@ record_attribute (int vendor, unsigned int tag)
        return;
       }
 
-  rai = XNEW (struct recorded_attribute_info);
+  rai = XNEW (recorded_attribute_info_t);
   rai->next = recorded_attributes;
   rai->vendor = vendor;
   rai->base = base;
@@ -2129,11 +2156,11 @@ record_attribute (int vendor, unsigned int tag)
    for vendor VENDOR.  */
 
 bool
-obj_elf_seen_attribute (int vendor, unsigned int tag)
+oav1_attr_seen (obj_attr_vendor_t vendor, obj_attr_tag_t tag)
 {
   unsigned int base;
   unsigned long mask;
-  struct recorded_attribute_info *rai;
+  recorded_attribute_info_t *rai;
 
   base = tag / (8 * sizeof (rai->mask));
   mask = 1UL << (tag % (8 * sizeof (rai->mask)));
@@ -2146,8 +2173,8 @@ obj_elf_seen_attribute (int vendor, unsigned int tag)
 /* Parse an attribute directive for VENDOR.
    Returns the attribute number read, or zero on error.  */
 
-int
-obj_elf_vendor_attribute (int vendor)
+obj_attr_tag_t
+obj_attr_v1_process_attribute (obj_attr_vendor_t vendor)
 {
   expressionS exp;
   int type;
@@ -2225,7 +2252,7 @@ obj_elf_vendor_attribute (int vendor)
       s = demand_copy_C_string (&len);
     }
 
-  record_attribute (vendor, tag);
+  oav1_attr_record_seen (vendor, tag);
   bool ok = false;
   switch (type & 3)
     {
@@ -2262,7 +2289,7 @@ obj_elf_vendor_attribute (int vendor)
 static void
 obj_elf_gnu_attribute (int ignored ATTRIBUTE_UNUSED)
 {
-  obj_elf_vendor_attribute (OBJ_ATTR_GNU);
+  obj_attr_v1_process_attribute (OBJ_ATTR_GNU);
 }
 
 void
@@ -3195,6 +3222,8 @@ elf_begin (void)
   previous_subsection = 0;
   comment_section = NULL;
   memset (&groups, 0, sizeof (groups));
+
+  oav1_attr_info_init ();
 }
 
 void
@@ -3206,17 +3235,12 @@ elf_end (void)
       section_stack = top->next;
       free (top);
     }
-  while (recorded_attributes)
-    {
-      struct recorded_attribute_info *rai = recorded_attributes;
-      recorded_attributes = rai->next;
-      free (rai);
-    }
   if (groups.indexes)
     {
       htab_delete (groups.indexes);
       free (groups.head);
     }
+  oav1_attr_info_exit ();
 }
 
 #ifdef USE_EMULATIONS
index 1e0ac588ceb051dfd8994b802c39f4d67f237f0a..637243f9ffd8121d7085a35dc7b245d9ecd2be32 100644 (file)
@@ -204,9 +204,10 @@ extern void obj_elf_vtable_inherit (int);
 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);
-extern bool obj_elf_seen_attribute
-  (int, unsigned int);
-extern int obj_elf_vendor_attribute (int);
+
+/* 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);
 
 /* 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.  */
index be1c79ac07e920451b4804b0b19afef18decd164..d5dee067ab0ad4dbab3b22f70a3bdb22af222ee7 100644 (file)
@@ -4917,7 +4917,7 @@ arc_extcorereg (int opertype)
 static void
 arc_attribute (int ignored ATTRIBUTE_UNUSED)
 {
-  int tag = obj_elf_vendor_attribute (OBJ_ATTR_PROC);
+  obj_attr_tag_t tag = obj_attr_v1_process_attribute (OBJ_ATTR_PROC);
 
   if (tag < NUM_KNOWN_OBJ_ATTRIBUTES)
     attributes_set_explicitly[tag] = true;
@@ -4926,7 +4926,7 @@ arc_attribute (int ignored ATTRIBUTE_UNUSED)
 /* Set an attribute if it has not already been set by the user.  */
 
 static void
-arc_set_attribute_int (int tag, int value)
+arc_set_attribute_int (obj_attr_tag_t tag, int value)
 {
   if (tag < 1
       || tag >= NUM_KNOWN_OBJ_ATTRIBUTES
@@ -4937,7 +4937,7 @@ arc_set_attribute_int (int tag, int value)
 }
 
 static void
-arc_set_attribute_string (int tag, const char *value)
+arc_set_attribute_string (obj_attr_tag_t tag, const char *value)
 {
   if (tag < 1
       || tag >= NUM_KNOWN_OBJ_ATTRIBUTES
index a58949f10ef9cba326fa39af989ed14cee7b4b5a..2eed286448e0c16ce208895f140ed0b756972581 100644 (file)
@@ -4972,9 +4972,9 @@ s_arm_unwind_raw (int ignored ATTRIBUTE_UNUSED)
 static void
 s_arm_eabi_attribute (int ignored ATTRIBUTE_UNUSED)
 {
-  int tag = obj_elf_vendor_attribute (OBJ_ATTR_PROC);
+  obj_attr_tag_t tag = obj_attr_v1_process_attribute (OBJ_ATTR_PROC);
 
-  if (tag >= 0 && tag < NUM_KNOWN_OBJ_ATTRIBUTES)
+  if (tag < NUM_KNOWN_OBJ_ATTRIBUTES)
     attributes_set_explicitly[tag] = 1;
 }
 
@@ -32130,7 +32130,7 @@ static const cpu_arch_ver_table cpu_arch_ver[] =
 /* Set an attribute if it has not already been set by the user.  */
 
 static void
-aeabi_set_attribute_int (int tag, int value)
+aeabi_set_attribute_int (obj_attr_tag_t tag, int value)
 {
   if (tag < 1
       || tag >= NUM_KNOWN_OBJ_ATTRIBUTES
@@ -32141,7 +32141,7 @@ aeabi_set_attribute_int (int tag, int value)
 }
 
 static void
-aeabi_set_attribute_string (int tag, const char *value)
+aeabi_set_attribute_string (obj_attr_tag_t tag, const char *value)
 {
   if (tag < 1
       || tag >= NUM_KNOWN_OBJ_ATTRIBUTES
index e5c8f5cac85889aa163e4bbb98e50606a892c6cc..73cc309c5f49328df5d4fc0c11c1acbafe61366c 100644 (file)
@@ -7917,7 +7917,7 @@ m68k_elf_cons (int nbytes /* 4=.long */)
 static void
 m68k_elf_gnu_attribute (int ignored ATTRIBUTE_UNUSED)
 {
-  int tag = obj_elf_vendor_attribute (OBJ_ATTR_GNU);
+  obj_attr_tag_t tag = obj_attr_v1_process_attribute (OBJ_ATTR_GNU);
 
   /* Check validity of defined m68k tags.  */
   if (tag == Tag_GNU_M68K_ABI_FP)
index ce996b323c5438a70183a6da8b8bdcf7e162f23f..9c59ebba0b6ca2cc72a691d879bffde2ed8dc38a 100644 (file)
@@ -20911,7 +20911,7 @@ mips_md_finish (void)
   file_mips_check_options ();
 
   /* Set a floating-point ABI if the user did not.  */
-  if (obj_elf_seen_attribute (OBJ_ATTR_GNU, Tag_GNU_MIPS_ABI_FP))
+  if (obj_attr_v1_rai_seen (OBJ_ATTR_GNU, Tag_GNU_MIPS_ABI_FP))
     {
       /* Perform consistency checks on the floating-point ABI.  */
       fpabi = bfd_elf_get_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
index 0aee3f702509bfd2ad87fc53c92599e06f26d68b..3f440a6079cba18bab84a5cf615d2424cf4aa7f6 100644 (file)
@@ -2539,7 +2539,7 @@ ppc_elf_abiversion (int ignore ATTRIBUTE_UNUSED)
 static void
 ppc_elf_gnu_attribute (int ignored ATTRIBUTE_UNUSED)
 {
-  int tag = obj_elf_vendor_attribute (OBJ_ATTR_GNU);
+  obj_attr_tag_t tag = obj_attr_v1_process_attribute (OBJ_ATTR_GNU);
 
   /* Check validity of defined powerpc tags.  */
   if (tag == Tag_GNU_Power_ABI_FP
index df60c206b82eda1c606346cac0e03c501d1ff49a..f298bd855b2f45ae67c1382c14bb1a153975eccd 100644 (file)
@@ -5803,7 +5803,7 @@ riscv_convert_symbolic_attribute (const char *name)
   static const struct
   {
     const char *name;
-    const int tag;
+    const obj_attr_tag_t tag;
   }
   attribute_table[] =
   {
@@ -5835,7 +5835,7 @@ riscv_convert_symbolic_attribute (const char *name)
 static void
 s_riscv_attribute (int ignored ATTRIBUTE_UNUSED)
 {
-  int tag = obj_elf_vendor_attribute (OBJ_ATTR_PROC);
+  obj_attr_tag_t tag = obj_attr_v1_process_attribute (OBJ_ATTR_PROC);
   unsigned old_xlen;
   obj_attribute *attr;
 
index 1ef07764c2f2ee17c18594a9af33a81888c0c164..795eb114b1494771d48371bffe0b4fc562afe235 100644 (file)
@@ -688,7 +688,7 @@ static bool tic6x_attributes_set_explicitly[NUM_KNOWN_OBJ_ATTRIBUTES];
 static void
 s_tic6x_c6xabi_attribute (int ignored ATTRIBUTE_UNUSED)
 {
-  int tag = obj_elf_vendor_attribute (OBJ_ATTR_PROC);
+  obj_attr_tag_t tag = obj_attr_v1_process_attribute (OBJ_ATTR_PROC);
 
   if (tag < NUM_KNOWN_OBJ_ATTRIBUTES)
     tic6x_attributes_set_explicitly[tag] = true;
@@ -697,7 +697,7 @@ s_tic6x_c6xabi_attribute (int ignored ATTRIBUTE_UNUSED)
 typedef struct
 {
   const char *name;
-  int tag;
+  obj_attr_tag_t tag;
 } tic6x_attribute_table;
 
 static const tic6x_attribute_table tic6x_attributes[] =
@@ -4373,7 +4373,7 @@ tic6x_frag_init (fragS *fragp)
 /* Set an attribute if it has not already been set by the user.  */
 
 static void
-tic6x_set_attribute_int (int tag, int value)
+tic6x_set_attribute_int (obj_attr_tag_t tag, int value)
 {
   if (tag < 1
       || tag >= NUM_KNOWN_OBJ_ATTRIBUTES)