Rewrite __start and __stop symbol handling
[deliverable/binutils-gdb.git] / bfd / linker.c
index f94d2f8f9e386faaa2ed29fb2eb8e7a8540af470..72d5705e639beb4af631099bd54ffb1b342323fb 100644 (file)
@@ -3095,6 +3095,43 @@ bfd_generic_define_common_symbol (bfd *output_bfd,
   return TRUE;
 }
 
+/*
+FUNCTION
+       bfd_generic_define_start_stop
+
+SYNOPSIS
+       struct bfd_link_hash_entry *bfd_generic_define_start_stop
+         (struct bfd_link_info *info,
+          const char *symbol, asection *sec);
+
+DESCRIPTION
+       Define a __start, __stop, .startof. or .sizeof. symbol.
+       Return the symbol or NULL if no such undefined symbol exists.
+
+.#define bfd_define_start_stop(output_bfd, info, symbol, sec) \
+.       BFD_SEND (output_bfd, _bfd_define_start_stop, (info, symbol, sec))
+.
+*/
+
+struct bfd_link_hash_entry *
+bfd_generic_define_start_stop (struct bfd_link_info *info,
+                              const char *symbol, asection *sec)
+{
+  struct bfd_link_hash_entry *h;
+
+  h = bfd_link_hash_lookup (info->hash, symbol, FALSE, FALSE, TRUE);
+  if (h != NULL
+      && (h->type == bfd_link_hash_undefined
+         || h->type == bfd_link_hash_undefweak))
+    {
+      h->type = bfd_link_hash_defined;
+      h->u.def.section = sec;
+      h->u.def.value = 0;
+      return h;
+    }
+  return NULL;
+}
+
 /*
 FUNCTION
        bfd_find_version_for_sym
This page took 0.024666 seconds and 4 git commands to generate.