+/* Register a universal symbol in the VMS symbol table. */
+
+static int
+register_universal_symbol (bfd *abfd, asymbol *symbol, int vms_flags)
+{
+ bfd_vma sbase = 0;
+ asection *s, *sec = NULL;
+ vms_symbol_entry *entry;
+
+ /* A universal symbol is by definition global... */
+ symbol->flags |= BSF_GLOBAL;
+
+ /* ...and dynamic in shared libraries. */
+ if (abfd->flags & DYNAMIC)
+ symbol->flags |= BSF_DYNAMIC;
+
+ /* Find containing section. */
+ for (s = abfd->sections; s; s = s->next)
+ {
+ if (symbol->value >= s->vma
+ && s->vma > sbase
+ && !(s->flags & SEC_COFF_SHARED_LIBRARY)
+ && (s->size > 0 || !(vms_flags & EGSY_S_V_REL)))
+ {
+ sbase = s->vma;
+ sec = s;
+ }
+ }
+
+ symbol->value -= sbase;
+ symbol->section = sec;
+
+#if VMS_DEBUG
+ vms_debug (4, "EGST sym def #%d (%s, 0x%llx => 0x%llx, %04x=%s)\n",
+ abfd->symcount, symbol->name, symbol->value + sbase,
+ symbol->value, vms_flags,
+ flag2str(gsyflagdesc, vms_flags));
+#endif
+
+ entry = (vms_symbol_entry *) bfd_hash_lookup (PRIV (vms_symbol_table),
+ symbol->name,
+ TRUE, FALSE);
+
+ if (entry == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return -1;
+ }
+
+ if (entry->symbol) /* FIXME: DEC C generates this */
+ {
+#if VMS_DEBUG
+ vms_debug (4, "EGSD_S_C_SYMG: duplicate \"%s\"\n", symbol->name);
+#endif
+ }
+ else
+ {
+ entry->symbol = symbol;
+ PRIV (gsd_sym_count)++;
+ abfd->symcount++;
+ }
+
+ return 0;
+}
+
+/* Set section VMS flags. */
+
+void
+bfd_vms_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec, flagword flags)
+{
+ vms_section_data (sec)->vflags = flags;
+}