+static const char *
+lookup_sym_redefinition (source)
+ const char *source;
+{
+ const char *result;
+ struct redefine_node *list;
+
+ result = source;
+
+ for (list = redefine_sym_list; list != NULL; list = list->next)
+ {
+ if (strcmp (source, list->source) == 0)
+ {
+ result = list->target;
+ break;
+ }
+ }
+ return result;
+}
+
+/* Add a node to a symbol redefine list */
+
+static void
+redefine_list_append (source, target)
+ const char *source;
+ const char *target;
+{
+ struct redefine_node **p;
+ struct redefine_node *list;
+ struct redefine_node *new_node;
+
+ for (p = &redefine_sym_list; (list = *p) != NULL; p = &list->next)
+ {
+ if (strcmp (source, list->source) == 0)
+ {
+ fatal (_("%s: Multiple redefinition of symbol \"%s\""),
+ "--redefine-sym",
+ source);
+ }
+
+ if (strcmp (target, list->target) == 0)
+ {
+ fatal (_("%s: Symbol \"%s\" is target of more than one redefinition"),
+ "--redefine-sym",
+ target);
+ }
+ }
+
+ new_node = (struct redefine_node *) xmalloc (sizeof (struct redefine_node));
+
+ new_node->source = strdup (source);
+ new_node->target = strdup (target);
+ new_node->next = NULL;
+
+ *p = new_node;
+}
+
+