diff -rup a/elf/dl-deps.c b/elf/dl-deps.c --- a/elf/dl-deps.c 2012-01-23 14:28:15.888185967 -0700 +++ b/elf/dl-deps.c 2012-01-23 14:29:11.620197431 -0700 @@ -634,7 +634,7 @@ Filters not supported with LD_TRACE_PREL /* We can skip looking for the binary itself which is at the front of the search list. */ i = 1; - char seen[nlist]; + uint16_t seen[nlist]; memset (seen, 0, nlist * sizeof (seen[0])); while (1) { @@ -660,13 +660,13 @@ Filters not supported with LD_TRACE_PREL (k - i) * sizeof (l_initfini[0])); l_initfini[k] = thisp; - if (seen[i + 1] > 1) + if (seen[i + 1] > nlist - i) { ++i; goto next_clear; } - char this_seen = seen[i]; + uint16_t this_seen = seen[i]; memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0])); seen[k] = this_seen; diff -rup a/elf/dl-fini.c b/elf/dl-fini.c --- a/elf/dl-fini.c 2012-01-01 05:16:32.000000000 -0700 +++ b/elf/dl-fini.c 2012-01-23 14:29:39.661203226 -0700 @@ -39,7 +39,7 @@ _dl_sort_fini (struct link_map **maps, s /* We can skip looking for the binary itself which is at the front of the search list for the main namespace. */ unsigned int i = ns == LM_ID_BASE; - char seen[nmaps]; + uint16_t seen[nmaps]; memset (seen, 0, nmaps * sizeof (seen[0])); while (1) { @@ -79,13 +79,13 @@ _dl_sort_fini (struct link_map **maps, s used[k] = here_used; } - if (seen[i + 1] > 1) + if (seen[i + 1] > nmaps - i) { ++i; goto next_clear; } - char this_seen = seen[i]; + uint16_t this_seen = seen[i]; memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0])); seen[k] = this_seen;