aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2020-05-20 18:31:39 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-05-24 04:47:46 -0700
commitbb68f22c8e648032a0d1c1d17353eec599ff5e6a (patch)
tree1fc263456d051a8cc7f2913664b4f9e3b8356666 /ld
parent309cae1f7bbb6c4de0234e9f592d7dad3d6c61ba (diff)
downloadgdb-bb68f22c8e648032a0d1c1d17353eec599ff5e6a.zip
gdb-bb68f22c8e648032a0d1c1d17353eec599ff5e6a.tar.gz
gdb-bb68f22c8e648032a0d1c1d17353eec599ff5e6a.tar.bz2
ld: Handle --dynamic-list* before -Bsymbolic -Bsymbolic-functions
--dynamic-list* should work both before and after -Bsymbolic and -Bsymbolic-functions. PR ld/26018 * lexsup.c (parse_args): Simplify. * testsuite/ld-elf/dl4e.out: New. * testsuite/ld-elf/shared.exp: Updated for PR ld/26018 tests.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/lexsup.c37
-rw-r--r--ld/testsuite/ld-elf/dl4e.out6
-rw-r--r--ld/testsuite/ld-elf/shared.exp12
4 files changed, 37 insertions, 25 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 0a2efa1..533685b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-24 Fangrui Song <maskray@google.com>
+
+ PR ld/26018
+ * lexsup.c (parse_args): Simplify.
+ * testsuite/ld-elf/dl4e.out: New.
+ * testsuite/ld-elf/shared.exp: Updated for PR ld/26018 tests.
+
2020-05-23 H.J. Lu <hongjiu.lu@intel.com>
PR ld/26018
diff --git a/ld/lexsup.c b/ld/lexsup.c
index fe9526b..04db2f1 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1390,22 +1390,16 @@ parse_args (unsigned argc, char **argv)
break;
case OPTION_DYNAMIC_LIST_DATA:
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 (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 (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
@@ -1422,8 +1416,6 @@ parse_args (unsigned argc, char **argv)
}
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;
@@ -1632,6 +1624,19 @@ parse_args (unsigned argc, char **argv)
&& command_line.check_section_addresses < 0)
command_line.check_section_addresses = 0;
+ 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;
+ }
+
/* -Bsymbolic and -Bsymbols-functions are for shared library output. */
if (bfd_link_dll (&link_info))
switch (opt_symbolic)
@@ -1651,25 +1656,13 @@ parse_args (unsigned argc, char **argv)
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;
+ link_info.dynamic = TRUE;
+ link_info.dynamic_data = TRUE;
break;
}
- 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;
- break;
- }
-
if (!bfd_link_dll (&link_info))
{
if (command_line.filter_shlib)
diff --git a/ld/testsuite/ld-elf/dl4e.out b/ld/testsuite/ld-elf/dl4e.out
new file mode 100644
index 0000000..e5da6e2
--- /dev/null
+++ b/ld/testsuite/ld-elf/dl4e.out
@@ -0,0 +1,6 @@
+bar OK2
+bar OK4
+DSO1
+DSO2
+OK2
+OK4
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 3366430..7d35f3f 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -598,6 +598,9 @@ set build_tests {
{"Build libdl2c.so with --dynamic-list-data and dl2xxx.list"
"-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
{dl2.c dl2xxx.c} {} "libdl2c.so"}
+ {"Build libdl2d.so with --dynamic-list-data -Bsymbolic"
+ "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC"
+ {dl2.c dl2xxx.c} {} "libdl2d.so"}
{"Build libdl4a.so with --dynamic-list=dl4.list"
"-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
{dl4.c dl4xxx.c} {} "libdl4a.so"}
@@ -874,6 +877,9 @@ set run_tests [list \
[list "Run with libdl2c.so" \
"-Wl,--no-as-needed tmpdir/libdl2c.so" "" \
{dl2main.c} "dl2c" "dl2b.out" ] \
+ [list "Run with libdl2d.so" \
+ "-Wl,--no-as-needed tmpdir/libdl2d.so" "" \
+ {dl2main.c} "dl2d" "dl2a.out" ] \
[list "Run with libdl4a.so" \
"-Wl,--no-as-needed tmpdir/libdl4a.so" "" \
{dl4main.c} "dl4a" "dl4a.out" ] \
@@ -888,10 +894,10 @@ set run_tests [list \
{dl4main.c} "dl4d" "dl4b.out" ] \
[list "Run with libdl4e.so" \
"-Wl,--no-as-needed tmpdir/libdl4e.so" "" \
- {dl4main.c} "dl4e" "dl4a.out" ] \
+ {dl4main.c} "dl4e" "dl4e.out" ] \
[list "Run with libdl4f.so" \
"-Wl,--no-as-needed tmpdir/libdl4f.so" "" \
- {dl4main.c} "dl4f" "dl4a.out" ] \
+ {dl4main.c} "dl4f" "dl4e.out" ] \
[list "Run with libdata1.so" \
"-Wl,--no-as-needed tmpdir/libdata1.so" "" \
{dynbss1.c} "dynbss1" "pass.out" ] \
@@ -988,7 +994,7 @@ set dlopen_run_tests [list \
{dl6cmain.c} "dl6c1" "dl6b.out" ] \
[list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \
"-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6dmain.c} "dl6d1" "dl6b.out" ] \
+ {dl6dmain.c} "dl6d1" "dl6a.out" ] \
[list "Run pr21964-2" \
"-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-2a.so $extralibs" "" \
{pr21964-2c.c} "pr21964-2" "pass.out" ] \