(_dl_dst_substitute): When replacing ORIGIN in statically built code,
authordrepper <drepper>
Tue, 9 May 2006 21:43:03 +0000 (21:43 +0000)
committerdrepper <drepper>
Tue, 9 May 2006 21:43:03 +0000 (21:43 +0000)
be prepared to have no link map.

elf/dl-load.c

index 29fdfd8..01e1572 100644 (file)
@@ -266,7 +266,14 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
          ++name;
          if ((len = is_dst (start, name, "ORIGIN", is_path,
                             INTUSE(__libc_enable_secure))) != 0)
          ++name;
          if ((len = is_dst (start, name, "ORIGIN", is_path,
                             INTUSE(__libc_enable_secure))) != 0)
-           repl = l->l_origin;
+           {
+#ifndef SHARED
+             if (l == NULL)
+               repl = _dl_get_origin ();
+             else
+#endif
+               repl = l->l_origin;
+           }
          else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
            repl = GLRO(dl_platform);
          else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)
          else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
            repl = GLRO(dl_platform);
          else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)