bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in dependency generation of dynamic linker


From: martin . lubich
Subject: Bug in dependency generation of dynamic linker
Date: Fri, 22 Mar 2002 15:54:24 +0100

There seems to be a bug in the code for determining the correct
initialization order when loading
all dependent libraries.

Especially when using highly modular C++ libs with complex dependencies you
can observe the wrong
behaviour.

I reprocuded the problem by using the following setup:

Library        depends on

libl1.so       libpthread.so
libl2.so       libl1.so
libl3.so       libl1.so, libl2.so, libl4.so
libl4.so       libl1.so, libl2.so
libl5.so       libl1.so, libl2.so, libl4.so, libl3.so
libl6.so       libl1.so, libl2.so, libl4.so
libl7.so       libl2.so, libl3.so
libl8.so
libl9.so       libl1.so, libl2.so, libl4.so
libl10.so libl1.so, libl2.so, libl3.so, libl4.so, libl5.so, libl6.so,
libl7.so, libl8.so, libl9.so

main executable depends only on libl10.so

The initialization order in this case is:
libpthread.so
libc.so
libl2.so
libl4.so
libl3.so
libl5.so
libl6.so
libl7.so
libl8.so
libl9.so
libl1.so
libl10.so

As you can see libl1.so is initialized way too late.

The bug is located in the file elf/dl-deps.c were a bubble sort algorithm
is used to
sort the initialization array.

I have added a patch which should correct this problem.

I hope you can use it and incorporate it into future releases.

Thank you

Martin Lubich

------------------------  snip ------------------------------------

--- dl-deps.c.orig      Fri Mar 22 13:11:53 2002
+++ dl-deps.c   Fri Mar 22 13:12:14 2002
@@ -535,7 +535,8 @@
                    memmove (&map->l_initfini[j] + 1,
                             &map->l_initfini[j],
                             (k - j) * sizeof (struct link_map *));
-                   map->l_initfini[j] = here;
+                   map->l_initfini[j] = here;
+            j = k;

                    break;
                  }







reply via email to

[Prev in Thread] Current Thread [Next in Thread]