aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-fini.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2011-10-19 17:13:56 +0200
committerAndreas Schwab <schwab@redhat.com>2011-10-20 12:03:14 +0200
commitd45c60c2feb38d95e7ad95af6edb39a6d5afba81 (patch)
tree65fa122aaf903fb10cf2d0dd9e9faea98a5adafc /elf/dl-fini.c
parent855d156018a701b3613eb4b14ab3bd09fd12f0a3 (diff)
downloadglibc-d45c60c2feb38d95e7ad95af6edb39a6d5afba81.zip
glibc-d45c60c2feb38d95e7ad95af6edb39a6d5afba81.tar.gz
glibc-d45c60c2feb38d95e7ad95af6edb39a6d5afba81.tar.bz2
Preserve link time dependencies over relocation dependencies
Diffstat (limited to 'elf/dl-fini.c')
-rw-r--r--elf/dl-fini.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index bafc83a..6df80ef 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -100,7 +100,17 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns)
/* Look through the relocation dependencies of the object. */
while (m-- > 0)
if (__builtin_expect (relmaps[m] == thisp, 0))
- goto move;
+ {
+ /* If a cycle exists with a link time dependency,
+ preserve the latter. */
+ struct link_map **runp = thisp->l_initfini;
+ if (runp != NULL)
+ while (*runp != NULL)
+ if (__builtin_expect (*runp++ == maps[k], 0))
+ goto ignore;
+ goto move;
+ }
+ ignore:;
}
--k;