[Various] libc/1609: Error in 'make check' origtest with testobj1.so
Solar Designer
solar@false.com
Thu Mar 16 20:39:00 GMT 2000
>
> There are no such dependencies. We use the same code on different
> platforms which use different shared lib positions. Also, loading
> shared objects (including ld.so) in different orders gives different
> load addresses. I'm pretty sure this cannot be the problem.
I'm not sure if this is the correct fix, but it works:
--- glibc-2.1.3/elf/dl-open.c.orig Fri Mar 17 03:28:31 2000
+++ glibc-2.1.3/elf/dl-open.c Fri Mar 17 06:09:18 2000
@@ -106,6 +106,7 @@
if (l->l_addr != 0 /* Make sure we do not currently set this map up
in this moment. */
&& caller >= (const void *) l->l_addr
+ && caller < (const void *) l->l_map_end
&& (call_map == NULL || call_map->l_addr < l->l_addr))
call_map = l;
The problem was because of this assumption, below that code:
if (call_map == NULL)
/* In this case we assume this is the main application. */
call_map = _dl_loaded;
Normally, when ld-linux.so.2 is invoked as a command (and not the
interpreter), this code should result in call_map remaining NULL when
the dlopen() call is going from origtest.c. This works because the
shared libraries are above the executable, so "caller >= (const void
*) l->l_addr" is never true. The executable itself is not on the
list in this case; it's only added when ld-linux.so.2 is used as the
interpreter.
However, with my kernel patch, shared libraries are now below the
executable. This loop results in call_map pointing to one of the
shared libraries (which is in ".." rather than "." in this test), so
${ORIGIN} is substituted for the wrong path.
Fortunately, this shouldn't be a problem for anything other than this
test, as ld-linux.so.2 isn't normally invoked as a command. When the
executable is on the list, this loop should get its address, which is
exactly what's needed.
There're several other loops like this, which are irrelevant to this
particular problem (the "make check"), but I suggest that these be
reviewed as well.
Signed,
Solar Designer
More information about the Libc-alpha
mailing list