This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit befd1eb
committed
Auto merge of rust-lang#116278 - Kobzol:bootstrap-lld-mode, r=albertlarsan68,petrochenkov
Generalize LLD usage in bootstrap
The current usage of using LLD (`rust.use-lld = true`) in bootstrap is a bit messy. What it claimed:
> Indicates whether LLD will be used to link Rust crates during bootstrap on
> supported platforms. The LLD from the bootstrap distribution will be used
> and not the LLD compiled during the bootstrap.
What it did:
1) On MSVC, it did indeed use the snapshot compiler's `rust-lld`, but at the same time it was invoking a global `lld` binary (since rust-lang#102101), therefore it wouldn't work if `lld` wasn't available.
2) On other targets, it was just straight up using a global `lld` linker. If it wasn't available, it would fail.
This PR (hopefully) cleans up handling of LLD in bootstrap. It introduces a new enum called `LldMode`, which explicitly distinguishes between no LLD, external LLD and self-contained LLD. Since it's non-trivial to provide a custom path to LLD, if an external `lld` is used, the linker binary has to be named exactly `lld` and it has to be available in PATH.
In addition, this PR also dog-foods [MCP510](rust-lang/compiler-team#510) in bootstrap.
To keep backwards compatibility somewhat, I kept the original `use-lld` flag and mapped the `true` value to `"external"`, which is how it behaved before on Linux and other non-MSVC targets.
Having the option to use an external `lld` on Linux should come in handy for testing on CI once MCP510 sets the default linker on Linux to `lld`.
Note that thanks to MCP510, currently "self-contained" means that `lld` is used from the stage N-1 compiler (before, we always used `lld` from the snapshot/stage0 compiler).
Best reviewed commit by commit.
CC `@petrochenkov`File tree
13 files changed
+226
-109
lines changed- src/bootstrap/src
- core
- build_steps
- config
- tests
- utils
13 files changed
+226
-109
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
651 | | - | |
652 | | - | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
653 | 655 | | |
654 | | - | |
| 656 | + | |
655 | 657 | | |
656 | 658 | | |
657 | 659 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
873 | | - | |
| 873 | + | |
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
| |||
1089 | 1089 | | |
1090 | 1090 | | |
1091 | 1091 | | |
1092 | | - | |
| 1092 | + | |
1093 | 1093 | | |
1094 | 1094 | | |
1095 | 1095 | | |
| |||
1114 | 1114 | | |
1115 | 1115 | | |
1116 | 1116 | | |
1117 | | - | |
| 1117 | + | |
1118 | 1118 | | |
1119 | 1119 | | |
1120 | 1120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | | - | |
| 414 | + | |
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
647 | | - | |
| 647 | + | |
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
| |||
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
657 | | - | |
| 657 | + | |
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
| 667 | + | |
668 | 668 | | |
669 | 669 | | |
670 | 670 | | |
| |||
768 | 768 | | |
769 | 769 | | |
770 | 770 | | |
771 | | - | |
| 771 | + | |
772 | 772 | | |
773 | 773 | | |
774 | 774 | | |
| |||
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
877 | | - | |
| 877 | + | |
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
277 | 278 | | |
278 | 279 | | |
279 | 280 | | |
280 | | - | |
| 281 | + | |
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
| |||
863 | 864 | | |
864 | 865 | | |
865 | 866 | | |
866 | | - | |
| 867 | + | |
867 | 868 | | |
868 | 869 | | |
869 | 870 | | |
| |||
1039 | 1040 | | |
1040 | 1041 | | |
1041 | 1042 | | |
1042 | | - | |
| 1043 | + | |
1043 | 1044 | | |
1044 | 1045 | | |
1045 | 1046 | | |
| |||
1746 | 1747 | | |
1747 | 1748 | | |
1748 | 1749 | | |
1749 | | - | |
| 1750 | + | |
1750 | 1751 | | |
1751 | 1752 | | |
1752 | 1753 | | |
1753 | 1754 | | |
1754 | 1755 | | |
1755 | 1756 | | |
1756 | | - | |
| 1757 | + | |
1757 | 1758 | | |
1758 | 1759 | | |
1759 | 1760 | | |
| |||
1931 | 1932 | | |
1932 | 1933 | | |
1933 | 1934 | | |
1934 | | - | |
| 1935 | + | |
1935 | 1936 | | |
1936 | 1937 | | |
1937 | 1938 | | |
| |||
3070 | 3071 | | |
3071 | 3072 | | |
3072 | 3073 | | |
3073 | | - | |
| 3074 | + | |
3074 | 3075 | | |
3075 | 3076 | | |
3076 | 3077 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | | - | |
| 836 | + | |
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
1174 | 1174 | | |
1175 | 1175 | | |
1176 | 1176 | | |
1177 | | - | |
| 1177 | + | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | 1180 | | |
| |||
1673 | 1673 | | |
1674 | 1674 | | |
1675 | 1675 | | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | | - | |
| 1676 | + | |
| 1677 | + | |
1681 | 1678 | | |
1682 | 1679 | | |
1683 | 1680 | | |
1684 | 1681 | | |
1685 | 1682 | | |
1686 | 1683 | | |
1687 | | - | |
1688 | | - | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
1689 | 1691 | | |
1690 | | - | |
1691 | | - | |
1692 | | - | |
1693 | 1692 | | |
1694 | 1693 | | |
1695 | 1694 | | |
| |||
1729 | 1728 | | |
1730 | 1729 | | |
1731 | 1730 | | |
1732 | | - | |
1733 | | - | |
| 1731 | + | |
1734 | 1732 | | |
1735 | 1733 | | |
1736 | 1734 | | |
| |||
1909 | 1907 | | |
1910 | 1908 | | |
1911 | 1909 | | |
1912 | | - | |
| 1910 | + | |
1913 | 1911 | | |
1914 | 1912 | | |
1915 | 1913 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
108 | 141 | | |
109 | 142 | | |
110 | 143 | | |
| |||
199 | 232 | | |
200 | 233 | | |
201 | 234 | | |
202 | | - | |
| 235 | + | |
203 | 236 | | |
204 | 237 | | |
205 | 238 | | |
| |||
489 | 522 | | |
490 | 523 | | |
491 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
492 | 529 | | |
493 | 530 | | |
494 | 531 | | |
| |||
977 | 1014 | | |
978 | 1015 | | |
979 | 1016 | | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
980 | 1055 | | |
981 | 1056 | | |
982 | 1057 | | |
| |||
1014 | 1089 | | |
1015 | 1090 | | |
1016 | 1091 | | |
1017 | | - | |
| 1092 | + | |
1018 | 1093 | | |
1019 | 1094 | | |
1020 | 1095 | | |
| |||
1442 | 1517 | | |
1443 | 1518 | | |
1444 | 1519 | | |
1445 | | - | |
| 1520 | + | |
1446 | 1521 | | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
1447 | 1532 | | |
1448 | 1533 | | |
1449 | 1534 | | |
| |||
0 commit comments