diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-12-06 00:25:19 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-12-06 00:25:19 +0000 |
commit | 8fbb09e83e588193462a3c488466cb4d1a80ba98 (patch) | |
tree | bef3fb09a0e9c740386776d7ad5f3769b6a4490c /ld/emultempl | |
parent | 5c3ab52b3b9b0c3ff205d5eb0cd3530b315f517c (diff) | |
download | gdb-8fbb09e83e588193462a3c488466cb4d1a80ba98.zip gdb-8fbb09e83e588193462a3c488466cb4d1a80ba98.tar.gz gdb-8fbb09e83e588193462a3c488466cb4d1a80ba98.tar.bz2 |
Extend --copy-dt-needed-entries to creating DSO
ld/
PR ld/14915
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Also
check DT_NEEDED entries when creating shared object with
--copy-dt-needed-entries.
ld/testsuite/
PR ld/14915
* ld-elf/shared.exp (build_tests): Test --add-needed,
--copy-dt-needed-entries, --no-add-needed and
--no-copy-dt-needed-entries with -shared.
Add tests for --no-add-needed and --no-copy-dt-needed-entries
with -shared.
Diffstat (limited to 'ld/emultempl')
-rw-r--r-- | ld/emultempl/elf32.em | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 6c84b82..d30a0ad 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1181,8 +1181,6 @@ gld${EMULATION_NAME}_after_open (void) special action by the person doing the link. Note that the needed list can actually grow while we are stepping through this loop. */ - if (!link_info.executable) - return; needed = bfd_elf_get_needed_list (link_info.output_bfd, &link_info); for (l = needed; l != NULL; l = l->next) { @@ -1191,9 +1189,13 @@ gld${EMULATION_NAME}_after_open (void) int force; /* If the lib that needs this one was --as-needed and wasn't - found to be needed, then this lib isn't needed either. */ + found to be needed, then this lib isn't needed either. Skip + the lib when creating a shared object unless we are copying + DT_NEEDED entres. */ if (l->by != NULL - && (bfd_elf_get_dyn_lib_class (l->by) & DYN_AS_NEEDED) != 0) + && ((bfd_elf_get_dyn_lib_class (l->by) & DYN_AS_NEEDED) != 0 + || (!link_info.executable + && bfd_elf_get_dyn_lib_class (l->by) & DYN_NO_ADD_NEEDED) != 0)) continue; /* If we've already seen this file, skip it. */ |