+/* Like obj_elf_section, but issues a warning for new
+ sections which do not have an attribute specification. */
+
+static void
+h8300_elf_section (int push)
+{
+ static const char * known_data_sections [] = { ".rodata", ".tdata", ".tbss" };
+ static const char * known_data_prefixes [] = { ".debug", ".gnu.warning" };
+ char * saved_ilp = input_line_pointer;
+ char * name;
+
+ name = obj_elf_section_name ();
+ if (name == NULL)
+ return;
+
+ if (* input_line_pointer != ','
+ && bfd_get_section_by_name (stdoutput, name) == NULL)
+ {
+ signed int i;
+
+ /* Ignore this warning for well known data sections. */
+ for (i = ARRAY_SIZE (known_data_sections); i--;)
+ if (strcmp (name, known_data_sections[i]) == 0)
+ break;
+
+ if (i < 0)
+ for (i = ARRAY_SIZE (known_data_prefixes); i--;)
+ if (strncmp (name, known_data_prefixes[i],
+ strlen (known_data_prefixes[i])) == 0)
+ break;
+
+ if (i < 0)
+ as_warn (_("new section '%s' defined without attributes - this might cause problems"), name);
+ }
+
+ /* FIXME: We ought to free the memory allocated by obj_elf_section_name()
+ for 'name', but we do not know if it was taken from the obstack, via
+ demand_copy_C_string(), or xmalloc()ed. */
+ input_line_pointer = saved_ilp;
+ obj_elf_section (push);
+}
+