Split out ada_binop_in_bounds
[binutils-gdb.git] / gas / ecoff.c
index 8f884bb0042b017710a01927f16fcb840ef2d885..093c1ed3198e654b76dfdbaceaf8d98bf0c48a15 100644 (file)
@@ -1,5 +1,5 @@
 /* ECOFF debugging support.
-   Copyright (C) 1993-2020 Free Software Foundation, Inc.
+   Copyright (C) 1993-2021 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    This file was put together by Ian Lance Taylor <ian@cygnus.com>.  A
    good deal of it comes directly from mips-tfile.c, by Michael
@@ -1578,7 +1578,8 @@ add_string (varray_t *vp,                 /* string obstack */
 
       strcpy (hash_ptr->string, str);
 
-      str_hash_insert (hash_tbl, str, (char *) hash_ptr);
+      if (str_hash_insert (hash_tbl, str, hash_ptr, 0) != NULL)
+       as_fatal (_("duplicate %s"), str);
     }
 
   if (ret_hash != (shash_t **) NULL)
@@ -2030,7 +2031,7 @@ get_tag (const char *tag, /* tag name */
 
       perm = xstrdup (tag);
       hash_ptr = allocate_shash ();
-      str_hash_insert (tag_hash, perm, (char *) hash_ptr);
+      str_hash_insert (tag_hash, perm, hash_ptr, 0);
       hash_ptr->string = perm;
     }
 
@@ -3550,6 +3551,13 @@ ecoff_stab (segT sec ATTRIBUTE_UNUSED,
   cur_file_ptr = save_file_ptr;
 }
 \f
+static asection ecoff_scom_section;
+static const asymbol ecoff_scom_symbol =
+  GLOBAL_SYM_INIT (SCOMMON, &ecoff_scom_section);
+static asection ecoff_scom_section =
+  BFD_FAKE_SECTION (ecoff_scom_section, &ecoff_scom_symbol,
+                   SCOMMON, 0, SEC_IS_COMMON | SEC_SMALL_DATA);
+
 /* Frob an ECOFF symbol.  Small common symbols go into a special
    .scommon section rather than bfd_com_section.  */
 
@@ -3560,23 +3568,7 @@ ecoff_frob_symbol (symbolS *sym)
       && S_GET_VALUE (sym) > 0
       && S_GET_VALUE (sym) <= bfd_get_gp_size (stdoutput))
     {
-      static asection scom_section;
-      static asymbol scom_symbol;
-
-      /* We must construct a fake section similar to bfd_com_section
-         but with the name .scommon.  */
-      if (scom_section.name == NULL)
-       {
-         scom_section = *bfd_com_section_ptr;
-         scom_section.name = ".scommon";
-         scom_section.output_section = &scom_section;
-         scom_section.symbol = &scom_symbol;
-         scom_section.symbol_ptr_ptr = &scom_section.symbol;
-         scom_symbol = *bfd_com_section_ptr->symbol;
-         scom_symbol.name = ".scommon";
-         scom_symbol.section = &scom_section;
-       }
-      S_SET_SEGMENT (sym, &scom_section);
+      S_SET_SEGMENT (sym, &ecoff_scom_section);
     }
 
   /* Double check weak symbols.  */