aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c97
1 files changed, 55 insertions, 42 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 1c15ac2..f915496 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -565,6 +565,18 @@ parse_args (unsigned argc, char **argv)
struct option *really_longopts;
int last_optind;
enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR;
+ enum symbolic_enum
+ {
+ symbolic_unset = 0,
+ symbolic,
+ symbolic_functions,
+ } opt_symbolic = symbolic_unset;
+ enum dynamic_list_enum
+ {
+ dynamic_list_unset = 0,
+ dynamic_list_data,
+ dynamic_list
+ } opt_dynamic_list = dynamic_list_unset;
shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2);
longopts = (struct option *)
@@ -1233,10 +1245,10 @@ parse_args (unsigned argc, char **argv)
config.stats = TRUE;
break;
case OPTION_SYMBOLIC:
- command_line.symbolic = symbolic;
+ opt_symbolic = symbolic;
break;
case OPTION_SYMBOLIC_FUNCTIONS:
- command_line.symbolic = symbolic_functions;
+ opt_symbolic = symbolic_functions;
break;
case 't':
++trace_files;
@@ -1381,23 +1393,23 @@ parse_args (unsigned argc, char **argv)
command_line.version_exports_section = optarg;
break;
case OPTION_DYNAMIC_LIST_DATA:
- command_line.dynamic_list = dynamic_list_data;
- if (command_line.symbolic == symbolic)
- command_line.symbolic = symbolic_unset;
+ opt_dynamic_list = dynamic_list_data;
+ if (opt_symbolic == symbolic)
+ opt_symbolic = symbolic_unset;
break;
case OPTION_DYNAMIC_LIST_CPP_TYPEINFO:
lang_append_dynamic_list_cpp_typeinfo ();
- if (command_line.dynamic_list != dynamic_list_data)
- command_line.dynamic_list = dynamic_list;
- if (command_line.symbolic == symbolic)
- command_line.symbolic = symbolic_unset;
+ if (opt_dynamic_list != dynamic_list_data)
+ opt_dynamic_list = dynamic_list;
+ if (opt_symbolic == symbolic)
+ opt_symbolic = symbolic_unset;
break;
case OPTION_DYNAMIC_LIST_CPP_NEW:
lang_append_dynamic_list_cpp_new ();
- if (command_line.dynamic_list != dynamic_list_data)
- command_line.dynamic_list = dynamic_list;
- if (command_line.symbolic == symbolic)
- command_line.symbolic = symbolic_unset;
+ if (opt_dynamic_list != dynamic_list_data)
+ opt_dynamic_list = dynamic_list;
+ if (opt_symbolic == symbolic)
+ opt_symbolic = symbolic_unset;
break;
case OPTION_DYNAMIC_LIST:
/* This option indicates a small script that only specifies
@@ -1412,10 +1424,10 @@ parse_args (unsigned argc, char **argv)
parser_input = input_dynamic_list;
yyparse ();
}
- if (command_line.dynamic_list != dynamic_list_data)
- command_line.dynamic_list = dynamic_list;
- if (command_line.symbolic == symbolic)
- command_line.symbolic = symbolic_unset;
+ if (opt_dynamic_list != dynamic_list_data)
+ opt_dynamic_list = dynamic_list;
+ if (opt_symbolic == symbolic)
+ opt_symbolic = symbolic_unset;
break;
case OPTION_WARN_COMMON:
config.warn_common = TRUE;
@@ -1625,32 +1637,33 @@ parse_args (unsigned argc, char **argv)
&& command_line.check_section_addresses < 0)
command_line.check_section_addresses = 0;
- /* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
- --dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
- --dynamic-list FILE. -Bsymbolic and -Bsymbolic-functions are
- for PIC outputs. -Bsymbolic overrides all others and vice versa. */
- switch (command_line.symbolic)
- {
- case symbolic_unset:
- break;
- case symbolic:
- /* -Bsymbolic is for PIC output only. */
- if (bfd_link_pic (&link_info))
- {
- link_info.symbolic = TRUE;
- /* Should we free the unused memory? */
- link_info.dynamic_list = NULL;
- command_line.dynamic_list = dynamic_list_unset;
- }
- break;
- case symbolic_functions:
- /* -Bsymbolic-functions is for PIC output only. */
- if (bfd_link_pic (&link_info))
- command_line.dynamic_list = dynamic_list_data;
- break;
- }
+ /* -Bsymbolic and -Bsymbols-functions are for shared library output. */
+ if (bfd_link_dll (&link_info))
+ switch (opt_symbolic)
+ {
+ case symbolic_unset:
+ break;
+ case symbolic:
+ link_info.symbolic = TRUE;
+ if (link_info.dynamic_list)
+ {
+ struct bfd_elf_version_expr *ent, *next;
+ for (ent = link_info.dynamic_list->head.list; ent; ent = next)
+ {
+ next = ent->next;
+ free (ent);
+ }
+ free (link_info.dynamic_list);
+ link_info.dynamic_list = NULL;
+ }
+ opt_dynamic_list = dynamic_list_unset;
+ break;
+ case symbolic_functions:
+ opt_dynamic_list = dynamic_list_data;
+ break;
+ }
- switch (command_line.dynamic_list)
+ switch (opt_dynamic_list)
{
case dynamic_list_unset:
break;