@@ -46,7 +46,7 @@ _dl_find_object_slow (void *pc, struct dl_find_object *result)
struct dl_find_object_internal internal;
_dl_find_object_from_map (l, &internal);
_dl_find_object_to_external (&internal, result);
- return 1;
+ return 0;
}
/* Object not found. */
@@ -71,6 +71,17 @@ la_version (unsigned int current)
TEST_VERIFY (dladdr1 (&_exit, &info, &extra_info, RTLD_DL_LINKMAP) != 0);
TEST_VERIFY (extra_info == handle);
+ /* Check _dl_find_object. */
+ struct dl_find_object dlfo;
+ TEST_COMPARE (_dl_find_object (__builtin_return_address (0), &dlfo), 0);
+ /* "ld.so" is seen with --enable-hardcoded-path-in-tests. */
+ if (strcmp (basename (dlfo.dlfo_link_map->l_name), "ld.so") != 0)
+ TEST_COMPARE_STRING (basename (dlfo.dlfo_link_map->l_name), LD_SO);
+ TEST_COMPARE (_dl_find_object (dlsym (handle, "environ"), &dlfo), 0);
+ TEST_COMPARE_STRING (basename (dlfo.dlfo_link_map->l_name), LIBC_SO);
+ TEST_COMPARE (_dl_find_object ((void *) 1, &dlfo), -1);
+ TEST_COMPARE (_dl_find_object ((void *) -1, &dlfo), -1);
+
/* Verify that dlmopen creates a new namespace. */
void *dlmopen_handle = xdlmopen (LM_ID_NEWLM, LIBC_SO, RTLD_NOW);
TEST_VERIFY (dlmopen_handle != handle);