+ if (export_list)
+ {
+ struct bfd_elf_version_expr *head = export_list->head.list;
+ struct bfd_elf_version_expr *next;
+
+ /* For --export-dynamic-symbol[-list]:
+ 1. When building executable, treat like --dynamic-list.
+ 2. When building shared object:
+ a. If -Bsymbolic or --dynamic-list are used, treat like
+ --dynamic-list.
+ b. Otherwise, ignored.
+ */
+ if (!bfd_link_relocatable (&link_info)
+ && (bfd_link_executable (&link_info)
+ || opt_symbolic != symbolic_unset
+ || opt_dynamic_list != dynamic_list_unset))
+ {
+ /* Append the export list to link_info.dynamic_list. */
+ if (link_info.dynamic_list)
+ {
+ for (next = head; next->next != NULL; next = next->next)
+ ;
+ next->next = link_info.dynamic_list->head.list;
+ link_info.dynamic_list->head.list = head;
+ }
+ else
+ link_info.dynamic_list = export_list;
+
+ if (opt_dynamic_list != dynamic_list_data)
+ opt_dynamic_list = dynamic_list;
+ }
+ else
+ {
+ /* Free the export list. */
+ for (; head->next != NULL; head = next)
+ {
+ next = head->next;
+ free (head);
+ }
+ free (export_list);
+ }
+ }
+
+ switch (opt_dynamic_list)
+ {
+ case dynamic_list_unset:
+ break;
+ case dynamic_list_data:
+ link_info.dynamic_data = TRUE;
+ /* Fall through. */
+ case dynamic_list:
+ link_info.dynamic = TRUE;
+ opt_symbolic = symbolic_unset;
+ break;
+ }
+