Skip to content

Commit 29d35fe

Browse files
Rollup merge of rust-lang#103955 - str4d:update-lto-doc-1.65, r=ehuss
Update linker-plugin-lto.md to contain up to Rust 1.65 The table rows were obtained via the script embedded in the page.
2 parents 73b5d94 + ee7a802 commit 29d35fe

File tree

1 file changed

+49
-45
lines changed

1 file changed

+49
-45
lines changed

src/doc/rustc/src/linker-plugin-lto.md

+49-45
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,47 @@ able to get around this problem by setting `-Clinker=lld-link` in RUSTFLAGS
131131

132132
## Toolchain Compatibility
133133

134-
<!-- NOTE: to update the below table, you can use this shell script:
135-
136-
```sh
137-
rustup toolchain install --profile minimal nightly
138-
MINOR_VERSION=$(rustc +nightly --version | cut -d . -f 2)
139-
LOWER_BOUND=61
140-
141-
llvm_version() {
142-
toolchain="$1"
143-
printf "Rust $toolchain | Clang "
144-
rustc +"$toolchain" -Vv | grep LLVM | cut -d ':' -f 2 | tr -d ' '
145-
}
146-
147-
for version in `seq $LOWER_BOUND $((MINOR_VERSION - 2))`; do
148-
toolchain=1.$version.0
149-
rustup toolchain install --no-self-update --profile minimal $toolchain >/dev/null 2>&1
150-
llvm_version $toolchain
151-
done
134+
<!-- NOTE: to update the below table, you can use this Python script:
135+
136+
```python
137+
from collections import defaultdict
138+
import subprocess
139+
140+
def minor_version(version):
141+
return int(version.split('.')[1])
142+
143+
INSTALL_TOOLCHAIN = ["rustup", "toolchain", "install", "--profile", "minimal"]
144+
subprocess.run(INSTALL_TOOLCHAIN + ["nightly"])
145+
146+
LOWER_BOUND = 65
147+
NIGHTLY_VERSION = minor_version(subprocess.run(
148+
["rustc", "+nightly", "--version"],
149+
capture_output=True,
150+
text=True).stdout)
151+
152+
def llvm_version(toolchain):
153+
version_text = subprocess.run(
154+
["rustc", "+{}".format(toolchain), "-Vv"],
155+
capture_output=True,
156+
text=True).stdout
157+
return int(version_text.split("LLVM")[1].split(':')[1].split('.')[0])
158+
159+
version_map = defaultdict(lambda: [])
160+
for version in range(LOWER_BOUND, NIGHTLY_VERSION - 1):
161+
toolchain = "1.{}.0".format(version)
162+
subprocess.run(
163+
INSTALL_TOOLCHAIN + ["--no-self-update", toolchain],
164+
capture_output=True)
165+
version_map[llvm_version(toolchain)].append(version)
166+
167+
print("| Rust Version | Clang Version |")
168+
print("|--------------|---------------|")
169+
for clang, rust in sorted(version_map.items()):
170+
if len(rust) > 1:
171+
rust_range = "1.{} - 1.{}".format(rust[0], rust[-1])
172+
else:
173+
rust_range = "1.{} ".format(rust[0])
174+
print("| {} | {} |".format(rust_range, clang))
152175
```
153176
154177
-->
@@ -166,32 +189,13 @@ The following table shows known good combinations of toolchain versions.
166189

167190
| Rust Version | Clang Version |
168191
|--------------|---------------|
169-
| Rust 1.34 | Clang 8 |
170-
| Rust 1.35 | Clang 8 |
171-
| Rust 1.36 | Clang 8 |
172-
| Rust 1.37 | Clang 8 |
173-
| Rust 1.38 | Clang 9 |
174-
| Rust 1.39 | Clang 9 |
175-
| Rust 1.40 | Clang 9 |
176-
| Rust 1.41 | Clang 9 |
177-
| Rust 1.42 | Clang 9 |
178-
| Rust 1.43 | Clang 9 |
179-
| Rust 1.44 | Clang 9 |
180-
| Rust 1.45 | Clang 10 |
181-
| Rust 1.46 | Clang 10 |
182-
| Rust 1.47 | Clang 11 |
183-
| Rust 1.48 | Clang 11 |
184-
| Rust 1.49 | Clang 11 |
185-
| Rust 1.50 | Clang 11 |
186-
| Rust 1.51 | Clang 11 |
187-
| Rust 1.52 | Clang 12 |
188-
| Rust 1.53 | Clang 12 |
189-
| Rust 1.54 | Clang 12 |
190-
| Rust 1.55 | Clang 12 |
191-
| Rust 1.56 | Clang 13 |
192-
| Rust 1.57 | Clang 13 |
193-
| Rust 1.58 | Clang 13 |
194-
| Rust 1.59 | Clang 13 |
195-
| Rust 1.60 | Clang 14 |
192+
| 1.34 - 1.37 | 8 |
193+
| 1.38 - 1.44 | 9 |
194+
| 1.45 - 1.46 | 10 |
195+
| 1.47 - 1.51 | 11 |
196+
| 1.52 - 1.55 | 12 |
197+
| 1.56 - 1.59 | 13 |
198+
| 1.60 - 1.64 | 14 |
199+
| 1.65 | 15 |
196200

197201
Note that the compatibility policy for this feature might change in the future.

0 commit comments

Comments
 (0)