|
Lines 619-673
Filters not supported with LD_TRACE_PRELINKING"));
|
Link Here
|
|---|
|
| 619 |
|
619 |
|
| 620 |
/* We can skip looking for the binary itself which is at the front |
620 |
/* We can skip looking for the binary itself which is at the front |
| 621 |
of the search list. */ |
621 |
of the search list. */ |
| 622 |
assert (nlist > 1); |
622 |
if (nlist > 1) |
| 623 |
i = 1; |
|
|
| 624 |
bool seen[nlist]; |
| 625 |
memset (seen, false, nlist * sizeof (seen[0])); |
| 626 |
while (1) |
| 627 |
{ |
623 |
{ |
| 628 |
/* Keep track of which object we looked at this round. */ |
624 |
i = 1; |
| 629 |
seen[i] = true; |
625 |
bool seen[nlist]; |
| 630 |
struct link_map *thisp = l_initfini[i]; |
626 |
memset (seen, false, nlist * sizeof (seen[0])); |
| 631 |
|
627 |
while (1) |
| 632 |
/* Find the last object in the list for which the current one is |
628 |
{ |
| 633 |
a dependency and move the current object behind the object |
629 |
/* Keep track of which object we looked at this round. */ |
| 634 |
with the dependency. */ |
630 |
seen[i] = true; |
| 635 |
unsigned int k = nlist - 1; |
631 |
struct link_map *thisp = l_initfini[i]; |
| 636 |
while (k > i) |
632 |
|
| 637 |
{ |
633 |
/* Find the last object in the list for which the current one is |
| 638 |
struct link_map **runp = l_initfini[k]->l_initfini; |
634 |
a dependency and move the current object behind the object |
| 639 |
if (runp != NULL) |
635 |
with the dependency. */ |
| 640 |
/* Look through the dependencies of the object. */ |
636 |
unsigned int k = nlist - 1; |
| 641 |
while (*runp != NULL) |
637 |
while (k > i) |
| 642 |
if (__builtin_expect (*runp++ == thisp, 0)) |
638 |
{ |
| 643 |
{ |
639 |
struct link_map **runp = l_initfini[k]->l_initfini; |
| 644 |
/* Move the current object to the back past the last |
640 |
if (runp != NULL) |
| 645 |
object with it as the dependency. */ |
641 |
/* Look through the dependencies of the object. */ |
| 646 |
memmove (&l_initfini[i], &l_initfini[i + 1], |
642 |
while (*runp != NULL) |
| 647 |
(k - i) * sizeof (l_initfini[0])); |
643 |
if (__builtin_expect (*runp++ == thisp, 0)) |
| 648 |
l_initfini[k] = thisp; |
644 |
{ |
| 649 |
|
645 |
/* Move the current object to the back past the last |
| 650 |
if (seen[i + 1]) |
646 |
object with it as the dependency. */ |
| 651 |
{ |
647 |
memmove (&l_initfini[i], &l_initfini[i + 1], |
| 652 |
++i; |
648 |
(k - i) * sizeof (l_initfini[0])); |
| 653 |
goto next_clear; |
649 |
l_initfini[k] = thisp; |
| 654 |
} |
650 |
|
| 655 |
|
651 |
if (seen[i + 1]) |
| 656 |
memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0])); |
652 |
{ |
| 657 |
seen[k] = true; |
653 |
++i; |
| 658 |
|
654 |
goto next_clear; |
| 659 |
goto next; |
655 |
} |
| 660 |
} |
|
|
| 661 |
|
| 662 |
--k; |
| 663 |
} |
| 664 |
|
656 |
|
| 665 |
if (++i == nlist) |
657 |
memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0])); |
| 666 |
break; |
658 |
seen[k] = true; |
| 667 |
next_clear: |
|
|
| 668 |
memset (&seen[i], false, (nlist - i) * sizeof (seen[0])); |
| 669 |
|
659 |
|
| 670 |
next:; |
660 |
goto next; |
|
|
661 |
} |
| 662 |
--k; |
| 663 |
} |
| 664 |
if (++i == nlist) |
| 665 |
break; |
| 666 |
next_clear: |
| 667 |
memset (&seen[i], false, (nlist - i) * sizeof (seen[0])); |
| 668 |
next:; |
| 669 |
} |
| 671 |
} |
670 |
} |
| 672 |
|
671 |
|
| 673 |
/* Terminate the list of dependencies. */ |
672 |
/* Terminate the list of dependencies. */ |