| author | bors <bors@rust-lang.org> 2026-07-01 06:26:48 UTC |
| committer | bors <bors@rust-lang.org> 2026-07-01 06:26:48 UTC |
| log | 7c5dac9c7476a30e09a5aa87b4df2c5663fe7734 |
| tree | 4094fa87d8ec1808fcee5c4a4c2bca2625e7f693 |
| parent | 17aa77551e89d5e80d4b506c9a32fc151264b8e4 |
| parent | 38002bb365a890f5c80d857a602432b96ad581ff |
Rollup of 6 pull requests
Successful merges:
- rust-lang/rust#157718 (Do not increase depth when evaluating nested goals of `NormalizesTo`)
- rust-lang/rust#158449 (QNX target renaming)
- rust-lang/rust#158483 (signed strict division: just use normal division)
- rust-lang/rust#158516 ( Deduplicate codegen backends in bootstrap config)
- rust-lang/rust#158542 (Rename `align` to `default_align` on `Scalar` and `Primitive`)
- rust-lang/rust#158636 (linkchecker: upgrade to `html5ever v0.39`)78 files changed, 648 insertions(+), 491 deletions(-)
Cargo.lock+44-65| ... | ... | @@ -1556,16 +1556,6 @@ version = "1.3.0" |
| 1556 | 1556 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1557 | 1557 | checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" |
| 1558 | 1558 | |
| 1559 | [[package]] | |
| 1560 | name = "futf" | |
| 1561 | version = "0.1.5" | |
| 1562 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 1563 | checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" | |
| 1564 | dependencies = [ | |
| 1565 | "mac", | |
| 1566 | "new_debug_unreachable", | |
| 1567 | ] | |
| 1568 | ||
| 1569 | 1559 | [[package]] |
| 1570 | 1560 | name = "generate-copyright" |
| 1571 | 1561 | version = "0.1.0" |
| ... | ... | @@ -1791,14 +1781,12 @@ dependencies = [ |
| 1791 | 1781 | |
| 1792 | 1782 | [[package]] |
| 1793 | 1783 | name = "html5ever" |
| 1794 | version = "0.29.1" | |
| 1784 | version = "0.39.0" | |
| 1795 | 1785 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1796 | checksum = "3b7410cae13cbc75623c98ac4cbfd1f0bedddf3227afc24f370cf0f50a44a11c" | |
| 1786 | checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8" | |
| 1797 | 1787 | dependencies = [ |
| 1798 | 1788 | "log", |
| 1799 | "mac", | |
| 1800 | 1789 | "markup5ever", |
| 1801 | "match_token", | |
| 1802 | 1790 | ] |
| 1803 | 1791 | |
| 1804 | 1792 | [[package]] |
| ... | ... | @@ -2424,35 +2412,15 @@ dependencies = [ |
| 2424 | 2412 | "pkg-config", |
| 2425 | 2413 | ] |
| 2426 | 2414 | |
| 2427 | [[package]] | |
| 2428 | name = "mac" | |
| 2429 | version = "0.1.1" | |
| 2430 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 2431 | checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" | |
| 2432 | ||
| 2433 | 2415 | [[package]] |
| 2434 | 2416 | name = "markup5ever" |
| 2435 | version = "0.14.1" | |
| 2417 | version = "0.39.0" | |
| 2436 | 2418 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2437 | checksum = "c7a7213d12e1864c0f002f52c2923d4556935a43dec5e71355c2760e0f6e7a18" | |
| 2419 | checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de" | |
| 2438 | 2420 | dependencies = [ |
| 2439 | 2421 | "log", |
| 2440 | "phf 0.11.3", | |
| 2441 | "phf_codegen", | |
| 2442 | "string_cache", | |
| 2443 | "string_cache_codegen", | |
| 2444 | 2422 | "tendril", |
| 2445 | ] | |
| 2446 | ||
| 2447 | [[package]] | |
| 2448 | name = "match_token" | |
| 2449 | version = "0.1.0" | |
| 2450 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 2451 | checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b" | |
| 2452 | dependencies = [ | |
| 2453 | "proc-macro2", | |
| 2454 | "quote", | |
| 2455 | "syn", | |
| 2423 | "web_atoms", | |
| 2456 | 2424 | ] |
| 2457 | 2425 | |
| 2458 | 2426 | [[package]] |
| ... | ... | @@ -2986,56 +2954,57 @@ dependencies = [ |
| 2986 | 2954 | |
| 2987 | 2955 | [[package]] |
| 2988 | 2956 | name = "phf" |
| 2989 | version = "0.11.3" | |
| 2957 | version = "0.12.1" | |
| 2990 | 2958 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2991 | checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" | |
| 2959 | checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" | |
| 2992 | 2960 | dependencies = [ |
| 2993 | "phf_shared 0.11.3", | |
| 2961 | "phf_shared 0.12.1", | |
| 2994 | 2962 | ] |
| 2995 | 2963 | |
| 2996 | 2964 | [[package]] |
| 2997 | 2965 | name = "phf" |
| 2998 | version = "0.12.1" | |
| 2966 | version = "0.13.1" | |
| 2999 | 2967 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3000 | checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" | |
| 2968 | checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" | |
| 3001 | 2969 | dependencies = [ |
| 3002 | "phf_shared 0.12.1", | |
| 2970 | "phf_shared 0.13.1", | |
| 2971 | "serde", | |
| 3003 | 2972 | ] |
| 3004 | 2973 | |
| 3005 | 2974 | [[package]] |
| 3006 | 2975 | name = "phf_codegen" |
| 3007 | version = "0.11.3" | |
| 2976 | version = "0.13.1" | |
| 3008 | 2977 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3009 | checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" | |
| 2978 | checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" | |
| 3010 | 2979 | dependencies = [ |
| 3011 | 2980 | "phf_generator", |
| 3012 | "phf_shared 0.11.3", | |
| 2981 | "phf_shared 0.13.1", | |
| 3013 | 2982 | ] |
| 3014 | 2983 | |
| 3015 | 2984 | [[package]] |
| 3016 | 2985 | name = "phf_generator" |
| 3017 | version = "0.11.3" | |
| 2986 | version = "0.13.1" | |
| 3018 | 2987 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3019 | checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" | |
| 2988 | checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" | |
| 3020 | 2989 | dependencies = [ |
| 3021 | "phf_shared 0.11.3", | |
| 3022 | "rand 0.8.5", | |
| 2990 | "fastrand", | |
| 2991 | "phf_shared 0.13.1", | |
| 3023 | 2992 | ] |
| 3024 | 2993 | |
| 3025 | 2994 | [[package]] |
| 3026 | 2995 | name = "phf_shared" |
| 3027 | version = "0.11.3" | |
| 2996 | version = "0.12.1" | |
| 3028 | 2997 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3029 | checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" | |
| 2998 | checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981" | |
| 3030 | 2999 | dependencies = [ |
| 3031 | 3000 | "siphasher", |
| 3032 | 3001 | ] |
| 3033 | 3002 | |
| 3034 | 3003 | [[package]] |
| 3035 | 3004 | name = "phf_shared" |
| 3036 | version = "0.12.1" | |
| 3005 | version = "0.13.1" | |
| 3037 | 3006 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3038 | checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981" | |
| 3007 | checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" | |
| 3039 | 3008 | dependencies = [ |
| 3040 | 3009 | "siphasher", |
| 3041 | 3010 | ] |
| ... | ... | @@ -5425,25 +5394,24 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" |
| 5425 | 5394 | |
| 5426 | 5395 | [[package]] |
| 5427 | 5396 | name = "string_cache" |
| 5428 | version = "0.8.9" | |
| 5397 | version = "0.9.0" | |
| 5429 | 5398 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5430 | checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" | |
| 5399 | checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" | |
| 5431 | 5400 | dependencies = [ |
| 5432 | 5401 | "new_debug_unreachable", |
| 5433 | 5402 | "parking_lot", |
| 5434 | "phf_shared 0.11.3", | |
| 5403 | "phf_shared 0.13.1", | |
| 5435 | 5404 | "precomputed-hash", |
| 5436 | "serde", | |
| 5437 | 5405 | ] |
| 5438 | 5406 | |
| 5439 | 5407 | [[package]] |
| 5440 | 5408 | name = "string_cache_codegen" |
| 5441 | version = "0.5.4" | |
| 5409 | version = "0.6.1" | |
| 5442 | 5410 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5443 | checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" | |
| 5411 | checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" | |
| 5444 | 5412 | dependencies = [ |
| 5445 | 5413 | "phf_generator", |
| 5446 | "phf_shared 0.11.3", | |
| 5414 | "phf_shared 0.13.1", | |
| 5447 | 5415 | "proc-macro2", |
| 5448 | 5416 | "quote", |
| 5449 | 5417 | ] |
| ... | ... | @@ -5533,12 +5501,11 @@ dependencies = [ |
| 5533 | 5501 | |
| 5534 | 5502 | [[package]] |
| 5535 | 5503 | name = "tendril" |
| 5536 | version = "0.4.3" | |
| 5504 | version = "0.5.0" | |
| 5537 | 5505 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 5538 | checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" | |
| 5506 | checksum = "c4790fc369d5a530f4b544b094e31388b9b3a37c0f4652ade4505945f5660d24" | |
| 5539 | 5507 | dependencies = [ |
| 5540 | "futf", | |
| 5541 | "mac", | |
| 5508 | "new_debug_unreachable", | |
| 5542 | 5509 | "utf-8", |
| 5543 | 5510 | ] |
| 5544 | 5511 | |
| ... | ... | @@ -6503,6 +6470,18 @@ dependencies = [ |
| 6503 | 6470 | "wasm-bindgen", |
| 6504 | 6471 | ] |
| 6505 | 6472 | |
| 6473 | [[package]] | |
| 6474 | name = "web_atoms" | |
| 6475 | version = "0.2.5" | |
| 6476 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
| 6477 | checksum = "075474b12bcb3d2e3d4546580e9de478eeeead668a1761e2a8860c836b7ef297" | |
| 6478 | dependencies = [ | |
| 6479 | "phf 0.13.1", | |
| 6480 | "phf_codegen", | |
| 6481 | "string_cache", | |
| 6482 | "string_cache_codegen", | |
| 6483 | ] | |
| 6484 | ||
| 6506 | 6485 | [[package]] |
| 6507 | 6486 | name = "winapi-util" |
| 6508 | 6487 | version = "0.1.11" |
compiler/rustc_abi/src/layout.rs+6-3| ... | ... | @@ -477,12 +477,14 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> { |
| 477 | 477 | Ok(Some((repr, _))) => match repr { |
| 478 | 478 | // Mismatched alignment (e.g. union is #[repr(packed)]): disable opt |
| 479 | 479 | BackendRepr::Scalar(_) | BackendRepr::ScalarPair(_, _) |
| 480 | if repr.scalar_align(dl).unwrap() != align => | |
| 480 | if repr.scalar_platform_align(dl).unwrap() != align => | |
| 481 | 481 | { |
| 482 | 482 | BackendRepr::Memory { sized: true } |
| 483 | 483 | } |
| 484 | 484 | // Vectors require at least element alignment, else disable the opt |
| 485 | BackendRepr::SimdVector { element, count: _ } if element.align(dl).abi > align => { | |
| 485 | BackendRepr::SimdVector { element, count: _ } | |
| 486 | if element.default_align(dl).abi > align => | |
| 487 | { | |
| 486 | 488 | BackendRepr::Memory { sized: true } |
| 487 | 489 | } |
| 488 | 490 | // the alignment tests passed and we can use this |
| ... | ... | @@ -986,7 +988,8 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> { |
| 986 | 988 | // roundtripping pointers through ptrtoint/inttoptr. |
| 987 | 989 | (p @ Primitive::Pointer(_), i @ Primitive::Int(..)) |
| 988 | 990 | | (i @ Primitive::Int(..), p @ Primitive::Pointer(_)) |
| 989 | if p.size(dl) == i.size(dl) && p.align(dl) == i.align(dl) => | |
| 991 | if p.size(dl) == i.size(dl) | |
| 992 | && p.default_align(dl) == i.default_align(dl) => | |
| 990 | 993 | { |
| 991 | 994 | p |
| 992 | 995 | } |
compiler/rustc_abi/src/layout/simple.rs+3-3| ... | ... | @@ -49,7 +49,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> { |
| 49 | 49 | pub fn scalar<C: HasDataLayout>(cx: &C, scalar: Scalar) -> Self { |
| 50 | 50 | let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar); |
| 51 | 51 | let size = scalar.size(cx); |
| 52 | let align = scalar.align(cx); | |
| 52 | let align = scalar.default_align(cx); | |
| 53 | 53 | |
| 54 | 54 | let range = scalar.valid_range(cx); |
| 55 | 55 | |
| ... | ... | @@ -90,8 +90,8 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> { |
| 90 | 90 | |
| 91 | 91 | pub fn scalar_pair<C: HasDataLayout>(cx: &C, a: Scalar, b: Scalar) -> Self { |
| 92 | 92 | let dl = cx.data_layout(); |
| 93 | let b_align = b.align(dl).abi; | |
| 94 | let align = a.align(dl).abi.max(b_align).max(dl.aggregate_align); | |
| 93 | let b_align = b.default_align(dl).abi; | |
| 94 | let align = a.default_align(dl).abi.max(b_align).max(dl.aggregate_align); | |
| 95 | 95 | let b_offset = a.size(dl).align_to(b_align); |
| 96 | 96 | let size = (b_offset + b.size(dl)).align_to(align); |
| 97 | 97 |
compiler/rustc_abi/src/lib.rs+30-8| ... | ... | @@ -1404,7 +1404,11 @@ impl Primitive { |
| 1404 | 1404 | } |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | pub fn align<C: HasDataLayout>(self, cx: &C) -> AbiAlign { | |
| 1407 | /// The *platform-specific* ABI alignment of this primitive. | |
| 1408 | /// | |
| 1409 | /// This is the type alignment for the corresponding built-in. | |
| 1410 | /// In other contexts it might have different alignment. | |
| 1411 | pub fn default_align<C: HasDataLayout>(self, cx: &C) -> AbiAlign { | |
| 1408 | 1412 | use Primitive::*; |
| 1409 | 1413 | let dl = cx.data_layout(); |
| 1410 | 1414 | |
| ... | ... | @@ -1579,8 +1583,12 @@ impl Scalar { |
| 1579 | 1583 | } |
| 1580 | 1584 | } |
| 1581 | 1585 | |
| 1582 | pub fn align(self, cx: &impl HasDataLayout) -> AbiAlign { | |
| 1583 | self.primitive().align(cx) | |
| 1586 | /// The *platform-specific* ABI alignment of this scalar. | |
| 1587 | /// | |
| 1588 | /// This is the type alignment for the corresponding built-in. | |
| 1589 | /// This is *not* necessarily the correct alignment for a type that has this `BackendRepr::Scalar`! | |
| 1590 | pub fn default_align(self, cx: &impl HasDataLayout) -> AbiAlign { | |
| 1591 | self.primitive().default_align(cx) | |
| 1584 | 1592 | } |
| 1585 | 1593 | |
| 1586 | 1594 | pub fn size(self, cx: &impl HasDataLayout) -> Size { |
| ... | ... | @@ -1792,6 +1800,14 @@ impl IntoDiagArg for NumScalableVectors { |
| 1792 | 1800 | #[cfg_attr(feature = "nightly", derive(StableHash))] |
| 1793 | 1801 | pub enum BackendRepr { |
| 1794 | 1802 | Scalar(Scalar), |
| 1803 | /// The data contained in this type can be entirely represented by two scalars. | |
| 1804 | /// The two scalars are listed in *memory* order, so the first is at offset zero | |
| 1805 | /// and the second at a non-zero offset. | |
| 1806 | /// These need not be `FieldIdx(0)` and `FieldIdx(1)`. | |
| 1807 | /// | |
| 1808 | /// As of June 2026 the offset to the second scalar is the size of the first | |
| 1809 | /// scalar rounded up to the platform alignment of the second scalar. | |
| 1810 | /// That may soon change, however; see MCP#1007. | |
| 1795 | 1811 | ScalarPair(Scalar, Scalar), |
| 1796 | 1812 | SimdScalableVector { |
| 1797 | 1813 | element: Scalar, |
| ... | ... | @@ -1857,10 +1873,16 @@ impl BackendRepr { |
| 1857 | 1873 | /// The psABI alignment for a `Scalar` or `ScalarPair` |
| 1858 | 1874 | /// |
| 1859 | 1875 | /// `None` for other variants. |
| 1860 | pub fn scalar_align<C: HasDataLayout>(&self, cx: &C) -> Option<Align> { | |
| 1876 | /// | |
| 1877 | /// It's unclear whether this is a meaningful operation, and MCP#1007 proposes changes. | |
| 1878 | /// You should generally be using the alignment of the place or the type, | |
| 1879 | /// not calculating something from the `Scalar`s. | |
| 1880 | pub fn scalar_platform_align<C: HasDataLayout>(&self, cx: &C) -> Option<Align> { | |
| 1861 | 1881 | match *self { |
| 1862 | BackendRepr::Scalar(s) => Some(s.align(cx).abi), | |
| 1863 | BackendRepr::ScalarPair(s1, s2) => Some(s1.align(cx).max(s2.align(cx)).abi), | |
| 1882 | BackendRepr::Scalar(s) => Some(s.default_align(cx).abi), | |
| 1883 | BackendRepr::ScalarPair(s1, s2) => { | |
| 1884 | Some(s1.default_align(cx).max(s2.default_align(cx)).abi) | |
| 1885 | } | |
| 1864 | 1886 | // The align of a Vector can vary in surprising ways |
| 1865 | 1887 | BackendRepr::SimdVector { .. } |
| 1866 | 1888 | | BackendRepr::Memory { .. } |
| ... | ... | @@ -1877,9 +1899,9 @@ impl BackendRepr { |
| 1877 | 1899 | BackendRepr::Scalar(s) => Some(s.size(cx)), |
| 1878 | 1900 | // May have some padding between the pair. |
| 1879 | 1901 | BackendRepr::ScalarPair(s1, s2) => { |
| 1880 | let field2_offset = s1.size(cx).align_to(s2.align(cx).abi); | |
| 1902 | let field2_offset = s1.size(cx).align_to(s2.default_align(cx).abi); | |
| 1881 | 1903 | let size = (field2_offset + s2.size(cx)).align_to( |
| 1882 | self.scalar_align(cx) | |
| 1904 | self.scalar_platform_align(cx) | |
| 1883 | 1905 | // We absolutely must have an answer here or everything is FUBAR. |
| 1884 | 1906 | .unwrap(), |
| 1885 | 1907 | ); |
compiler/rustc_codegen_cranelift/src/value_and_place.rs+1-1| ... | ... | @@ -56,7 +56,7 @@ fn codegen_field<'tcx>( |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | fn scalar_pair_calculate_b_offset(tcx: TyCtxt<'_>, a_scalar: Scalar, b_scalar: Scalar) -> Offset32 { |
| 59 | let b_offset = a_scalar.size(&tcx).align_to(b_scalar.align(&tcx).abi); | |
| 59 | let b_offset = a_scalar.size(&tcx).align_to(b_scalar.default_align(&tcx).abi); | |
| 60 | 60 | Offset32::new(b_offset.bytes().try_into().unwrap()) |
| 61 | 61 | } |
| 62 | 62 |
compiler/rustc_codegen_gcc/src/builder.rs+1-1| ... | ... | @@ -1065,7 +1065,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { |
| 1065 | 1065 | }, |
| 1066 | 1066 | ) |
| 1067 | 1067 | } else if let abi::BackendRepr::ScalarPair(ref a, ref b) = place.layout.backend_repr { |
| 1068 | let b_offset = a.size(self).align_to(b.align(self).abi); | |
| 1068 | let b_offset = a.size(self).align_to(b.default_align(self).abi); | |
| 1069 | 1069 | |
| 1070 | 1070 | let mut load = |i, scalar: &abi::Scalar, align| { |
| 1071 | 1071 | let ptr = if i == 0 { |
compiler/rustc_codegen_gcc/src/type_of.rs+2-1| ... | ... | @@ -325,7 +325,8 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> { |
| 325 | 325 | return cx.type_i1(); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | let offset = if index == 0 { Size::ZERO } else { a.size(cx).align_to(b.align(cx).abi) }; | |
| 328 | let offset = | |
| 329 | if index == 0 { Size::ZERO } else { a.size(cx).align_to(b.default_align(cx).abi) }; | |
| 329 | 330 | self.scalar_gcc_type_at(cx, scalar, offset) |
| 330 | 331 | } |
| 331 | 332 |
compiler/rustc_codegen_llvm/src/builder.rs+1-1| ... | ... | @@ -794,7 +794,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { |
| 794 | 794 | }); |
| 795 | 795 | OperandValue::Immediate(llval) |
| 796 | 796 | } else if let abi::BackendRepr::ScalarPair(a, b) = place.layout.backend_repr { |
| 797 | let b_offset = a.size(self).align_to(b.align(self).abi); | |
| 797 | let b_offset = a.size(self).align_to(b.default_align(self).abi); | |
| 798 | 798 | |
| 799 | 799 | let mut load = |i, scalar: abi::Scalar, layout, align, offset| { |
| 800 | 800 | let llptr = if i == 0 { |
compiler/rustc_codegen_ssa/src/mir/operand.rs+3-3| ... | ... | @@ -227,7 +227,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { |
| 227 | 227 | b @ abi::Scalar::Initialized { .. }, |
| 228 | 228 | ) => { |
| 229 | 229 | let (a_size, b_size) = (a.size(bx), b.size(bx)); |
| 230 | let b_offset = (offset + a_size).align_to(b.align(bx).abi); | |
| 230 | let b_offset = (offset + a_size).align_to(b.default_align(bx).abi); | |
| 231 | 231 | assert!(b_offset.bytes() > 0); |
| 232 | 232 | let a_val = read_scalar( |
| 233 | 233 | offset, |
| ... | ... | @@ -388,7 +388,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { |
| 388 | 388 | assert_eq!(field.size, a.size(bx.cx())); |
| 389 | 389 | (Some(a), a_llval) |
| 390 | 390 | } else { |
| 391 | assert_eq!(offset, a.size(bx.cx()).align_to(b.align(bx.cx()).abi)); | |
| 391 | assert_eq!(offset, a.size(bx.cx()).align_to(b.default_align(bx.cx()).abi)); | |
| 392 | 392 | assert_eq!(field.size, b.size(bx.cx())); |
| 393 | 393 | (Some(b), b_llval) |
| 394 | 394 | } |
| ... | ... | @@ -962,7 +962,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> { |
| 962 | 962 | let BackendRepr::ScalarPair(a_scalar, b_scalar) = dest.layout.backend_repr else { |
| 963 | 963 | bug!("store_with_flags: invalid ScalarPair layout: {:#?}", dest.layout); |
| 964 | 964 | }; |
| 965 | let b_offset = a_scalar.size(bx).align_to(b_scalar.align(bx).abi); | |
| 965 | let b_offset = a_scalar.size(bx).align_to(b_scalar.default_align(bx).abi); | |
| 966 | 966 | |
| 967 | 967 | let val = bx.from_immediate(a); |
| 968 | 968 | let align = dest.val.align; |
compiler/rustc_const_eval/src/interpret/operand.rs+2-2| ... | ... | @@ -419,7 +419,7 @@ impl<'tcx, Prov: Provenance> ImmTy<'tcx, Prov> { |
| 419 | 419 | Immediate::from(if offset.bytes() == 0 { |
| 420 | 420 | a_val |
| 421 | 421 | } else { |
| 422 | assert_eq!(offset, a.size(cx).align_to(b.align(cx).abi)); | |
| 422 | assert_eq!(offset, a.size(cx).align_to(b.default_align(cx).abi)); | |
| 423 | 423 | b_val |
| 424 | 424 | }) |
| 425 | 425 | } |
| ... | ... | @@ -614,7 +614,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { |
| 614 | 614 | // We would anyway check against `ptr_align.restrict_for_offset(b_offset)`, |
| 615 | 615 | // which `ptr.offset(b_offset)` cannot possibly fail to satisfy. |
| 616 | 616 | let (a_size, b_size) = (a.size(self), b.size(self)); |
| 617 | let b_offset = a_size.align_to(b.align(self).abi); | |
| 617 | let b_offset = a_size.align_to(b.default_align(self).abi); | |
| 618 | 618 | assert!(b_offset.bytes() > 0); // in `operand_field` we use the offset to tell apart the fields |
| 619 | 619 | let a_val = alloc.read_scalar( |
| 620 | 620 | alloc_range(Size::ZERO, a_size), |
compiler/rustc_const_eval/src/interpret/place.rs+1-1| ... | ... | @@ -733,7 +733,7 @@ where |
| 733 | 733 | ) |
| 734 | 734 | }; |
| 735 | 735 | let a_size = a_val.size(); |
| 736 | let b_offset = a_size.align_to(b.align(&tcx).abi); | |
| 736 | let b_offset = a_size.align_to(b.default_align(&tcx).abi); | |
| 737 | 737 | assert!(b_offset.bytes() > 0); // in `operand_field` we use the offset to tell apart the fields |
| 738 | 738 | |
| 739 | 739 | // It is tempting to verify `b_offset` against `layout.fields.offset(1)`, |
compiler/rustc_mir_transform/src/gvn.rs+1-1| ... | ... | @@ -742,7 +742,7 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> { |
| 742 | 742 | a1.size(&self.ecx) == a2.size(&self.ecx) |
| 743 | 743 | && b1.size(&self.ecx) == b2.size(&self.ecx) |
| 744 | 744 | // The alignment of the second component determines its offset, so that also needs to match. |
| 745 | && b1.align(&self.ecx) == b2.align(&self.ecx) | |
| 745 | && b1.default_align(&self.ecx) == b2.default_align(&self.ecx) | |
| 746 | 746 | // None of the inputs may be a pointer. |
| 747 | 747 | && !matches!(a1.primitive(), Primitive::Pointer(..)) |
| 748 | 748 | && !matches!(b1.primitive(), Primitive::Pointer(..)) |
compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs+7-3| ... | ... | @@ -8,7 +8,7 @@ use rustc_type_ir::inherent::*; |
| 8 | 8 | use rustc_type_ir::region_constraint::RegionConstraint; |
| 9 | 9 | use rustc_type_ir::relate::Relate; |
| 10 | 10 | use rustc_type_ir::relate::solver_relating::RelateExt; |
| 11 | use rustc_type_ir::search_graph::{CandidateHeadUsages, PathKind}; | |
| 11 | use rustc_type_ir::search_graph::{CandidateHeadUsages, IncreaseDepthForNested, PathKind}; | |
| 12 | 12 | use rustc_type_ir::solve::{ |
| 13 | 13 | AccessedOpaques, ExternalRegionConstraints, FetchEligibleAssocItemResponse, MaybeInfo, |
| 14 | 14 | NoSolutionOrRerunNonErased, OpaqueTypesJank, QueryResultOrRerunNonErased, RerunCondition, |
| ... | ... | @@ -484,7 +484,7 @@ where |
| 484 | 484 | stalled_on: Option<GoalStalledOn<I>>, |
| 485 | 485 | ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> { |
| 486 | 486 | let (normalization_nested_goals, goal_evaluation) = |
| 487 | self.evaluate_goal_raw(source, goal, stalled_on)?; | |
| 487 | self.evaluate_goal_raw(source, goal, stalled_on, IncreaseDepthForNested::Yes)?; | |
| 488 | 488 | assert!(normalization_nested_goals.is_empty()); |
| 489 | 489 | Ok(goal_evaluation) |
| 490 | 490 | } |
| ... | ... | @@ -576,6 +576,7 @@ where |
| 576 | 576 | source: GoalSource, |
| 577 | 577 | goal: Goal<I, I::Predicate>, |
| 578 | 578 | stalled_on: Option<GoalStalledOn<I>>, |
| 579 | increase_depth_for_nested: IncreaseDepthForNested, | |
| 579 | 580 | ) -> Result<(NestedNormalizationGoals<I>, GoalEvaluation<I>), NoSolutionOrRerunNonErased> { |
| 580 | 581 | if let RerunStalled::WontMakeProgress(stalled_certainty) = |
| 581 | 582 | self.rerunning_stalled_goal_may_make_progress(stalled_on.as_ref()) |
| ... | ... | @@ -591,7 +592,7 @@ where |
| 591 | 592 | )); |
| 592 | 593 | } |
| 593 | 594 | |
| 594 | self.evaluate_goal_cold(source, goal) | |
| 595 | self.evaluate_goal_cold(source, goal, increase_depth_for_nested) | |
| 595 | 596 | } |
| 596 | 597 | |
| 597 | 598 | #[cold] |
| ... | ... | @@ -600,6 +601,7 @@ where |
| 600 | 601 | &mut self, |
| 601 | 602 | source: GoalSource, |
| 602 | 603 | goal: Goal<I, I::Predicate>, |
| 604 | increase_depth_for_nested: IncreaseDepthForNested, | |
| 603 | 605 | ) -> Result<(NestedNormalizationGoals<I>, GoalEvaluation<I>), NoSolutionOrRerunNonErased> { |
| 604 | 606 | // We only care about one entry per `OpaqueTypeKey` here, |
| 605 | 607 | // so we only canonicalize the lookup table and ignore |
| ... | ... | @@ -663,6 +665,7 @@ where |
| 663 | 665 | self.cx(), |
| 664 | 666 | canonical_goal, |
| 665 | 667 | step_kind, |
| 668 | increase_depth_for_nested, | |
| 666 | 669 | &mut inspect::ProofTreeBuilder::new_noop(), |
| 667 | 670 | ); |
| 668 | 671 | |
| ... | ... | @@ -702,6 +705,7 @@ where |
| 702 | 705 | self.cx(), |
| 703 | 706 | canonical_goal, |
| 704 | 707 | step_kind, |
| 708 | increase_depth_for_nested, | |
| 705 | 709 | &mut inspect::ProofTreeBuilder::new_noop(), |
| 706 | 710 | ); |
| 707 | 711 | assert!( |
compiler/rustc_next_trait_solver/src/solve/project_goals/mod.rs+14-1| ... | ... | @@ -3,6 +3,7 @@ mod free_alias; |
| 3 | 3 | mod inherent; |
| 4 | 4 | mod opaque_types; |
| 5 | 5 | |
| 6 | use rustc_type_ir::search_graph::IncreaseDepthForNested; | |
| 6 | 7 | use rustc_type_ir::solve::QueryResultOrRerunNonErased; |
| 7 | 8 | use rustc_type_ir::{self as ty, Interner, ProjectionPredicate}; |
| 8 | 9 | use tracing::{instrument, trace}; |
| ... | ... | @@ -67,7 +68,19 @@ where |
| 67 | 68 | let ( |
| 68 | 69 | NestedNormalizationGoals(nested_goals), |
| 69 | 70 | GoalEvaluation { goal: _, certainty, stalled_on: _, has_changed: _ }, |
| 70 | ) = self.evaluate_goal_raw(GoalSource::TypeRelating, normalizes_to, None)?; | |
| 71 | ) = self.evaluate_goal_raw( | |
| 72 | GoalSource::TypeRelating, | |
| 73 | normalizes_to, | |
| 74 | None, | |
| 75 | // We don't increase depth for nested goals for this `NormalizesTo` goal, as | |
| 76 | // evaluating `NormalizesTo` is an extra step only exists in the new solver | |
| 77 | // that behaves like a function call rather than an independent nested goal | |
| 78 | // evaluation, so increasing the depth may end up regressions which hit the | |
| 79 | // recursion limits for crates compiled well with the old solver. Furthermore, | |
| 80 | // those nested goals from `NormalizesTo` will be evaluated again as the | |
| 81 | // caller's nested goals with increased depths anyway. | |
| 82 | IncreaseDepthForNested::No, | |
| 83 | )?; | |
| 71 | 84 | |
| 72 | 85 | trace!(?nested_goals); |
| 73 | 86 |
compiler/rustc_target/src/callconv/mod.rs+1-1| ... | ... | @@ -399,7 +399,7 @@ impl<'a, Ty> ArgAbi<'a, Ty> { |
| 399 | 399 | BackendRepr::Scalar(scalar) => PassMode::Direct(scalar_attrs(scalar, Size::ZERO)), |
| 400 | 400 | BackendRepr::ScalarPair(a, b) => PassMode::Pair( |
| 401 | 401 | scalar_attrs(a, Size::ZERO), |
| 402 | scalar_attrs(b, a.size(cx).align_to(b.align(cx).abi)), | |
| 402 | scalar_attrs(b, a.size(cx).align_to(b.default_align(cx).abi)), | |
| 403 | 403 | ), |
| 404 | 404 | BackendRepr::SimdVector { .. } => PassMode::Direct(ArgAttributes::new()), |
| 405 | 405 | BackendRepr::Memory { .. } => Self::indirect_pass_mode(&layout), |
compiler/rustc_target/src/spec/base/mod.rs+1-1| ... | ... | @@ -26,8 +26,8 @@ pub(crate) mod managarm_mlibc; |
| 26 | 26 | pub(crate) mod motor; |
| 27 | 27 | pub(crate) mod msvc; |
| 28 | 28 | pub(crate) mod netbsd; |
| 29 | pub(crate) mod nto_qnx; | |
| 30 | 29 | pub(crate) mod openbsd; |
| 30 | pub(crate) mod qnx_sdp; | |
| 31 | 31 | pub(crate) mod redox; |
| 32 | 32 | pub(crate) mod solaris; |
| 33 | 33 | pub(crate) mod solid; |
compiler/rustc_target/src/spec/base/nto_qnx.rs deleted-116| ... | ... | @@ -1,116 +0,0 @@ |
| 1 | use crate::spec::{ | |
| 2 | Cc, LinkArgs, LinkerFlavor, Lld, Os, RelroLevel, Target, TargetMetadata, TargetOptions, cvs, | |
| 3 | }; | |
| 4 | ||
| 5 | pub(crate) fn opts() -> TargetOptions { | |
| 6 | TargetOptions { | |
| 7 | crt_static_respected: true, | |
| 8 | dynamic_linking: true, | |
| 9 | executables: true, | |
| 10 | families: cvs!["unix"], | |
| 11 | has_rpath: true, | |
| 12 | has_thread_local: false, | |
| 13 | linker: Some("qcc".into()), | |
| 14 | os: Os::Nto, | |
| 15 | // We want backtraces to work by default and they rely on unwind tables | |
| 16 | // (regardless of `-C panic` strategy). | |
| 17 | default_uwtable: true, | |
| 18 | position_independent_executables: true, | |
| 19 | static_position_independent_executables: true, | |
| 20 | relro_level: RelroLevel::Full, | |
| 21 | ..Default::default() | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | pub(crate) fn meta() -> TargetMetadata { | |
| 26 | TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), std: Some(true) } | |
| 27 | } | |
| 28 | ||
| 29 | pub(crate) fn aarch64() -> Target { | |
| 30 | Target { | |
| 31 | llvm_target: "aarch64-unknown-unknown".into(), | |
| 32 | metadata: meta(), | |
| 33 | pointer_width: 64, | |
| 34 | // from: https://llvm.org/docs/LangRef.html#data-layout | |
| 35 | // e = little endian | |
| 36 | // m:e = ELF mangling: Private symbols get a .L prefix | |
| 37 | // i8:8:32 = 8-bit-integer, minimum_alignment=8, preferred_alignment=32 | |
| 38 | // i16:16:32 = 16-bit-integer, minimum_alignment=16, preferred_alignment=32 | |
| 39 | // i64:64 = 64-bit-integer, minimum_alignment=64, preferred_alignment=64 | |
| 40 | // i128:128 = 128-bit-integer, minimum_alignment=128, preferred_alignment=128 | |
| 41 | // n32:64 = 32 and 64 are native integer widths; Elements of this set are considered to support most general arithmetic operations efficiently. | |
| 42 | // S128 = 128 bits are the natural alignment of the stack in bits. | |
| 43 | data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(), | |
| 44 | arch: crate::spec::Arch::AArch64, | |
| 45 | options: TargetOptions { | |
| 46 | features: "+v8a".into(), | |
| 47 | max_atomic_width: Some(128), | |
| 48 | ..opts() | |
| 49 | } | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | pub(crate) fn x86_64() -> Target { | |
| 54 | Target { | |
| 55 | llvm_target: "x86_64-pc-unknown".into(), | |
| 56 | metadata: meta(), | |
| 57 | pointer_width: 64, | |
| 58 | data_layout: | |
| 59 | "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(), | |
| 60 | arch: crate::spec::Arch::X86_64, | |
| 61 | options: TargetOptions { | |
| 62 | cpu: "x86-64".into(), | |
| 63 | plt_by_default: false, | |
| 64 | max_atomic_width: Some(64), | |
| 65 | vendor: "pc".into(), | |
| 66 | ..opts() | |
| 67 | }, | |
| 68 | } | |
| 69 | } | |
| 70 | ||
| 71 | pub(crate) fn pre_link_args(api_var: ApiVariant, arch: Arch) -> LinkArgs { | |
| 72 | let (qcc_arg, arch_lib_dir) = match arch { | |
| 73 | Arch::Aarch64 => ("-Vgcc_ntoaarch64le_cxx", "aarch64le"), | |
| 74 | Arch::I586 => { | |
| 75 | ("-Vgcc_ntox86_cxx", "notSupportedByQnx_compiler/rustc_target/src/spec/base/nto_qnx.rs") | |
| 76 | } | |
| 77 | Arch::X86_64 => ("-Vgcc_ntox86_64_cxx", "x86_64"), | |
| 78 | }; | |
| 79 | match api_var { | |
| 80 | ApiVariant::Default => { | |
| 81 | TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[qcc_arg]) | |
| 82 | } | |
| 83 | ApiVariant::IoSock => TargetOptions::link_args( | |
| 84 | LinkerFlavor::Gnu(Cc::Yes, Lld::No), | |
| 85 | &[qcc_arg, get_iosock_param(arch_lib_dir)], | |
| 86 | ), | |
| 87 | } | |
| 88 | } | |
| 89 | ||
| 90 | pub(crate) enum ApiVariant { | |
| 91 | Default, | |
| 92 | IoSock, | |
| 93 | } | |
| 94 | ||
| 95 | pub(crate) enum Arch { | |
| 96 | Aarch64, | |
| 97 | I586, | |
| 98 | X86_64, | |
| 99 | } | |
| 100 | ||
| 101 | // When using `io-sock` on QNX, we must add a search path for the linker so | |
| 102 | // that it prefers the io-sock version. | |
| 103 | // The path depends on the host, i.e. we cannot hard-code it here, but have | |
| 104 | // to determine it when the compiler runs. | |
| 105 | // When using the QNX toolchain, the environment variable QNX_TARGET is always set. | |
| 106 | // More information: | |
| 107 | // https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html | |
| 108 | fn get_iosock_param(arch_lib_dir: &str) -> &'static str { | |
| 109 | let target_dir = std::env::var("QNX_TARGET") | |
| 110 | .unwrap_or_else(|_| "QNX_TARGET_not_set_please_source_qnxsdp-env.sh".into()); | |
| 111 | let linker_param = format!("-L{target_dir}/{arch_lib_dir}/io-sock/lib"); | |
| 112 | ||
| 113 | // FIXME: leaking this is kind of weird: we're feeding these into something that expects an | |
| 114 | // `AsRef<OsStr>`, but often converts to `OsString` anyways, so shouldn't we just demand an `OsString`? | |
| 115 | linker_param.leak() | |
| 116 | } |
compiler/rustc_target/src/spec/base/qnx_sdp.rs created+116| ... | ... | @@ -0,0 +1,116 @@ |
| 1 | use crate::spec::{ | |
| 2 | Cc, LinkArgs, LinkerFlavor, Lld, Os, RelroLevel, Target, TargetMetadata, TargetOptions, cvs, | |
| 3 | }; | |
| 4 | ||
| 5 | pub(crate) fn opts() -> TargetOptions { | |
| 6 | TargetOptions { | |
| 7 | crt_static_respected: true, | |
| 8 | dynamic_linking: true, | |
| 9 | executables: true, | |
| 10 | families: cvs!["unix"], | |
| 11 | has_rpath: true, | |
| 12 | has_thread_local: false, | |
| 13 | linker: Some("qcc".into()), | |
| 14 | os: Os::Nto, | |
| 15 | // We want backtraces to work by default and they rely on unwind tables | |
| 16 | // (regardless of `-C panic` strategy). | |
| 17 | default_uwtable: true, | |
| 18 | position_independent_executables: true, | |
| 19 | static_position_independent_executables: true, | |
| 20 | relro_level: RelroLevel::Full, | |
| 21 | ..Default::default() | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | pub(crate) fn meta() -> TargetMetadata { | |
| 26 | TargetMetadata { description: None, tier: Some(3), host_tools: Some(false), std: Some(true) } | |
| 27 | } | |
| 28 | ||
| 29 | pub(crate) fn aarch64() -> Target { | |
| 30 | Target { | |
| 31 | llvm_target: "aarch64-unknown-unknown".into(), | |
| 32 | metadata: meta(), | |
| 33 | pointer_width: 64, | |
| 34 | // from: https://llvm.org/docs/LangRef.html#data-layout | |
| 35 | // e = little endian | |
| 36 | // m:e = ELF mangling: Private symbols get a .L prefix | |
| 37 | // i8:8:32 = 8-bit-integer, minimum_alignment=8, preferred_alignment=32 | |
| 38 | // i16:16:32 = 16-bit-integer, minimum_alignment=16, preferred_alignment=32 | |
| 39 | // i64:64 = 64-bit-integer, minimum_alignment=64, preferred_alignment=64 | |
| 40 | // i128:128 = 128-bit-integer, minimum_alignment=128, preferred_alignment=128 | |
| 41 | // n32:64 = 32 and 64 are native integer widths; Elements of this set are considered to support most general arithmetic operations efficiently. | |
| 42 | // S128 = 128 bits are the natural alignment of the stack in bits. | |
| 43 | data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(), | |
| 44 | arch: crate::spec::Arch::AArch64, | |
| 45 | options: TargetOptions { | |
| 46 | features: "+v8a".into(), | |
| 47 | max_atomic_width: Some(128), | |
| 48 | ..opts() | |
| 49 | } | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | pub(crate) fn x86_64() -> Target { | |
| 54 | Target { | |
| 55 | llvm_target: "x86_64-pc-unknown".into(), | |
| 56 | metadata: meta(), | |
| 57 | pointer_width: 64, | |
| 58 | data_layout: | |
| 59 | "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(), | |
| 60 | arch: crate::spec::Arch::X86_64, | |
| 61 | options: TargetOptions { | |
| 62 | cpu: "x86-64".into(), | |
| 63 | plt_by_default: false, | |
| 64 | max_atomic_width: Some(64), | |
| 65 | vendor: "pc".into(), | |
| 66 | ..opts() | |
| 67 | }, | |
| 68 | } | |
| 69 | } | |
| 70 | ||
| 71 | pub(crate) fn pre_link_args(api_var: ApiVariant, arch: Arch) -> LinkArgs { | |
| 72 | let (qcc_arg, arch_lib_dir) = match arch { | |
| 73 | Arch::Aarch64 => ("-Vgcc_ntoaarch64le_cxx", "aarch64le"), | |
| 74 | Arch::I586 => { | |
| 75 | ("-Vgcc_ntox86_cxx", "notSupportedByQnx_compiler/rustc_target/src/spec/base/nto_qnx.rs") | |
| 76 | } | |
| 77 | Arch::X86_64 => ("-Vgcc_ntox86_64_cxx", "x86_64"), | |
| 78 | }; | |
| 79 | match api_var { | |
| 80 | ApiVariant::Default => { | |
| 81 | TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[qcc_arg]) | |
| 82 | } | |
| 83 | ApiVariant::IoSock => TargetOptions::link_args( | |
| 84 | LinkerFlavor::Gnu(Cc::Yes, Lld::No), | |
| 85 | &[qcc_arg, get_iosock_param(arch_lib_dir)], | |
| 86 | ), | |
| 87 | } | |
| 88 | } | |
| 89 | ||
| 90 | pub(crate) enum ApiVariant { | |
| 91 | Default, | |
| 92 | IoSock, | |
| 93 | } | |
| 94 | ||
| 95 | pub(crate) enum Arch { | |
| 96 | Aarch64, | |
| 97 | I586, | |
| 98 | X86_64, | |
| 99 | } | |
| 100 | ||
| 101 | // When using `io-sock` on QNX, we must add a search path for the linker so | |
| 102 | // that it prefers the io-sock version. | |
| 103 | // The path depends on the host, i.e. we cannot hard-code it here, but have | |
| 104 | // to determine it when the compiler runs. | |
| 105 | // When using the QNX toolchain, the environment variable QNX_TARGET is always set. | |
| 106 | // More information: | |
| 107 | // https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html | |
| 108 | fn get_iosock_param(arch_lib_dir: &str) -> &'static str { | |
| 109 | let target_dir = std::env::var("QNX_TARGET") | |
| 110 | .unwrap_or_else(|_| "QNX_TARGET_not_set_please_source_qnxsdp-env.sh".into()); | |
| 111 | let linker_param = format!("-L{target_dir}/{arch_lib_dir}/io-sock/lib"); | |
| 112 | ||
| 113 | // FIXME: leaking this is kind of weird: we're feeding these into something that expects an | |
| 114 | // `AsRef<OsStr>`, but often converts to `OsString` anyways, so shouldn't we just demand an `OsString`? | |
| 115 | linker_param.leak() | |
| 116 | } |
compiler/rustc_target/src/spec/mod.rs+3-3| ... | ... | @@ -1791,10 +1791,10 @@ supported_targets! { |
| 1791 | 1791 | ("aarch64-unknown-nto-qnx700", aarch64_unknown_nto_qnx700), |
| 1792 | 1792 | ("aarch64-unknown-nto-qnx710", aarch64_unknown_nto_qnx710), |
| 1793 | 1793 | ("aarch64-unknown-nto-qnx710_iosock", aarch64_unknown_nto_qnx710_iosock), |
| 1794 | ("aarch64-unknown-nto-qnx800", aarch64_unknown_nto_qnx800), | |
| 1794 | ("aarch64-unknown-qnx", aarch64_unknown_qnx), | |
| 1795 | 1795 | ("x86_64-pc-nto-qnx710", x86_64_pc_nto_qnx710), |
| 1796 | 1796 | ("x86_64-pc-nto-qnx710_iosock", x86_64_pc_nto_qnx710_iosock), |
| 1797 | ("x86_64-pc-nto-qnx800", x86_64_pc_nto_qnx800), | |
| 1797 | ("x86_64-pc-qnx", x86_64_pc_qnx), | |
| 1798 | 1798 | ("i686-pc-nto-qnx700", i686_pc_nto_qnx700), |
| 1799 | 1799 | |
| 1800 | 1800 | ("aarch64-unknown-linux-ohos", aarch64_unknown_linux_ohos), |
| ... | ... | @@ -2001,6 +2001,7 @@ crate::target_spec_enum! { |
| 2001 | 2001 | OpenBsd = "openbsd", |
| 2002 | 2002 | Psp = "psp", |
| 2003 | 2003 | Psx = "psx", |
| 2004 | Qnx = "qnx", | |
| 2004 | 2005 | Qurt = "qurt", |
| 2005 | 2006 | Redox = "redox", |
| 2006 | 2007 | Rtems = "rtems", |
| ... | ... | @@ -2041,7 +2042,6 @@ crate::target_spec_enum! { |
| 2041 | 2042 | Nto70 = "nto70", |
| 2042 | 2043 | Nto71 = "nto71", |
| 2043 | 2044 | Nto71IoSock = "nto71_iosock", |
| 2044 | Nto80 = "nto80", | |
| 2045 | 2045 | Ohos = "ohos", |
| 2046 | 2046 | Relibc = "relibc", |
| 2047 | 2047 | Sgx = "sgx", |
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs+5-4| ... | ... | @@ -1,11 +1,12 @@ |
| 1 | use crate::spec::base::nto_qnx; | |
| 1 | use crate::spec::base::qnx_sdp; | |
| 2 | 2 | use crate::spec::{Env, Target}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let mut target = nto_qnx::aarch64(); | |
| 6 | target.metadata.description = Some("ARM64 QNX Neutrino 7.0 RTOS".into()); | |
| 5 | let mut target = qnx_sdp::aarch64(); | |
| 6 | target.metadata.description = Some("ARM64 QNX SDP 7.0".into()); | |
| 7 | 7 | target.options.pre_link_args = |
| 8 | nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64); | |
| 8 | qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::Aarch64); | |
| 9 | // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version | |
| 9 | 10 | target.options.env = Env::Nto70; |
| 10 | 11 | target |
| 11 | 12 | } |
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710.rs+5-5| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | use crate::spec::base::nto_qnx; | |
| 1 | use crate::spec::base::qnx_sdp; | |
| 2 | 2 | use crate::spec::{Env, Target}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let mut target = nto_qnx::aarch64(); | |
| 6 | target.metadata.description = | |
| 7 | Some("ARM64 QNX Neutrino 7.1 RTOS with io-pkt network stack".into()); | |
| 5 | let mut target = qnx_sdp::aarch64(); | |
| 6 | target.metadata.description = Some("ARM64 QNX SDP 7.1 with io-pkt network stack".into()); | |
| 8 | 7 | target.options.pre_link_args = |
| 9 | nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64); | |
| 8 | qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::Aarch64); | |
| 9 | // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version | |
| 10 | 10 | target.options.env = Env::Nto71; |
| 11 | 11 | target |
| 12 | 12 | } |
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx710_iosock.rs+5-5| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | use crate::spec::base::nto_qnx; | |
| 1 | use crate::spec::base::qnx_sdp; | |
| 2 | 2 | use crate::spec::{Env, Target}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let mut target = nto_qnx::aarch64(); | |
| 6 | target.metadata.description = | |
| 7 | Some("ARM64 QNX Neutrino 7.1 RTOS with io-sock network stack".into()); | |
| 5 | let mut target = qnx_sdp::aarch64(); | |
| 6 | target.metadata.description = Some("ARM64 QNX SDP 7.1 with io-sock network stack".into()); | |
| 8 | 7 | target.options.pre_link_args = |
| 9 | nto_qnx::pre_link_args(nto_qnx::ApiVariant::IoSock, nto_qnx::Arch::Aarch64); | |
| 8 | qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::IoSock, qnx_sdp::Arch::Aarch64); | |
| 9 | // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version | |
| 10 | 10 | target.options.env = Env::Nto71IoSock; |
| 11 | 11 | target |
| 12 | 12 | } |
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx800.rs deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | use crate::spec::base::nto_qnx; | |
| 2 | use crate::spec::{Env, Target}; | |
| 3 | ||
| 4 | pub(crate) fn target() -> Target { | |
| 5 | let mut target = nto_qnx::aarch64(); | |
| 6 | target.metadata.description = Some("ARM64 QNX Neutrino 8.0 RTOS".into()); | |
| 7 | target.options.pre_link_args = | |
| 8 | nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::Aarch64); | |
| 9 | target.options.env = Env::Nto80; | |
| 10 | target | |
| 11 | } |
compiler/rustc_target/src/spec/targets/aarch64_unknown_qnx.rs created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | use crate::spec::base::qnx_sdp; | |
| 2 | use crate::spec::{Os, Target}; | |
| 3 | ||
| 4 | pub(crate) fn target() -> Target { | |
| 5 | let mut target = qnx_sdp::aarch64(); | |
| 6 | target.metadata.description = Some("ARM64 QNX SDP 8.0+".into()); | |
| 7 | target.options.pre_link_args = | |
| 8 | qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::Aarch64); | |
| 9 | // for QNX SDP 8.0, we have target_os = "qnx" and no target_env | |
| 10 | target.options.os = Os::Qnx; | |
| 11 | target | |
| 12 | } |
compiler/rustc_target/src/spec/targets/i686_pc_nto_qnx700.rs+8-7| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | use crate::spec::base::nto_qnx; | |
| 1 | use crate::spec::base::qnx_sdp; | |
| 2 | 2 | use crate::spec::{Arch, Env, RustcAbi, StackProbeType, Target, TargetOptions, base}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let mut meta = nto_qnx::meta(); | |
| 6 | meta.description = Some("32-bit x86 QNX Neutrino 7.0 RTOS".into()); | |
| 5 | let mut meta = qnx_sdp::meta(); | |
| 6 | meta.description = Some("32-bit x86 QNX SDP 7.0".into()); | |
| 7 | 7 | meta.std = Some(false); |
| 8 | 8 | Target { |
| 9 | 9 | llvm_target: "i586-pc-unknown".into(), |
| ... | ... | @@ -17,14 +17,15 @@ pub(crate) fn target() -> Target { |
| 17 | 17 | rustc_abi: Some(RustcAbi::X86Sse2), |
| 18 | 18 | cpu: "pentium4".into(), |
| 19 | 19 | max_atomic_width: Some(64), |
| 20 | pre_link_args: nto_qnx::pre_link_args( | |
| 21 | nto_qnx::ApiVariant::Default, | |
| 22 | nto_qnx::Arch::I586, | |
| 20 | pre_link_args: qnx_sdp::pre_link_args( | |
| 21 | qnx_sdp::ApiVariant::Default, | |
| 22 | qnx_sdp::Arch::I586, | |
| 23 | 23 | ), |
| 24 | // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version | |
| 24 | 25 | env: Env::Nto70, |
| 25 | 26 | vendor: "pc".into(), |
| 26 | 27 | stack_probes: StackProbeType::Inline, |
| 27 | ..base::nto_qnx::opts() | |
| 28 | ..base::qnx_sdp::opts() | |
| 28 | 29 | }, |
| 29 | 30 | } |
| 30 | 31 | } |
compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs+5-5| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | use crate::spec::base::nto_qnx; | |
| 1 | use crate::spec::base::qnx_sdp; | |
| 2 | 2 | use crate::spec::{Env, Target}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let mut target = nto_qnx::x86_64(); | |
| 6 | target.metadata.description = | |
| 7 | Some("x86 64-bit QNX Neutrino 7.1 RTOS with io-pkt network stack".into()); | |
| 5 | let mut target = qnx_sdp::x86_64(); | |
| 6 | target.metadata.description = Some("x86 64-bit QNX SDP 7.1 with io-pkt network stack".into()); | |
| 8 | 7 | target.options.pre_link_args = |
| 9 | nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::X86_64); | |
| 8 | qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::X86_64); | |
| 9 | // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version | |
| 10 | 10 | target.options.env = Env::Nto71; |
| 11 | 11 | target |
| 12 | 12 | } |
compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710_iosock.rs+5-5| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | use crate::spec::base::nto_qnx; | |
| 1 | use crate::spec::base::qnx_sdp; | |
| 2 | 2 | use crate::spec::{Env, Target}; |
| 3 | 3 | |
| 4 | 4 | pub(crate) fn target() -> Target { |
| 5 | let mut target = nto_qnx::x86_64(); | |
| 6 | target.metadata.description = | |
| 7 | Some("x86 64-bit QNX Neutrino 7.1 RTOS with io-sock network stack".into()); | |
| 5 | let mut target = qnx_sdp::x86_64(); | |
| 6 | target.metadata.description = Some("x86 64-bit QNX SDP 7.1 with io-sock network stack".into()); | |
| 8 | 7 | target.options.pre_link_args = |
| 9 | nto_qnx::pre_link_args(nto_qnx::ApiVariant::IoSock, nto_qnx::Arch::X86_64); | |
| 8 | qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::IoSock, qnx_sdp::Arch::X86_64); | |
| 9 | // for QNX SDP 7.x, we keep target_os = "nto" for backwards compatibility, and use target_env to specify which version | |
| 10 | 10 | target.options.env = Env::Nto71IoSock; |
| 11 | 11 | target |
| 12 | 12 | } |
compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx800.rs deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | use crate::spec::base::nto_qnx; | |
| 2 | use crate::spec::{Env, Target}; | |
| 3 | ||
| 4 | pub(crate) fn target() -> Target { | |
| 5 | let mut target = nto_qnx::x86_64(); | |
| 6 | target.metadata.description = Some("x86 64-bit QNX Neutrino 8.0 RTOS".into()); | |
| 7 | target.options.pre_link_args = | |
| 8 | nto_qnx::pre_link_args(nto_qnx::ApiVariant::Default, nto_qnx::Arch::X86_64); | |
| 9 | target.options.env = Env::Nto80; | |
| 10 | target | |
| 11 | } |
compiler/rustc_target/src/spec/targets/x86_64_pc_qnx.rs created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | use crate::spec::base::qnx_sdp; | |
| 2 | use crate::spec::{Os, Target}; | |
| 3 | ||
| 4 | pub(crate) fn target() -> Target { | |
| 5 | let mut target = qnx_sdp::x86_64(); | |
| 6 | target.metadata.description = Some("x86 64-bit QNX SDP 8.0+".into()); | |
| 7 | target.options.pre_link_args = | |
| 8 | qnx_sdp::pre_link_args(qnx_sdp::ApiVariant::Default, qnx_sdp::Arch::X86_64); | |
| 9 | // for QNX SDP 8.0, we have target_os = "qnx" and no target_env | |
| 10 | target.options.os = Os::Qnx; | |
| 11 | target | |
| 12 | } |
compiler/rustc_ty_utils/src/layout/invariant.rs+5-5| ... | ... | @@ -84,7 +84,7 @@ pub(super) fn layout_sanity_check<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayou |
| 84 | 84 | |
| 85 | 85 | fn check_layout_abi<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayout<'tcx>) { |
| 86 | 86 | // Verify the ABI-mandated alignment and size for scalars. |
| 87 | let align = layout.backend_repr.scalar_align(cx); | |
| 87 | let align = layout.backend_repr.scalar_platform_align(cx); | |
| 88 | 88 | let size = layout.backend_repr.scalar_size(cx); |
| 89 | 89 | if let Some(align) = align { |
| 90 | 90 | assert_eq!( |
| ... | ... | @@ -208,9 +208,9 @@ pub(super) fn layout_sanity_check<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayou |
| 208 | 208 | }; |
| 209 | 209 | // The fields should be at the right offset, and match the `scalar` layout. |
| 210 | 210 | let size1 = scalar1.size(cx); |
| 211 | let align1 = scalar1.align(cx).abi; | |
| 211 | let align1 = scalar1.default_align(cx).abi; | |
| 212 | 212 | let size2 = scalar2.size(cx); |
| 213 | let align2 = scalar2.align(cx).abi; | |
| 213 | let align2 = scalar2.default_align(cx).abi; | |
| 214 | 214 | assert_eq!( |
| 215 | 215 | offset1, |
| 216 | 216 | Size::ZERO, |
| ... | ... | @@ -251,7 +251,7 @@ pub(super) fn layout_sanity_check<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayou |
| 251 | 251 | BackendRepr::SimdVector { element, count } => { |
| 252 | 252 | let align = layout.align.abi; |
| 253 | 253 | let size = layout.size; |
| 254 | let element_align = element.align(cx).abi; | |
| 254 | let element_align = element.default_align(cx).abi; | |
| 255 | 255 | let element_size = element.size(cx); |
| 256 | 256 | // Currently, vectors must always be aligned to at least their elements: |
| 257 | 257 | assert!(align >= element_align); |
| ... | ... | @@ -321,7 +321,7 @@ pub(super) fn layout_sanity_check<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayou |
| 321 | 321 | } |
| 322 | 322 | // The top-level ABI and the ABI of the variants should be coherent. |
| 323 | 323 | let scalar_coherent = |s1: Scalar, s2: Scalar| { |
| 324 | s1.size(cx) == s2.size(cx) && s1.align(cx) == s2.align(cx) | |
| 324 | s1.size(cx) == s2.size(cx) && s1.default_align(cx) == s2.default_align(cx) | |
| 325 | 325 | }; |
| 326 | 326 | let abi_coherent = match (layout.backend_repr, variant.backend_repr) { |
| 327 | 327 | (BackendRepr::Scalar(s1), BackendRepr::Scalar(s2)) => scalar_coherent(s1, s2), |
compiler/rustc_type_ir/src/search_graph/mod.rs+37-14| ... | ... | @@ -263,6 +263,12 @@ impl CandidateHeadUsages { |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | #[derive(Debug, Clone, Copy)] |
| 266 | pub enum IncreaseDepthForNested { | |
| 267 | Yes, | |
| 268 | No, | |
| 269 | } | |
| 270 | ||
| 271 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] | |
| 266 | 272 | struct AvailableDepth(usize); |
| 267 | 273 | impl AvailableDepth { |
| 268 | 274 | /// Returns the remaining depth allowed for nested goals. |
| ... | ... | @@ -276,6 +282,13 @@ impl AvailableDepth { |
| 276 | 282 | stack: &Stack<D::Cx>, |
| 277 | 283 | ) -> Option<AvailableDepth> { |
| 278 | 284 | if let Some(last) = stack.last() { |
| 285 | match last.increase_depth_for_nested { | |
| 286 | IncreaseDepthForNested::Yes => {} | |
| 287 | IncreaseDepthForNested::No => { | |
| 288 | return Some(last.available_depth); | |
| 289 | } | |
| 290 | } | |
| 291 | ||
| 279 | 292 | if last.available_depth.0 == 0 { |
| 280 | 293 | return None; |
| 281 | 294 | } |
| ... | ... | @@ -566,7 +579,7 @@ impl<X: Cx> EvaluationResult<X> { |
| 566 | 579 | encountered_overflow, |
| 567 | 580 | // Unlike `encountered_overflow`, we share `heads`, `required_depth`, |
| 568 | 581 | // and `nested_goals` between evaluations. |
| 569 | required_depth: final_entry.required_depth, | |
| 582 | required_depth: final_entry.required_depth(), | |
| 570 | 583 | heads: final_entry.heads, |
| 571 | 584 | nested_goals: final_entry.nested_goals, |
| 572 | 585 | // We only care about the final result. |
| ... | ... | @@ -597,7 +610,7 @@ pub struct SearchGraph<D: Delegate<Cx = X>, X: Cx = <D as Delegate>::Cx> { |
| 597 | 610 | /// don't need to track the nested goals used while computing a provisional |
| 598 | 611 | /// cache entry. |
| 599 | 612 | enum UpdateParentGoalCtxt<'a, X: Cx> { |
| 600 | Ordinary(&'a NestedGoals<X>), | |
| 613 | Ordinary { nested_goals: &'a NestedGoals<X>, min_reachable_available_depth: AvailableDepth }, | |
| 601 | 614 | CycleOnStack(X::Input), |
| 602 | 615 | ProvisionalCacheHit, |
| 603 | 616 | } |
| ... | ... | @@ -619,13 +632,11 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> { |
| 619 | 632 | fn update_parent_goal( |
| 620 | 633 | stack: &mut Stack<X>, |
| 621 | 634 | step_kind_from_parent: PathKind, |
| 622 | required_depth_for_nested: usize, | |
| 623 | 635 | heads: impl Iterator<Item = (StackDepth, CycleHead)>, |
| 624 | 636 | encountered_overflow: bool, |
| 625 | 637 | context: UpdateParentGoalCtxt<'_, X>, |
| 626 | 638 | ) { |
| 627 | 639 | if let Some((parent_index, parent)) = stack.last_mut_with_index() { |
| 628 | parent.required_depth = parent.required_depth.max(required_depth_for_nested + 1); | |
| 629 | 640 | parent.encountered_overflow |= encountered_overflow; |
| 630 | 641 | |
| 631 | 642 | for (head_index, head) in heads { |
| ... | ... | @@ -650,7 +661,9 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> { |
| 650 | 661 | } |
| 651 | 662 | } |
| 652 | 663 | let parent_depends_on_cycle = match context { |
| 653 | UpdateParentGoalCtxt::Ordinary(nested_goals) => { | |
| 664 | UpdateParentGoalCtxt::Ordinary { nested_goals, min_reachable_available_depth } => { | |
| 665 | parent.min_reached_available_depth = | |
| 666 | parent.min_reached_available_depth.min(min_reachable_available_depth); | |
| 654 | 667 | parent.nested_goals.extend_from_child(step_kind_from_parent, nested_goals); |
| 655 | 668 | !nested_goals.is_empty() |
| 656 | 669 | } |
| ... | ... | @@ -739,8 +752,9 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> { |
| 739 | 752 | input, |
| 740 | 753 | step_kind_from_parent, |
| 741 | 754 | available_depth, |
| 755 | min_reached_available_depth: available_depth, | |
| 742 | 756 | provisional_result: None, |
| 743 | required_depth: 0, | |
| 757 | increase_depth_for_nested: IncreaseDepthForNested::Yes, | |
| 744 | 758 | heads: Default::default(), |
| 745 | 759 | encountered_overflow: false, |
| 746 | 760 | usages: None, |
| ... | ... | @@ -761,6 +775,7 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> { |
| 761 | 775 | cx: X, |
| 762 | 776 | input: X::Input, |
| 763 | 777 | step_kind_from_parent: PathKind, |
| 778 | increase_depth_for_nested: IncreaseDepthForNested, | |
| 764 | 779 | inspect: &mut D::ProofTreeBuilder, |
| 765 | 780 | ) -> X::Result { |
| 766 | 781 | let Some(available_depth) = |
| ... | ... | @@ -816,7 +831,8 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> { |
| 816 | 831 | step_kind_from_parent, |
| 817 | 832 | available_depth, |
| 818 | 833 | provisional_result: None, |
| 819 | required_depth: 0, | |
| 834 | min_reached_available_depth: available_depth, | |
| 835 | increase_depth_for_nested, | |
| 820 | 836 | heads: Default::default(), |
| 821 | 837 | encountered_overflow: false, |
| 822 | 838 | usages: None, |
| ... | ... | @@ -838,10 +854,14 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D> { |
| 838 | 854 | Self::update_parent_goal( |
| 839 | 855 | &mut self.stack, |
| 840 | 856 | step_kind_from_parent, |
| 841 | evaluation_result.required_depth, | |
| 842 | 857 | evaluation_result.heads.iter(), |
| 843 | 858 | evaluation_result.encountered_overflow, |
| 844 | UpdateParentGoalCtxt::Ordinary(&evaluation_result.nested_goals), | |
| 859 | UpdateParentGoalCtxt::Ordinary { | |
| 860 | nested_goals: &evaluation_result.nested_goals, | |
| 861 | min_reachable_available_depth: AvailableDepth( | |
| 862 | available_depth.0 - evaluation_result.required_depth, | |
| 863 | ), | |
| 864 | }, | |
| 845 | 865 | ); |
| 846 | 866 | let result = evaluation_result.result; |
| 847 | 867 | |
| ... | ... | @@ -1116,7 +1136,6 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> { |
| 1116 | 1136 | Self::update_parent_goal( |
| 1117 | 1137 | &mut self.stack, |
| 1118 | 1138 | step_kind_from_parent, |
| 1119 | 0, | |
| 1120 | 1139 | heads.iter(), |
| 1121 | 1140 | encountered_overflow, |
| 1122 | 1141 | UpdateParentGoalCtxt::ProvisionalCacheHit, |
| ... | ... | @@ -1239,10 +1258,14 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> { |
| 1239 | 1258 | Self::update_parent_goal( |
| 1240 | 1259 | &mut self.stack, |
| 1241 | 1260 | step_kind_from_parent, |
| 1242 | required_depth, | |
| 1243 | 1261 | heads, |
| 1244 | 1262 | encountered_overflow, |
| 1245 | UpdateParentGoalCtxt::Ordinary(nested_goals), | |
| 1263 | UpdateParentGoalCtxt::Ordinary { | |
| 1264 | nested_goals, | |
| 1265 | min_reachable_available_depth: AvailableDepth( | |
| 1266 | available_depth.0 - required_depth, | |
| 1267 | ), | |
| 1268 | }, | |
| 1246 | 1269 | ); |
| 1247 | 1270 | |
| 1248 | 1271 | debug!(?required_depth, "global cache hit"); |
| ... | ... | @@ -1271,7 +1294,6 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> { |
| 1271 | 1294 | Self::update_parent_goal( |
| 1272 | 1295 | &mut self.stack, |
| 1273 | 1296 | step_kind_from_parent, |
| 1274 | 0, | |
| 1275 | 1297 | iter::once((head_index, head)), |
| 1276 | 1298 | false, |
| 1277 | 1299 | UpdateParentGoalCtxt::CycleOnStack(input), |
| ... | ... | @@ -1407,7 +1429,8 @@ impl<D: Delegate<Cx = X>, X: Cx> SearchGraph<D, X> { |
| 1407 | 1429 | provisional_result: Some(result), |
| 1408 | 1430 | // We can keep these goals from previous iterations as they are only |
| 1409 | 1431 | // ever read after finalizing this evaluation. |
| 1410 | required_depth: stack_entry.required_depth, | |
| 1432 | min_reached_available_depth: stack_entry.min_reached_available_depth, | |
| 1433 | increase_depth_for_nested: stack_entry.increase_depth_for_nested, | |
| 1411 | 1434 | heads: stack_entry.heads, |
| 1412 | 1435 | nested_goals: stack_entry.nested_goals, |
| 1413 | 1436 | // We reset these two fields when rerunning this goal. We could |
compiler/rustc_type_ir/src/search_graph/stack.rs+22-3| ... | ... | @@ -4,7 +4,8 @@ use derive_where::derive_where; |
| 4 | 4 | use rustc_index::IndexVec; |
| 5 | 5 | |
| 6 | 6 | use crate::search_graph::{ |
| 7 | AvailableDepth, CandidateHeadUsages, Cx, CycleHeads, HeadUsages, NestedGoals, PathKind, | |
| 7 | AvailableDepth, CandidateHeadUsages, Cx, CycleHeads, HeadUsages, IncreaseDepthForNested, | |
| 8 | NestedGoals, PathKind, | |
| 8 | 9 | }; |
| 9 | 10 | |
| 10 | 11 | rustc_index::newtype_index! { |
| ... | ... | @@ -28,8 +29,20 @@ pub(super) struct StackEntry<X: Cx> { |
| 28 | 29 | /// The available depth of a given goal, immutable. |
| 29 | 30 | pub available_depth: AvailableDepth, |
| 30 | 31 | |
| 31 | /// The maximum depth required while evaluating this goal. | |
| 32 | pub required_depth: usize, | |
| 32 | /// The minimum available depth encountered while evaluating this goal's nested goals. | |
| 33 | /// If there's no nested goal, this is equal to the `available_depth`. | |
| 34 | pub min_reached_available_depth: AvailableDepth, | |
| 35 | ||
| 36 | /// Whether evaluating nested goals of a given goal should increase the depth. | |
| 37 | /// | |
| 38 | /// Normally, it should be `Yes`, but among rustc's predicate goals, `normalizes-to` | |
| 39 | /// goals are exceptions. They act like functions that used for normalizing associated | |
| 40 | /// terms while evaluating projection goals and since their expected terms are always fully | |
| 41 | /// unconstrained intentionally, they often return ambiguous nested goals to the caller's | |
| 42 | /// context. As these nested goals are evaluated again in the caller's context, we don't | |
| 43 | /// want to increase depths when they are evaluated as nested goals for `normalizes-to` | |
| 44 | /// goals, otherwise we will encounter recursion limit overflows more often. | |
| 45 | pub increase_depth_for_nested: IncreaseDepthForNested, | |
| 33 | 46 | |
| 34 | 47 | /// Starts out as `None` and gets set when rerunning this |
| 35 | 48 | /// goal in case we encounter a cycle. |
| ... | ... | @@ -57,6 +70,12 @@ pub(super) struct StackEntry<X: Cx> { |
| 57 | 70 | pub nested_goals: NestedGoals<X>, |
| 58 | 71 | } |
| 59 | 72 | |
| 73 | impl<X: Cx> StackEntry<X> { | |
| 74 | pub(super) fn required_depth(&self) -> usize { | |
| 75 | self.available_depth.0 - self.min_reached_available_depth.0 | |
| 76 | } | |
| 77 | } | |
| 78 | ||
| 60 | 79 | /// The stack of goals currently being computed. |
| 61 | 80 | /// |
| 62 | 81 | /// An element is *deeper* in the stack if its index is *lower*. |
library/core/src/num/imp/overflow_panic.rs-6| ... | ... | @@ -20,12 +20,6 @@ pub(in crate::num) const fn mul() -> ! { |
| 20 | 20 | panic!("attempt to multiply with overflow") |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | #[cold] | |
| 24 | #[track_caller] | |
| 25 | pub(in crate::num) const fn div() -> ! { | |
| 26 | panic!("attempt to divide with overflow") | |
| 27 | } | |
| 28 | ||
| 29 | 23 | #[cold] |
| 30 | 24 | #[track_caller] |
| 31 | 25 | pub(in crate::num) const fn rem() -> ! { |
library/core/src/num/int_macros.rs+12-6| ... | ... | @@ -983,9 +983,12 @@ macro_rules! int_impl { |
| 983 | 983 | /// This function will always panic on overflow, regardless of whether overflow checks are enabled. |
| 984 | 984 | /// |
| 985 | 985 | /// The only case where such an overflow can occur is when one divides `MIN / -1` on a signed type (where |
| 986 | /// [`MIN`](Self::MIN) is the negative minimal value for the type); this is equivalent to `-MIN`, a positive value | |
| 986 | /// [`MIN`](Self::MIN) is the negative minimal value for the type); the result of this is `-MIN`, a positive value | |
| 987 | 987 | /// that is too large to represent in the type. |
| 988 | 988 | /// |
| 989 | /// Note that this is equivalent to normal division: `MIN / -1` will also panic both in | |
| 990 | /// debug and release builds. | |
| 991 | /// | |
| 989 | 992 | /// # Examples |
| 990 | 993 | /// |
| 991 | 994 | /// ``` |
| ... | ... | @@ -1010,8 +1013,8 @@ macro_rules! int_impl { |
| 1010 | 1013 | #[inline] |
| 1011 | 1014 | #[track_caller] |
| 1012 | 1015 | pub const fn strict_div(self, rhs: Self) -> Self { |
| 1013 | let (a, b) = self.overflowing_div(rhs); | |
| 1014 | if b { imp::overflow_panic::div() } else { a } | |
| 1016 | // Normal division already checks for "div-by-minus-1". | |
| 1017 | self / rhs | |
| 1015 | 1018 | } |
| 1016 | 1019 | |
| 1017 | 1020 | /// Checked Euclidean division. Computes `self.div_euclid(rhs)`, |
| ... | ... | @@ -1050,9 +1053,12 @@ macro_rules! int_impl { |
| 1050 | 1053 | /// This function will always panic on overflow, regardless of whether overflow checks are enabled. |
| 1051 | 1054 | /// |
| 1052 | 1055 | /// The only case where such an overflow can occur is when one divides `MIN / -1` on a signed type (where |
| 1053 | /// [`MIN`](Self::MIN) is the negative minimal value for the type); this is equivalent to `-MIN`, a positive value | |
| 1056 | /// [`MIN`](Self::MIN) is the negative minimal value for the type); the result of this is `-MIN`, a positive value | |
| 1054 | 1057 | /// that is too large to represent in the type. |
| 1055 | 1058 | /// |
| 1059 | /// Note that this is equivalent to `div_euclid`: `MIN.div_euclid(-1)` will also panic both | |
| 1060 | /// in debug and release builds. | |
| 1061 | /// | |
| 1056 | 1062 | /// # Examples |
| 1057 | 1063 | /// |
| 1058 | 1064 | /// ``` |
| ... | ... | @@ -1077,8 +1083,8 @@ macro_rules! int_impl { |
| 1077 | 1083 | #[inline] |
| 1078 | 1084 | #[track_caller] |
| 1079 | 1085 | pub const fn strict_div_euclid(self, rhs: Self) -> Self { |
| 1080 | let (a, b) = self.overflowing_div_euclid(rhs); | |
| 1081 | if b { imp::overflow_panic::div() } else { a } | |
| 1086 | // Normal `div_euclid` already checks for "div-by-minus-1". | |
| 1087 | self.div_euclid(rhs) | |
| 1082 | 1088 | } |
| 1083 | 1089 | |
| 1084 | 1090 | /// Checked integer division without remainder. Computes `self / rhs`, |
library/std/build.rs+1| ... | ... | @@ -48,6 +48,7 @@ fn main() { |
| 48 | 48 | || target_os == "vita" |
| 49 | 49 | || target_os == "aix" |
| 50 | 50 | || target_os == "nto" |
| 51 | || target_os == "qnx" | |
| 51 | 52 | || target_os == "xous" |
| 52 | 53 | || target_os == "hurd" |
| 53 | 54 | || target_os == "uefi" |
library/std/src/env.rs+1| ... | ... | @@ -1096,6 +1096,7 @@ pub mod consts { |
| 1096 | 1096 | /// * `"netbsd"` |
| 1097 | 1097 | /// * `"nto"` |
| 1098 | 1098 | /// * `"openbsd"` |
| 1099 | /// * `"qnx"` | |
| 1099 | 1100 | /// * `"redox"` |
| 1100 | 1101 | /// * `"solaris"` |
| 1101 | 1102 | /// * `"solid_asp3"` |
library/std/src/net/tcp/tests.rs+7-1| ... | ... | @@ -733,7 +733,13 @@ fn debug() { |
| 733 | 733 | // no longer has rounding errors. |
| 734 | 734 | // VxWorks ignores SO_SNDTIMEO. |
| 735 | 735 | #[cfg_attr( |
| 736 | any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks", target_os = "nto"), | |
| 736 | any( | |
| 737 | target_os = "netbsd", | |
| 738 | target_os = "openbsd", | |
| 739 | target_os = "vxworks", | |
| 740 | target_os = "nto", | |
| 741 | target_os = "qnx" | |
| 742 | ), | |
| 737 | 743 | ignore |
| 738 | 744 | )] |
| 739 | 745 | #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31 |
library/std/src/net/udp/tests.rs+7-1| ... | ... | @@ -188,7 +188,13 @@ fn debug() { |
| 188 | 188 | // no longer has rounding errors. |
| 189 | 189 | // VxWorks ignores SO_SNDTIMEO. |
| 190 | 190 | #[cfg_attr( |
| 191 | any(target_os = "netbsd", target_os = "openbsd", target_os = "vxworks", target_os = "nto"), | |
| 191 | any( | |
| 192 | target_os = "netbsd", | |
| 193 | target_os = "openbsd", | |
| 194 | target_os = "vxworks", | |
| 195 | target_os = "nto", | |
| 196 | target_os = "qnx" | |
| 197 | ), | |
| 192 | 198 | ignore |
| 193 | 199 | )] |
| 194 | 200 | #[cfg_attr(target_os = "wasi", ignore)] // timeout not supported |
library/std/src/os/mod.rs+1-1| ... | ... | @@ -121,7 +121,7 @@ pub mod macos; |
| 121 | 121 | pub mod motor; |
| 122 | 122 | #[cfg(target_os = "netbsd")] |
| 123 | 123 | pub mod netbsd; |
| 124 | #[cfg(target_os = "nto")] | |
| 124 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 125 | 125 | pub mod nto; |
| 126 | 126 | #[cfg(target_os = "nuttx")] |
| 127 | 127 | pub mod nuttx; |
library/std/src/os/unix/mod.rs+1-1| ... | ... | @@ -69,7 +69,7 @@ mod platform { |
| 69 | 69 | pub use crate::os::linux::*; |
| 70 | 70 | #[cfg(target_os = "netbsd")] |
| 71 | 71 | pub use crate::os::netbsd::*; |
| 72 | #[cfg(target_os = "nto")] | |
| 72 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 73 | 73 | pub use crate::os::nto::*; |
| 74 | 74 | #[cfg(target_os = "nuttx")] |
| 75 | 75 | pub use crate::os::nuttx::*; |
library/std/src/os/unix/net/datagram.rs+2| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | target_os = "illumos", |
| 10 | 10 | target_os = "haiku", |
| 11 | 11 | target_os = "nto", |
| 12 | target_os = "qnx", | |
| 12 | 13 | target_os = "cygwin" |
| 13 | 14 | ))] |
| 14 | 15 | use libc::MSG_NOSIGNAL; |
| ... | ... | @@ -36,6 +37,7 @@ use crate::{fmt, io}; |
| 36 | 37 | target_os = "illumos", |
| 37 | 38 | target_os = "haiku", |
| 38 | 39 | target_os = "nto", |
| 40 | target_os = "qnx", | |
| 39 | 41 | target_os = "cygwin" |
| 40 | 42 | )))] |
| 41 | 43 | const MSG_NOSIGNAL: core::ffi::c_int = 0x0; |
library/std/src/os/unix/net/mod.rs+2| ... | ... | @@ -20,6 +20,7 @@ mod tests; |
| 20 | 20 | target_os = "netbsd", |
| 21 | 21 | target_os = "openbsd", |
| 22 | 22 | target_os = "nto", |
| 23 | target_os = "qnx", | |
| 23 | 24 | target_vendor = "apple", |
| 24 | 25 | target_os = "cygwin" |
| 25 | 26 | ))] |
| ... | ... | @@ -44,6 +45,7 @@ pub use self::stream::*; |
| 44 | 45 | target_os = "netbsd", |
| 45 | 46 | target_os = "openbsd", |
| 46 | 47 | target_os = "nto", |
| 48 | target_os = "qnx", | |
| 47 | 49 | target_vendor = "apple", |
| 48 | 50 | target_os = "cygwin", |
| 49 | 51 | ))] |
library/std/src/os/unix/net/stream.rs+2-1| ... | ... | @@ -6,7 +6,7 @@ cfg_select! { |
| 6 | 6 | target_os = "openbsd", target_os = "netbsd", |
| 7 | 7 | target_os = "solaris", target_os = "illumos", |
| 8 | 8 | target_os = "haiku", target_os = "nto", |
| 9 | target_os = "cygwin", | |
| 9 | target_os = "qnx", target_os = "cygwin", | |
| 10 | 10 | ) => { |
| 11 | 11 | use libc::MSG_NOSIGNAL; |
| 12 | 12 | } |
| ... | ... | @@ -26,6 +26,7 @@ use super::{SocketAncillary, recv_vectored_with_ancillary_from, send_vectored_wi |
| 26 | 26 | target_os = "netbsd", |
| 27 | 27 | target_os = "openbsd", |
| 28 | 28 | target_os = "nto", |
| 29 | target_os = "qnx", | |
| 29 | 30 | target_vendor = "apple", |
| 30 | 31 | target_os = "cygwin" |
| 31 | 32 | ))] |
library/std/src/os/unix/net/tests.rs+1-1| ... | ... | @@ -176,7 +176,7 @@ fn long_path() { |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | #[test] |
| 179 | #[cfg(not(target_os = "nto"))] | |
| 179 | #[cfg(not(any(target_os = "nto", target_os = "qnx")))] | |
| 180 | 180 | #[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating Unix sockets |
| 181 | 181 | #[cfg_attr(target_os = "cygwin", ignore)] // Cygwin connect needs handshake |
| 182 | 182 | #[cfg_attr(target_os = "vxworks", ignore = "Unix sockets are not implemented in VxWorks")] |
library/std/src/os/unix/net/ucred.rs+3-1| ... | ... | @@ -30,7 +30,8 @@ pub(super) use self::impl_apple::peer_cred; |
| 30 | 30 | target_os = "freebsd", |
| 31 | 31 | target_os = "openbsd", |
| 32 | 32 | target_os = "netbsd", |
| 33 | target_os = "nto" | |
| 33 | target_os = "nto", | |
| 34 | target_os = "qnx" | |
| 34 | 35 | ))] |
| 35 | 36 | pub(super) use self::impl_bsd::peer_cred; |
| 36 | 37 | #[cfg(any(target_os = "android", target_os = "linux", target_os = "cygwin"))] |
| ... | ... | @@ -79,6 +80,7 @@ mod impl_linux { |
| 79 | 80 | target_os = "openbsd", |
| 80 | 81 | target_os = "netbsd", |
| 81 | 82 | target_os = "nto", |
| 83 | target_os = "qnx", | |
| 82 | 84 | ))] |
| 83 | 85 | mod impl_bsd { |
| 84 | 86 | use super::UCred; |
library/std/src/os/unix/process.rs+1-1| ... | ... | @@ -16,7 +16,7 @@ cfg_select! { |
| 16 | 16 | type UserId = u16; |
| 17 | 17 | type GroupId = u16; |
| 18 | 18 | } |
| 19 | target_os = "nto" => { | |
| 19 | any(target_os = "nto", target_os = "qnx") => { | |
| 20 | 20 | // Both IDs are signed, see `sys/target_nto.h` of the QNX Neutrino SDP. |
| 21 | 21 | // Only positive values should be used, see e.g. |
| 22 | 22 | // https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/s/setuid.html |
library/std/src/sys/args/unix.rs+1| ... | ... | @@ -81,6 +81,7 @@ pub fn args() -> Args { |
| 81 | 81 | target_os = "horizon", |
| 82 | 82 | target_os = "aix", |
| 83 | 83 | target_os = "nto", |
| 84 | target_os = "qnx", | |
| 84 | 85 | target_os = "hurd", |
| 85 | 86 | target_os = "rtems", |
| 86 | 87 | target_os = "nuttx", |
library/std/src/sys/env_consts.rs+11| ... | ... | @@ -224,6 +224,17 @@ pub mod os { |
| 224 | 224 | pub const EXE_EXTENSION: &str = ""; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | #[cfg(target_os = "qnx")] | |
| 228 | pub mod os { | |
| 229 | pub const FAMILY: &str = "unix"; | |
| 230 | pub const OS: &str = "qnx"; | |
| 231 | pub const DLL_PREFIX: &str = "lib"; | |
| 232 | pub const DLL_SUFFIX: &str = ".so"; | |
| 233 | pub const DLL_EXTENSION: &str = "so"; | |
| 234 | pub const EXE_SUFFIX: &str = ""; | |
| 235 | pub const EXE_EXTENSION: &str = ""; | |
| 236 | } | |
| 237 | ||
| 227 | 238 | #[cfg(target_os = "nuttx")] |
| 228 | 239 | pub mod os { |
| 229 | 240 | pub const FAMILY: &str = "unix"; |
library/std/src/sys/fd/unix.rs+4| ... | ... | @@ -76,6 +76,7 @@ const fn max_iov() -> usize { |
| 76 | 76 | target_os = "emscripten", |
| 77 | 77 | target_os = "linux", |
| 78 | 78 | target_os = "nto", |
| 79 | target_os = "qnx", | |
| 79 | 80 | ))] |
| 80 | 81 | const fn max_iov() -> usize { |
| 81 | 82 | libc::UIO_MAXIOV as usize |
| ... | ... | @@ -91,6 +92,7 @@ const fn max_iov() -> usize { |
| 91 | 92 | target_os = "netbsd", |
| 92 | 93 | target_os = "nuttx", |
| 93 | 94 | target_os = "nto", |
| 95 | target_os = "qnx", | |
| 94 | 96 | target_os = "openbsd", |
| 95 | 97 | target_os = "horizon", |
| 96 | 98 | target_os = "vita", |
| ... | ... | @@ -561,6 +563,7 @@ impl FileDesc { |
| 561 | 563 | target_os = "redox", |
| 562 | 564 | target_os = "vxworks", |
| 563 | 565 | target_os = "nto", |
| 566 | target_os = "qnx", | |
| 564 | 567 | target_os = "wasi", |
| 565 | 568 | )))] |
| 566 | 569 | pub fn set_cloexec(&self) -> io::Result<()> { |
| ... | ... | @@ -585,6 +588,7 @@ impl FileDesc { |
| 585 | 588 | target_os = "redox", |
| 586 | 589 | target_os = "vxworks", |
| 587 | 590 | target_os = "nto", |
| 591 | target_os = "qnx", | |
| 588 | 592 | target_os = "wasi", |
| 589 | 593 | ))] |
| 590 | 594 | pub fn set_cloexec(&self) -> io::Result<()> { |
library/std/src/sys/fs/unix.rs+28-2| ... | ... | @@ -28,6 +28,7 @@ use libc::fstatat64; |
| 28 | 28 | target_os = "fuchsia", |
| 29 | 29 | target_os = "illumos", |
| 30 | 30 | target_os = "nto", |
| 31 | target_os = "qnx", | |
| 31 | 32 | target_os = "redox", |
| 32 | 33 | target_os = "solaris", |
| 33 | 34 | target_os = "vita", |
| ... | ... | @@ -45,6 +46,7 @@ use libc::readdir as readdir64; |
| 45 | 46 | target_os = "l4re", |
| 46 | 47 | target_os = "linux", |
| 47 | 48 | target_os = "nto", |
| 49 | target_os = "qnx", | |
| 48 | 50 | target_os = "redox", |
| 49 | 51 | target_os = "solaris", |
| 50 | 52 | target_os = "vita", |
| ... | ... | @@ -282,6 +284,7 @@ cfg_select! { |
| 282 | 284 | target_os = "horizon", |
| 283 | 285 | target_os = "vita", |
| 284 | 286 | target_os = "nto", |
| 287 | target_os = "qnx", | |
| 285 | 288 | target_os = "vxworks", |
| 286 | 289 | ) => { |
| 287 | 290 | pub use crate::sys::fs::common::Dir; |
| ... | ... | @@ -410,6 +413,7 @@ fn get_path_from_fd(fd: c_int) -> Option<PathBuf> { |
| 410 | 413 | target_os = "illumos", |
| 411 | 414 | target_os = "linux", |
| 412 | 415 | target_os = "nto", |
| 416 | target_os = "qnx", | |
| 413 | 417 | target_os = "redox", |
| 414 | 418 | target_os = "solaris", |
| 415 | 419 | target_os = "vita", |
| ... | ... | @@ -436,6 +440,7 @@ pub struct DirEntry { |
| 436 | 440 | target_os = "illumos", |
| 437 | 441 | target_os = "linux", |
| 438 | 442 | target_os = "nto", |
| 443 | target_os = "qnx", | |
| 439 | 444 | target_os = "redox", |
| 440 | 445 | target_os = "solaris", |
| 441 | 446 | target_os = "vita", |
| ... | ... | @@ -448,6 +453,7 @@ struct dirent64_min { |
| 448 | 453 | target_os = "illumos", |
| 449 | 454 | target_os = "aix", |
| 450 | 455 | target_os = "nto", |
| 456 | target_os = "qnx", | |
| 451 | 457 | target_os = "vita", |
| 452 | 458 | )))] |
| 453 | 459 | d_type: u8, |
| ... | ... | @@ -462,6 +468,7 @@ struct dirent64_min { |
| 462 | 468 | target_os = "illumos", |
| 463 | 469 | target_os = "linux", |
| 464 | 470 | target_os = "nto", |
| 471 | target_os = "qnx", | |
| 465 | 472 | target_os = "redox", |
| 466 | 473 | target_os = "solaris", |
| 467 | 474 | target_os = "vita", |
| ... | ... | @@ -611,7 +618,13 @@ impl FileAttr { |
| 611 | 618 | } |
| 612 | 619 | } |
| 613 | 620 | |
| 614 | #[cfg(not(any(target_os = "netbsd", target_os = "nto", target_os = "aix", target_os = "wasi")))] | |
| 621 | #[cfg(not(any( | |
| 622 | target_os = "netbsd", | |
| 623 | target_os = "nto", | |
| 624 | target_os = "qnx", | |
| 625 | target_os = "aix", | |
| 626 | target_os = "wasi" | |
| 627 | )))] | |
| 615 | 628 | impl FileAttr { |
| 616 | 629 | #[cfg(not(any( |
| 617 | 630 | target_os = "vxworks", |
| ... | ... | @@ -736,7 +749,7 @@ impl FileAttr { |
| 736 | 749 | } |
| 737 | 750 | } |
| 738 | 751 | |
| 739 | #[cfg(any(target_os = "nto", target_os = "wasi"))] | |
| 752 | #[cfg(any(target_os = "nto", target_os = "qnx", target_os = "wasi"))] | |
| 740 | 753 | impl FileAttr { |
| 741 | 754 | pub fn modified(&self) -> io::Result<SystemTime> { |
| 742 | 755 | SystemTime::new(self.stat.st_mtim.tv_sec, self.stat.st_mtim.tv_nsec.into()) |
| ... | ... | @@ -854,6 +867,7 @@ impl Iterator for ReadDir { |
| 854 | 867 | target_os = "illumos", |
| 855 | 868 | target_os = "linux", |
| 856 | 869 | target_os = "nto", |
| 870 | target_os = "qnx", | |
| 857 | 871 | target_os = "redox", |
| 858 | 872 | target_os = "solaris", |
| 859 | 873 | target_os = "vita", |
| ... | ... | @@ -927,6 +941,7 @@ impl Iterator for ReadDir { |
| 927 | 941 | target_os = "illumos", |
| 928 | 942 | target_os = "aix", |
| 929 | 943 | target_os = "nto", |
| 944 | target_os = "qnx", | |
| 930 | 945 | )))] |
| 931 | 946 | d_type: (*entry_ptr).d_type as u8, |
| 932 | 947 | }; |
| ... | ... | @@ -952,6 +967,7 @@ impl Iterator for ReadDir { |
| 952 | 967 | target_os = "illumos", |
| 953 | 968 | target_os = "linux", |
| 954 | 969 | target_os = "nto", |
| 970 | target_os = "qnx", | |
| 955 | 971 | target_os = "redox", |
| 956 | 972 | target_os = "solaris", |
| 957 | 973 | target_os = "vita", |
| ... | ... | @@ -1015,6 +1031,7 @@ impl Drop for DirStream { |
| 1015 | 1031 | miri, |
| 1016 | 1032 | target_os = "redox", |
| 1017 | 1033 | target_os = "nto", |
| 1034 | target_os = "qnx", | |
| 1018 | 1035 | target_os = "vita", |
| 1019 | 1036 | target_os = "hurd", |
| 1020 | 1037 | target_os = "espidf", |
| ... | ... | @@ -1103,6 +1120,7 @@ impl DirEntry { |
| 1103 | 1120 | target_os = "vxworks", |
| 1104 | 1121 | target_os = "aix", |
| 1105 | 1122 | target_os = "nto", |
| 1123 | target_os = "qnx", | |
| 1106 | 1124 | target_os = "vita", |
| 1107 | 1125 | ))] |
| 1108 | 1126 | pub fn file_type(&self) -> io::Result<FileType> { |
| ... | ... | @@ -1116,6 +1134,7 @@ impl DirEntry { |
| 1116 | 1134 | target_os = "vxworks", |
| 1117 | 1135 | target_os = "aix", |
| 1118 | 1136 | target_os = "nto", |
| 1137 | target_os = "qnx", | |
| 1119 | 1138 | target_os = "vita", |
| 1120 | 1139 | )))] |
| 1121 | 1140 | pub fn file_type(&self) -> io::Result<FileType> { |
| ... | ... | @@ -1146,6 +1165,7 @@ impl DirEntry { |
| 1146 | 1165 | target_os = "l4re", |
| 1147 | 1166 | target_os = "linux", |
| 1148 | 1167 | target_os = "nto", |
| 1168 | target_os = "qnx", | |
| 1149 | 1169 | target_os = "redox", |
| 1150 | 1170 | target_os = "rtems", |
| 1151 | 1171 | target_os = "solaris", |
| ... | ... | @@ -1205,6 +1225,7 @@ impl DirEntry { |
| 1205 | 1225 | target_os = "redox", |
| 1206 | 1226 | target_os = "aix", |
| 1207 | 1227 | target_os = "nto", |
| 1228 | target_os = "qnx", | |
| 1208 | 1229 | target_os = "vita", |
| 1209 | 1230 | target_os = "hurd", |
| 1210 | 1231 | target_os = "wasi", |
| ... | ... | @@ -1222,6 +1243,7 @@ impl DirEntry { |
| 1222 | 1243 | target_os = "redox", |
| 1223 | 1244 | target_os = "aix", |
| 1224 | 1245 | target_os = "nto", |
| 1246 | target_os = "qnx", | |
| 1225 | 1247 | target_os = "vita", |
| 1226 | 1248 | target_os = "hurd", |
| 1227 | 1249 | target_os = "wasi", |
| ... | ... | @@ -1419,6 +1441,7 @@ impl File { |
| 1419 | 1441 | target_os = "netbsd", |
| 1420 | 1442 | target_os = "openbsd", |
| 1421 | 1443 | target_os = "nto", |
| 1444 | target_os = "qnx", | |
| 1422 | 1445 | target_os = "hurd", |
| 1423 | 1446 | ))] |
| 1424 | 1447 | unsafe fn os_datasync(fd: c_int) -> c_int { |
| ... | ... | @@ -1433,6 +1456,7 @@ impl File { |
| 1433 | 1456 | target_os = "netbsd", |
| 1434 | 1457 | target_os = "openbsd", |
| 1435 | 1458 | target_os = "nto", |
| 1459 | target_os = "qnx", | |
| 1436 | 1460 | target_os = "hurd", |
| 1437 | 1461 | target_vendor = "apple", |
| 1438 | 1462 | )))] |
| ... | ... | @@ -2405,6 +2429,7 @@ pub use remove_dir_impl::remove_dir_all; |
| 2405 | 2429 | target_os = "horizon", |
| 2406 | 2430 | target_os = "vita", |
| 2407 | 2431 | target_os = "nto", |
| 2432 | target_os = "qnx", | |
| 2408 | 2433 | target_os = "vxworks", |
| 2409 | 2434 | miri |
| 2410 | 2435 | ))] |
| ... | ... | @@ -2419,6 +2444,7 @@ mod remove_dir_impl { |
| 2419 | 2444 | target_os = "horizon", |
| 2420 | 2445 | target_os = "vita", |
| 2421 | 2446 | target_os = "nto", |
| 2447 | target_os = "qnx", | |
| 2422 | 2448 | target_os = "vxworks", |
| 2423 | 2449 | miri |
| 2424 | 2450 | )))] |
library/std/src/sys/io/error/unix.rs+1| ... | ... | @@ -27,6 +27,7 @@ unsafe extern "C" { |
| 27 | 27 | )] |
| 28 | 28 | #[cfg_attr(any(target_os = "solaris", target_os = "illumos"), link_name = "___errno")] |
| 29 | 29 | #[cfg_attr(target_os = "nto", link_name = "__get_errno_ptr")] |
| 30 | #[cfg_attr(target_os = "qnx", link_name = "__get_errno_ptr")] | |
| 30 | 31 | #[cfg_attr(any(target_os = "freebsd", target_vendor = "apple"), link_name = "__error")] |
| 31 | 32 | #[cfg_attr(target_os = "haiku", link_name = "_errnop")] |
| 32 | 33 | #[cfg_attr(target_os = "aix", link_name = "_Errno")] |
library/std/src/sys/net/connection/socket/mod.rs+4-2| ... | ... | @@ -46,6 +46,7 @@ cfg_select! { |
| 46 | 46 | target_os = "haiku", |
| 47 | 47 | target_os = "l4re", |
| 48 | 48 | target_os = "nto", |
| 49 | target_os = "qnx", | |
| 49 | 50 | target_os = "nuttx", |
| 50 | 51 | target_vendor = "apple", |
| 51 | 52 | ) => { |
| ... | ... | @@ -65,7 +66,8 @@ cfg_select! { |
| 65 | 66 | target_os = "dragonfly", target_os = "freebsd", |
| 66 | 67 | target_os = "openbsd", target_os = "netbsd", |
| 67 | 68 | target_os = "solaris", target_os = "illumos", |
| 68 | target_os = "haiku", target_os = "nto", | |
| 69 | target_os = "haiku", | |
| 70 | target_os = "nto", target_os = "qnx", | |
| 69 | 71 | target_os = "cygwin", |
| 70 | 72 | ) => { |
| 71 | 73 | use libc::MSG_NOSIGNAL; |
| ... | ... | @@ -80,7 +82,7 @@ cfg_select! { |
| 80 | 82 | target_os = "dragonfly", target_os = "freebsd", |
| 81 | 83 | target_os = "openbsd", target_os = "netbsd", |
| 82 | 84 | target_os = "solaris", target_os = "illumos", |
| 83 | target_os = "nto", | |
| 85 | target_os = "nto", target_os = "qnx", | |
| 84 | 86 | ) => { |
| 85 | 87 | use crate::ffi::c_uchar; |
| 86 | 88 | type IpV4MultiCastType = c_uchar; |
library/std/src/sys/net/connection/socket/unix.rs+2| ... | ... | @@ -76,6 +76,7 @@ impl Socket { |
| 76 | 76 | target_os = "openbsd", |
| 77 | 77 | target_os = "cygwin", |
| 78 | 78 | target_os = "nto", |
| 79 | target_os = "qnx", | |
| 79 | 80 | target_os = "solaris", |
| 80 | 81 | ) => { |
| 81 | 82 | // On platforms that support it we pass the SOCK_CLOEXEC |
| ... | ... | @@ -124,6 +125,7 @@ impl Socket { |
| 124 | 125 | target_os = "openbsd", |
| 125 | 126 | target_os = "cygwin", |
| 126 | 127 | target_os = "nto", |
| 128 | target_os = "qnx", | |
| 127 | 129 | ) => { |
| 128 | 130 | // Like above, set cloexec atomically |
| 129 | 131 | cvt(libc::socketpair(fam, ty | libc::SOCK_CLOEXEC, 0, fds.as_mut_ptr()))?; |
library/std/src/sys/pal/unix/sync/condvar.rs+4-4| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | 1 | use super::Mutex; |
| 2 | 2 | use crate::cell::UnsafeCell; |
| 3 | 3 | use crate::pin::Pin; |
| 4 | #[cfg(not(target_os = "nto"))] | |
| 4 | #[cfg(not(any(target_os = "nto", target_os = "qnx")))] | |
| 5 | 5 | use crate::sys::pal::time::TIMESPEC_MAX; |
| 6 | #[cfg(target_os = "nto")] | |
| 6 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 7 | 7 | use crate::sys::pal::time::TIMESPEC_MAX_CAPPED; |
| 8 | 8 | use crate::time::Duration; |
| 9 | 9 | |
| ... | ... | @@ -69,10 +69,10 @@ impl Condvar { |
| 69 | 69 | |
| 70 | 70 | let timeout = Timespec::now(Self::CLOCK).checked_add_duration(&dur); |
| 71 | 71 | |
| 72 | #[cfg(not(target_os = "nto"))] | |
| 72 | #[cfg(not(any(target_os = "nto", target_os = "qnx")))] | |
| 73 | 73 | let timeout = timeout.and_then(|t| t.to_timespec()).unwrap_or(TIMESPEC_MAX); |
| 74 | 74 | |
| 75 | #[cfg(target_os = "nto")] | |
| 75 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 76 | 76 | let timeout = timeout.and_then(|t| t.to_timespec_capped()).unwrap_or(TIMESPEC_MAX_CAPPED); |
| 77 | 77 | |
| 78 | 78 | let r = unsafe { libc::pthread_cond_timedwait(self.raw(), mutex, &timeout) }; |
library/std/src/sys/pal/unix/time.rs+1-1| ... | ... | @@ -16,7 +16,7 @@ pub const TIMESPEC_MAX: libc::timespec = { |
| 16 | 16 | |
| 17 | 17 | // This additional constant is only used when calling |
| 18 | 18 | // `libc::pthread_cond_timedwait`. |
| 19 | #[cfg(target_os = "nto")] | |
| 19 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 20 | 20 | pub(in crate::sys) const TIMESPEC_MAX_CAPPED: libc::timespec = libc::timespec { |
| 21 | 21 | tv_sec: (u64::MAX / NSEC_PER_SEC) as i64, |
| 22 | 22 | tv_nsec: (u64::MAX % NSEC_PER_SEC) as i64, |
library/std/src/sys/paths/unix.rs+1-1| ... | ... | @@ -269,7 +269,7 @@ pub fn current_exe() -> io::Result<PathBuf> { |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | #[cfg(target_os = "nto")] | |
| 272 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 273 | 273 | pub fn current_exe() -> io::Result<PathBuf> { |
| 274 | 274 | let mut e = crate::fs::read("/proc/self/exefile")?; |
| 275 | 275 | // Current versions of QNX Neutrino provide a null-terminated path. |
library/std/src/sys/process/unix/unix.rs+21-8| ... | ... | @@ -20,7 +20,7 @@ use crate::sys::process::PidFd; |
| 20 | 20 | use crate::{fmt, mem, sys}; |
| 21 | 21 | |
| 22 | 22 | cfg_select! { |
| 23 | target_os = "nto" => { | |
| 23 | any(target_os = "nto", target_os = "qnx") => { | |
| 24 | 24 | use crate::thread; |
| 25 | 25 | use libc::{c_char, posix_spawn_file_actions_t, posix_spawnattr_t}; |
| 26 | 26 | use crate::time::Duration; |
| ... | ... | @@ -183,7 +183,12 @@ impl Command { |
| 183 | 183 | |
| 184 | 184 | // Attempts to fork the process. If successful, returns Ok((0, -1)) |
| 185 | 185 | // in the child, and Ok((child_pid, -1)) in the parent. |
| 186 | #[cfg(not(any(target_os = "watchos", target_os = "tvos", target_os = "nto")))] | |
| 186 | #[cfg(not(any( | |
| 187 | target_os = "watchos", | |
| 188 | target_os = "tvos", | |
| 189 | target_os = "nto", | |
| 190 | target_os = "qnx" | |
| 191 | )))] | |
| 187 | 192 | unsafe fn do_fork(&mut self) -> Result<pid_t, io::Error> { |
| 188 | 193 | cvt(libc::fork()) |
| 189 | 194 | } |
| ... | ... | @@ -192,7 +197,7 @@ impl Command { |
| 192 | 197 | // or closed a file descriptor while the fork() was occurring". |
| 193 | 198 | // Documentation says "... or try calling fork() again". This is what we do here. |
| 194 | 199 | // See also https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/f/fork.html |
| 195 | #[cfg(target_os = "nto")] | |
| 200 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 196 | 201 | unsafe fn do_fork(&mut self) -> Result<pid_t, io::Error> { |
| 197 | 202 | use crate::sys::io::errno; |
| 198 | 203 | |
| ... | ... | @@ -424,6 +429,7 @@ impl Command { |
| 424 | 429 | all(target_os = "linux", target_env = "gnu"), |
| 425 | 430 | all(target_os = "linux", target_env = "musl"), |
| 426 | 431 | target_os = "nto", |
| 432 | target_os = "qnx", | |
| 427 | 433 | target_vendor = "apple", |
| 428 | 434 | target_os = "cygwin", |
| 429 | 435 | )))] |
| ... | ... | @@ -443,6 +449,7 @@ impl Command { |
| 443 | 449 | all(target_os = "linux", target_env = "gnu"), |
| 444 | 450 | all(target_os = "linux", target_env = "musl"), |
| 445 | 451 | target_os = "nto", |
| 452 | target_os = "qnx", | |
| 446 | 453 | target_vendor = "apple", |
| 447 | 454 | target_os = "cygwin", |
| 448 | 455 | ))] |
| ... | ... | @@ -550,7 +557,7 @@ impl Command { |
| 550 | 557 | // or closed a file descriptor while the posix_spawn() was occurring". |
| 551 | 558 | // Documentation says "... or try calling posix_spawn() again". This is what we do here. |
| 552 | 559 | // See also http://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/p/posix_spawn.html |
| 553 | #[cfg(target_os = "nto")] | |
| 560 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 554 | 561 | unsafe fn retrying_libc_posix_spawnp( |
| 555 | 562 | pid: *mut pid_t, |
| 556 | 563 | file: *const c_char, |
| ... | ... | @@ -763,9 +770,9 @@ impl Command { |
| 763 | 770 | let _env_lock = sys::env::env_read_lock(); |
| 764 | 771 | let envp = envp.map(|c| c.as_ptr()).unwrap_or_else(|| *sys::env::environ() as *const _); |
| 765 | 772 | |
| 766 | #[cfg(not(target_os = "nto"))] | |
| 773 | #[cfg(not(any(target_os = "nto", target_os = "qnx")))] | |
| 767 | 774 | let spawn_fn = libc::posix_spawnp; |
| 768 | #[cfg(target_os = "nto")] | |
| 775 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 769 | 776 | let spawn_fn = retrying_libc_posix_spawnp; |
| 770 | 777 | |
| 771 | 778 | #[cfg(target_os = "linux")] |
| ... | ... | @@ -822,7 +829,7 @@ impl Command { |
| 822 | 829 | envp as *const _, |
| 823 | 830 | ); |
| 824 | 831 | |
| 825 | #[cfg(target_os = "nto")] | |
| 832 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 826 | 833 | let spawn_res = spawn_res?; |
| 827 | 834 | |
| 828 | 835 | cvt_nz(spawn_res)?; |
| ... | ... | @@ -1202,7 +1209,12 @@ fn signal_string(signal: i32) -> &'static str { |
| 1202 | 1209 | ) |
| 1203 | 1210 | ))] |
| 1204 | 1211 | libc::SIGSTKFLT => " (SIGSTKFLT)", |
| 1205 | #[cfg(any(target_os = "linux", target_os = "nto", target_os = "cygwin"))] | |
| 1212 | #[cfg(any( | |
| 1213 | target_os = "linux", | |
| 1214 | target_os = "nto", | |
| 1215 | target_os = "qnx", | |
| 1216 | target_os = "cygwin" | |
| 1217 | ))] | |
| 1206 | 1218 | libc::SIGPWR => " (SIGPWR)", |
| 1207 | 1219 | #[cfg(any( |
| 1208 | 1220 | target_os = "freebsd", |
| ... | ... | @@ -1210,6 +1222,7 @@ fn signal_string(signal: i32) -> &'static str { |
| 1210 | 1222 | target_os = "openbsd", |
| 1211 | 1223 | target_os = "dragonfly", |
| 1212 | 1224 | target_os = "nto", |
| 1225 | target_os = "qnx", | |
| 1213 | 1226 | target_vendor = "apple", |
| 1214 | 1227 | target_os = "cygwin", |
| 1215 | 1228 | ))] |
library/std/src/sys/random/mod.rs+1| ... | ... | @@ -54,6 +54,7 @@ cfg_select! { |
| 54 | 54 | target_os = "hurd", |
| 55 | 55 | target_os = "l4re", |
| 56 | 56 | target_os = "nto", |
| 57 | target_os = "qnx", | |
| 57 | 58 | ) => { |
| 58 | 59 | mod unix_legacy; |
| 59 | 60 | pub use unix_legacy::fill_bytes; |
library/std/src/sys/thread/unix.rs+6-1| ... | ... | @@ -12,7 +12,12 @@ use crate::mem::{self, DropGuard, ManuallyDrop}; |
| 12 | 12 | use crate::num::NonZero; |
| 13 | 13 | #[cfg(all(target_os = "linux", target_env = "gnu"))] |
| 14 | 14 | use crate::sys::weak::dlsym; |
| 15 | #[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "nto",))] | |
| 15 | #[cfg(any( | |
| 16 | target_os = "solaris", | |
| 17 | target_os = "illumos", | |
| 18 | target_os = "nto", | |
| 19 | target_os = "qnx", | |
| 20 | ))] | |
| 16 | 21 | use crate::sys::weak::weak; |
| 17 | 22 | use crate::thread::ThreadInit; |
| 18 | 23 | use crate::time::Duration; |
library/unwind/src/lib.rs+1-1| ... | ... | @@ -193,7 +193,7 @@ unsafe extern "C" {} |
| 193 | 193 | #[link(name = "unwind")] |
| 194 | 194 | unsafe extern "C" {} |
| 195 | 195 | |
| 196 | #[cfg(target_os = "nto")] | |
| 196 | #[cfg(any(target_os = "nto", target_os = "qnx"))] | |
| 197 | 197 | cfg_select! { |
| 198 | 198 | target_env = "nto70" => { |
| 199 | 199 | #[link(name = "gcc")] |
src/bootstrap/src/core/config/tests.rs+10| ... | ... | @@ -11,6 +11,7 @@ use serde::Deserialize; |
| 11 | 11 | |
| 12 | 12 | use super::flags::Flags; |
| 13 | 13 | use super::toml::change_id::ChangeIdWrapper; |
| 14 | use super::toml::rust::parse_codegen_backends; | |
| 14 | 15 | use super::{Config, RUSTC_IF_UNCHANGED_ALLOWED_PATHS}; |
| 15 | 16 | use crate::ChangeId; |
| 16 | 17 | use crate::core::build_steps::clippy::{LintConfig, get_clippy_rules_in_order}; |
| ... | ... | @@ -206,6 +207,15 @@ fn rust_optimize() { |
| 206 | 207 | assert_eq!(parse("rust.optimize = \"s\"").rust_optimize.get_opt_level(), Some("s".to_string())); |
| 207 | 208 | } |
| 208 | 209 | |
| 210 | #[test] | |
| 211 | #[should_panic(expected = "Duplicate value 'llvm' for 'rust.codegen-backends'")] | |
| 212 | fn rejects_duplicate_codegen_backends() { | |
| 213 | parse_codegen_backends( | |
| 214 | vec!["llvm", "llvm", "cranelift"].into_iter().map(str::to_owned).collect(), | |
| 215 | "rust", | |
| 216 | ); | |
| 217 | } | |
| 218 | ||
| 209 | 219 | #[test] |
| 210 | 220 | #[should_panic] |
| 211 | 221 | fn invalid_rust_optimize() { |
src/bootstrap/src/core/config/toml/rust.rs+20-10| ... | ... | @@ -422,23 +422,33 @@ pub(crate) fn parse_codegen_backends( |
| 422 | 422 | Please, use '{stripped}' instead." |
| 423 | 423 | ) |
| 424 | 424 | } |
| 425 | if !BUILTIN_CODEGEN_BACKENDS.contains(&backend.as_str()) { | |
| 425 | let backend = match backend.as_str() { | |
| 426 | "llvm" => CodegenBackendKind::Llvm, | |
| 427 | "cranelift" => CodegenBackendKind::Cranelift, | |
| 428 | "gcc" => CodegenBackendKind::Gcc, | |
| 429 | backend => CodegenBackendKind::Custom(backend.to_string()), | |
| 430 | }; | |
| 431 | ||
| 432 | if found_backends.contains(&backend) { | |
| 433 | panic!( | |
| 434 | "Duplicate value '{}' for '{section}.codegen-backends'. \ | |
| 435 | Each codegen backend should only be specified once.", | |
| 436 | backend.name() | |
| 437 | ); | |
| 438 | } | |
| 439 | ||
| 440 | if !BUILTIN_CODEGEN_BACKENDS.contains(&backend.name()) { | |
| 426 | 441 | if CiEnv::is_rust_lang_managed_ci_job() { |
| 427 | eprintln!("Unknown codegen backend {backend}"); | |
| 442 | eprintln!("Unknown codegen backend {}", backend.name()); | |
| 428 | 443 | exit!(1); |
| 429 | 444 | } |
| 430 | 445 | |
| 431 | 446 | println!( |
| 432 | "HELP: '{backend}' for '{section}.codegen-backends' might fail. \ | |
| 433 | List of known codegen backends: {BUILTIN_CODEGEN_BACKENDS:?}" | |
| 447 | "HELP: '{}' for '{section}.codegen-backends' might fail. \ | |
| 448 | List of known codegen backends: {BUILTIN_CODEGEN_BACKENDS:?}", | |
| 449 | backend.name() | |
| 434 | 450 | ); |
| 435 | 451 | } |
| 436 | let backend = match backend.as_str() { | |
| 437 | "llvm" => CodegenBackendKind::Llvm, | |
| 438 | "cranelift" => CodegenBackendKind::Cranelift, | |
| 439 | "gcc" => CodegenBackendKind::Gcc, | |
| 440 | backend => CodegenBackendKind::Custom(backend.to_string()), | |
| 441 | }; | |
| 442 | 452 | found_backends.push(backend); |
| 443 | 453 | } |
| 444 | 454 | if found_backends.is_empty() { |
src/bootstrap/src/core/sanity.rs+2| ... | ... | @@ -39,6 +39,8 @@ const STAGE0_MISSING_TARGETS: &[&str] = &[ |
| 39 | 39 | // just a dummy comment so the list doesn't get onelined |
| 40 | 40 | "powerpc64-unknown-linux-gnuelfv2", |
| 41 | 41 | "aarch64-unknown-linux-pauthtest", // Stage 0 compiler is not guaranteed to see the target yet. |
| 42 | "aarch64-unknown-qnx", | |
| 43 | "x86_64-pc-qnx", | |
| 42 | 44 | ]; |
| 43 | 45 | |
| 44 | 46 | /// Minimum version threshold for libstdc++ required when using prebuilt LLVM |
src/doc/rustc/src/platform-support.md+2-2| ... | ... | @@ -278,7 +278,7 @@ target | std | host | notes |
| 278 | 278 | [`aarch64-unknown-nto-qnx700`](platform-support/nto-qnx.md) | ? | | ARM64 QNX Neutrino 7.0 RTOS | |
| 279 | 279 | [`aarch64-unknown-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS with default network stack (io-pkt) | |
| 280 | 280 | [`aarch64-unknown-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS with new network stack (io-sock) | |
| 281 | [`aarch64-unknown-nto-qnx800`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 8.0 RTOS | | |
| 281 | [`aarch64-unknown-qnx`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX SDP 8.0+ | | |
| 282 | 282 | [`aarch64-unknown-nuttx`](platform-support/nuttx.md) | ✓ | | ARM64 with NuttX |
| 283 | 283 | [`aarch64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | ARM64 OpenBSD |
| 284 | 284 | [`aarch64-unknown-redox`](platform-support/redox.md) | ✓ | | ARM64 Redox OS |
| ... | ... | @@ -451,7 +451,7 @@ target | std | host | notes |
| 451 | 451 | [`x86_64-pc-cygwin`](platform-support/x86_64-pc-cygwin.md) | ✓ | | 64-bit x86 Cygwin | |
| 452 | 452 | [`x86_64-pc-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS with default network stack (io-pkt) | |
| 453 | 453 | [`x86_64-pc-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 7.1 RTOS with new network stack (io-sock) | |
| 454 | [`x86_64-pc-nto-qnx800`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX Neutrino 8.0 RTOS | | |
| 454 | [`x86_64-pc-qnx`](platform-support/nto-qnx.md) | ✓ | | x86 64-bit QNX SDP 8.0+ | | |
| 455 | 455 | [`x86_64-unikraft-linux-musl`](platform-support/unikraft-linux-musl.md) | ✓ | | 64-bit Unikraft with musl 1.2.5 |
| 456 | 456 | `x86_64-unknown-dragonfly` | ✓ | ✓ | 64-bit DragonFlyBSD |
| 457 | 457 | `x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku |
src/doc/rustc/src/platform-support/nto-qnx.md+99-120| ... | ... | @@ -1,15 +1,22 @@ |
| 1 | # nto-qnx | |
| 1 | # QNX | |
| 2 | 2 | |
| 3 | 3 | **Tier: 3** |
| 4 | 4 | |
| 5 | The [QNX®][qnx.com] Neutrino (nto) Real-time operating system. Known as QNX OS | |
| 6 | from version 8 onwards. | |
| 5 | Support for the [QNX®][qnx.com] [QNX Software Development Platform (SDP)], version 7.0, 7.1 and 8.0. | |
| 7 | 6 | |
| 8 | This support has been implemented jointly by [Elektrobit Automotive GmbH][Elektrobit] | |
| 9 | and [QNX][qnx.com]. | |
| 7 | [QNX Software Development Platform (SDP)]: https://qnx.software/en/software/products-and-solutions/qnx-software-development-platform | |
| 10 | 8 | |
| 11 | [qnx.com]: https://blackberry.qnx.com | |
| 12 | [Elektrobit]: https://www.elektrobit.com | |
| 9 | The [QNX Software Development Platform (SDP)] is a development environment that | |
| 10 | you download and install on a host computer. It includes a C toolchain for your | |
| 11 | host, an IDE, and various board support packages for different target platforms. | |
| 12 | You can then use QNX SDP to build a custom run-time environment which you deploy | |
| 13 | onto an embedded device. That run-time environment will include a microkernel, | |
| 14 | whatever services you have selected, and perhaps one or more applications | |
| 15 | written in Rust. | |
| 16 | ||
| 17 | In QNX SDP 7.x the run-time environment is based on QNX Neutrino RTOS 7.x, while | |
| 18 | in QNX SDP 8.0 the run-time environment is based on QNX OS 8.0. The name change | |
| 19 | reflects architectural changes in the RTOS, but both use a microkernel design. | |
| 13 | 20 | |
| 14 | 21 | ## Target maintainers |
| 15 | 22 | |
| ... | ... | @@ -20,107 +27,52 @@ and [QNX][qnx.com]. |
| 20 | 27 | |
| 21 | 28 | ## Requirements |
| 22 | 29 | |
| 23 | Currently, the following QNX versions and compilation targets are supported: | |
| 30 | The following QNX SDP versions and compilation targets are supported: | |
| 24 | 31 | |
| 25 | 32 | | Target Tuple | QNX Version | Target Architecture | Full support | `no_std` support | |
| 26 | 33 | | ----------------------------------- | ----------------------------- | ------------------- | :----------: | :--------------: | |
| 27 | | `aarch64-unknown-nto-qnx800` | QNX OS 8.0 | AArch64 | ? | ✓ | | |
| 28 | | `x86_64-pc-nto-qnx800` | QNX OS 8.0 | x86_64 | ? | ✓ | | |
| 29 | | `aarch64-unknown-nto-qnx710` | QNX Neutrino 7.1 with io-pkt | AArch64 | ✓ | ✓ | | |
| 30 | | `x86_64-pc-nto-qnx710` | QNX Neutrino 7.1 with io-pkt | x86_64 | ✓ | ✓ | | |
| 31 | | `aarch64-unknown-nto-qnx710_iosock` | QNX Neutrino 7.1 with io-sock | AArch64 | ? | ✓ | | |
| 32 | | `x86_64-pc-nto-qnx710_iosock` | QNX Neutrino 7.1 with io-sock | x86_64 | ? | ✓ | | |
| 33 | | `aarch64-unknown-nto-qnx700` | QNX Neutrino 7.0 | AArch64 | ? | ✓ | | |
| 34 | | `i686-pc-nto-qnx700` | QNX Neutrino 7.0 | x86 | | ✓ | | |
| 35 | ||
| 36 | On QNX Neutrino 7.0 and 7.1, `io-pkt` is used as network stack by default. | |
| 37 | QNX Neutrino 7.1 includes the optional network stack `io-sock`. | |
| 38 | QNX OS 8.0 always uses `io-sock`. QNX OS 8.0 support is currently work in progress. | |
| 39 | ||
| 40 | Adding other architectures that are supported by QNX is possible. | |
| 41 | ||
| 42 | In the table above, 'full support' indicates support for building Rust applications with the full standard library. A '?' means that support is in-progress. | |
| 43 | '`no_std` support' is for building `#![no_std]` applications where only `core` and `alloc` are available. | |
| 44 | ||
| 45 | For building or using the Rust toolchain for QNX, the | |
| 46 | [QNX Software Development Platform (SDP)](https://blackberry.qnx.com/en/products/foundation-software/qnx-software-development-platform) | |
| 47 | must be installed and initialized. | |
| 48 | Initialization is usually done by sourcing `qnxsdp-env.sh` (this will be installed as part of the SDP, see also installation instruction provided with the SDP). | |
| 49 | Afterwards [`qcc`](https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.utilities/topic/q/qcc.html) (QNX C/C++ compiler) | |
| 50 | should be available (in the `$PATH` variable). | |
| 51 | `qcc` will be called e.g. for linking executables. | |
| 52 | ||
| 53 | When linking `no_std` applications, they must link against `libc.so` (see example). This is | |
| 54 | required because applications always link against the `crt` library and `crt` depends on `libc.so`. | |
| 55 | This is done automatically when using the standard library. | |
| 56 | ||
| 57 | ### Disabling RELocation Read-Only (RELRO) | |
| 58 | ||
| 59 | While not recommended by default, some QNX kernel setups may require the `RELRO` to be disabled with `-C relro_level=off`, e.g. by adding it to the `.cargo/config.toml` file: | |
| 60 | ||
| 61 | ```toml | |
| 62 | [target.aarch64-unknown-nto-qnx700] | |
| 63 | rustflags = ["-C", "relro_level=off"] | |
| 64 | ``` | |
| 65 | ||
| 66 | If your QNX kernel does not allow it, and `relro` is not disabled, running compiled binary would fail with `syntax error: ... unexpected` or similar. This is due to kernel trying to interpret compiled binary with `/bin/sh`, and obviously failing. To verify that this is really the case, run your binary with the `DL_DEBUG=all` env var, and look for this output. If you see it, you should disable `relro` as described above. | |
| 67 | ||
| 68 | ```text | |
| 69 | Resolution scope for Executable->/bin/sh: | |
| 70 | Executable->/bin/sh | |
| 71 | libc.so.4->/usr/lib/ldqnx-64.so.2 | |
| 72 | ``` | |
| 73 | ||
| 74 | ### Small example application | |
| 75 | ||
| 76 | Small `no_std` example is shown below. Applications using the standard library work as well. | |
| 77 | ||
| 78 | ```rust,ignore (platform-specific) | |
| 79 | #![no_std] | |
| 80 | #![no_main] | |
| 81 | #![feature(lang_items)] | |
| 82 | ||
| 83 | // We must always link against libc, even if no external functions are used | |
| 84 | // "extern C" - Block can be empty but must be present | |
| 85 | #[link(name = "c")] | |
| 86 | extern "C" { | |
| 87 | pub fn printf(format: *const core::ffi::c_char, ...) -> core::ffi::c_int; | |
| 88 | } | |
| 89 | ||
| 90 | #[no_mangle] | |
| 91 | pub extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int { | |
| 92 | const HELLO: &'static str = "Hello World, the answer is %d\n\0"; | |
| 93 | unsafe { | |
| 94 | printf(HELLO.as_ptr() as *const _, 42); | |
| 95 | } | |
| 96 | 0 | |
| 97 | } | |
| 98 | ||
| 99 | use core::panic::PanicInfo; | |
| 100 | ||
| 101 | #[panic_handler] | |
| 102 | fn panic(_panic: &PanicInfo<'_>) -> ! { | |
| 103 | loop {} | |
| 104 | } | |
| 105 | ||
| 106 | #[lang = "eh_personality"] | |
| 107 | #[no_mangle] | |
| 108 | pub extern "C" fn rust_eh_personality() {} | |
| 109 | ``` | |
| 110 | ||
| 111 | The QNX support in Rust has been tested with QNX Neutrino 7.0 and 7.1. Support for QNX OS 8.0 is a work in progress. | |
| 112 | ||
| 113 | There are no further known requirements. | |
| 34 | | `aarch64-unknown-qnx` | QNX SDP 8.0+ | AArch64 | ? | ✓ | | |
| 35 | | `x86_64-pc-qnx` | QNX SDP 8.0+ | x86_64 | ? | ✓ | | |
| 36 | | `aarch64-unknown-nto-qnx710_iosock` | QNX SDP 7.1 with io-sock | AArch64 | ? | ✓ | | |
| 37 | | `x86_64-pc-nto-qnx710_iosock` | QNX SDP 7.1 with io-sock | x86_64 | ? | ✓ | | |
| 38 | | `aarch64-unknown-nto-qnx710` | QNX SDP 7.1 with io-pkt | AArch64 | ✓ | ✓ | | |
| 39 | | `x86_64-pc-nto-qnx710` | QNX SDP 7.1 with io-pkt | x86_64 | ✓ | ✓ | | |
| 40 | | `aarch64-unknown-nto-qnx700` | QNX SDP 7.0 | AArch64 | ? | ✓ | | |
| 41 | | `i686-pc-nto-qnx700` | QNX SDP 7.0 | x86 | - | ✓ | | |
| 42 | ||
| 43 | * QNX SDP 7.0 only offers the `io-pkt` network stack | |
| 44 | * QNX SDP 7.1 uses the `io-pkt` network stack by default, but also includes the optional `io-sock` network stack | |
| 45 | * QNX SDP 8.0 only offers the `io-sock` network stack | |
| 46 | ||
| 47 | In the table above, 'full support' indicates support for building Rust | |
| 48 | applications with the full standard library. A '?' means that support is | |
| 49 | in-progress. `no_std` support is for building `#![no_std]` applications where | |
| 50 | only `core` and `alloc` are available. | |
| 51 | ||
| 52 | For building or using the Rust toolchain for QNX, the relevant version of the | |
| 53 | [QNX Software Development Platform (SDP)] must be installed and initialized. | |
| 54 | Initialization is usually done by sourcing `qnxsdp-env.sh` (this will be | |
| 55 | installed as part of the SDP, so see the installation instruction provided with | |
| 56 | the SDP). Afterwards [`qcc`] (the QNX C/C++ compiler) should be available in | |
| 57 | your system PATH because it will be called during Rust compilation (e.g. for | |
| 58 | linking executables). | |
| 59 | ||
| 60 | [`qcc`]: https://www.qnx.com/developers/docs/latest/com.qnx.doc.neutrino.utilities/topic/q/qcc.html | |
| 61 | ||
| 62 | When linking `no_std` applications, they must link against `libc.so` (see | |
| 63 | example). This is required because applications always link against the `crt` | |
| 64 | library and `crt` depends on `libc.so`. This is done automatically when using | |
| 65 | the standard library. | |
| 114 | 66 | |
| 115 | 67 | ## Conditional compilation |
| 116 | 68 | |
| 117 | For conditional compilation, following QNX specific attributes are defined: | |
| 69 | For conditional compilation, the following QNX specific attributes are defined: | |
| 118 | 70 | |
| 119 | 71 | - `target_os` = `"nto"` |
| 120 | - `target_env` = `"nto71"` (for QNX Neutrino 7.1 with "classic" network stack "io_pkt") | |
| 121 | - `target_env` = `"nto71_iosock"` (for QNX Neutrino 7.1 with network stack "io_sock") | |
| 122 | - `target_env` = `"nto70"` (for QNX Neutrino 7.0) | |
| 123 | - `target_env` = `"nto80"` (for QNX OS 8.0) | |
| 72 | - `target_env` = `"nto70"` (for QNX SDP 7.0) | |
| 73 | - `target_env` = `"nto71"` (for QNX SDP 7.1 with "classic" network stack "io_pkt") | |
| 74 | - `target_env` = `"nto71_iosock"` (for QNX SDP 7.1 with "new" network stack "io_sock") | |
| 75 | - `target_os` = `"qnx"` (for QNX SDP 8.0 or higher) | |
| 124 | 76 | |
| 125 | 77 | ## Building the target |
| 126 | 78 | |
| ... | ... | @@ -176,18 +128,37 @@ For conditional compilation, following QNX specific attributes are defined: |
| 176 | 128 | rustc library/core library/alloc library/std |
| 177 | 129 | ``` |
| 178 | 130 | |
| 131 | ## Building Rust programs | |
| 132 | ||
| 133 | Rust does not ship pre-compiled artifacts for this target. To compile for this | |
| 134 | target, you must either build Rust with the target enabled (see "Building the | |
| 135 | target" above), or build your own copy of `core` by using `build-std` or | |
| 136 | similar. | |
| 137 | ||
| 138 | Compiled executables can run directly on QNX, either by including them in the | |
| 139 | disk image, or copying them over the network to a running system. | |
| 140 | ||
| 141 | Compiling C code requires the same environment variables to be set as compiling | |
| 142 | the Rust toolchain (see above), to ensure `qcc` is used with proper arguments. | |
| 143 | To ensure compatibility, do not specify any further arguments that for example | |
| 144 | change calling conventions or memory layout. | |
| 145 | ||
| 179 | 146 | ## Running the Rust test suite |
| 180 | 147 | |
| 181 | The test suites of the Rust compiler and standard library can be executed much like other Rust targets. | |
| 182 | The environment for testing should match the one used during compiler compilation (refer to `build_env` and `qcc`/`PATH` above) with the | |
| 183 | addition of the TEST_DEVICE_ADDR environment variable. | |
| 184 | The TEST_DEVICE_ADDR variable controls the remote runner and should point to the target, despite localhost being shown in the following example. | |
| 185 | Note that some tests are failing which is why they are currently excluded by the target maintainers which can be seen in the following example. | |
| 148 | The test suites of the Rust compiler and standard library can be executed much | |
| 149 | like other Rust targets. The environment for testing should match the one used | |
| 150 | during compiler compilation (refer to `build_env` and `qcc`/`PATH` above) with | |
| 151 | the addition of the `TEST_DEVICE_ADDR` environment variable. The | |
| 152 | `TEST_DEVICE_ADDR` variable controls the remote runner and should point to a | |
| 153 | target running the `remote-test-server` executable. | |
| 154 | ||
| 155 | Note that some tests are failing which is why they are currently excluded by the | |
| 156 | target maintainers which can be seen in the following example. | |
| 186 | 157 | |
| 187 | 158 | To run all tests on a x86_64 QNX Neutrino 7.1 target: |
| 188 | 159 | |
| 189 | 160 | ```bash |
| 190 | export TEST_DEVICE_ADDR="localhost:12345" # must address the test target, can be a SSH tunnel | |
| 161 | export TEST_DEVICE_ADDR="1.2.3.4:12345" # must address the test target, can be a SSH tunnel | |
| 191 | 162 | export build_env=<see above> |
| 192 | 163 | |
| 193 | 164 | # Disable tests that only work on the host or don't make sense for this target. |
| ... | ... | @@ -210,16 +181,6 @@ env $build_env \ |
| 210 | 181 | --target x86_64-pc-nto-qnx710 |
| 211 | 182 | ``` |
| 212 | 183 | |
| 213 | ## Building Rust programs | |
| 214 | ||
| 215 | Rust does not yet ship pre-compiled artifacts for this target. | |
| 216 | To compile for this target, you must either build Rust with the target enabled (see "Building the target" above), | |
| 217 | or build your own copy of `core` by using `build-std` or similar. | |
| 218 | ||
| 219 | ## Testing | |
| 220 | ||
| 221 | Compiled executables can run directly on QNX. | |
| 222 | ||
| 223 | 184 | ### Rust std library test suite |
| 224 | 185 | |
| 225 | 186 | The target needs sufficient resources to execute all tests. The commands below assume that a QEMU image |
| ... | ... | @@ -279,8 +240,26 @@ is used. |
| 279 | 240 | 64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=1 ms |
| 280 | 241 | ``` |
| 281 | 242 | |
| 282 | ## Cross-compilation toolchains and C code | |
| 243 | ## Disabling RELocation Read-Only (RELRO) | |
| 244 | ||
| 245 | While not recommended by default, some QNX kernel setups may require the `RELRO` | |
| 246 | to be disabled with `-C relro_level=off`, e.g. by adding it to the | |
| 247 | `.cargo/config.toml` file: | |
| 283 | 248 | |
| 284 | Compiling C code requires the same environment variables to be set as compiling the Rust toolchain (see above), | |
| 285 | to ensure `qcc` is used with proper arguments. | |
| 286 | To ensure compatibility, do not specify any further arguments that for example change calling conventions or memory layout. | |
| 249 | ```toml | |
| 250 | [target.aarch64-unknown-nto-qnx700] | |
| 251 | rustflags = ["-C", "relro_level=off"] | |
| 252 | ``` | |
| 253 | ||
| 254 | If your QNX kernel does not allow it, and `relro` is not disabled, running the | |
| 255 | compiled binary would fail with `syntax error: ... unexpected` or similar. This | |
| 256 | is due to kernel trying to interpret the compiled binary with `/bin/sh`, and | |
| 257 | obviously failing. To verify that this is really the case, run your binary with | |
| 258 | the `DL_DEBUG=all` env var, and look for this output. If you see it, you should | |
| 259 | disable `relro` as described above. | |
| 260 | ||
| 261 | ```text | |
| 262 | Resolution scope for Executable->/bin/sh: | |
| 263 | Executable->/bin/sh | |
| 264 | libc.so.4->/usr/lib/ldqnx-64.so.2 | |
| 265 | ``` |
src/librustdoc/clean/cfg.rs+5-5| ... | ... | @@ -638,11 +638,12 @@ fn human_readable_target_os(os: Symbol) -> Option<&'static str> { |
| 638 | 638 | Motor => "Motor OS", |
| 639 | 639 | NetBsd => "NetBSD", |
| 640 | 640 | None => "bare-metal", |
| 641 | Nto => "QNX Neutrino", | |
| 641 | Nto => "QNX SDP 7.x", | |
| 642 | 642 | NuttX => "NuttX", |
| 643 | 643 | OpenBsd => "OpenBSD", |
| 644 | 644 | Psp => "Play Station Portable", |
| 645 | 645 | Psx => "Play Station 1", |
| 646 | Qnx => "QNX SDP 8.0+", | |
| 646 | 647 | Qurt => "QuRT", |
| 647 | 648 | Redox => "Redox OS", |
| 648 | 649 | Rtems => "RTEMS OS", |
| ... | ... | @@ -718,10 +719,9 @@ fn human_readable_target_env(env: Symbol) -> Option<&'static str> { |
| 718 | 719 | Msvc => "MSVC", |
| 719 | 720 | Musl => "musl", |
| 720 | 721 | Newlib => "Newlib", |
| 721 | Nto70 => "Neutrino 7.0", | |
| 722 | Nto71 => "Neutrino 7.1", | |
| 723 | Nto71IoSock => "Neutrino 7.1 with io-sock", | |
| 724 | Nto80 => "Neutrino 8.0", | |
| 722 | Nto70 => "QNX SDP 7.0", | |
| 723 | Nto71 => "QNX SDP 7.1", | |
| 724 | Nto71IoSock => "QNX SDP 7.1 with io-sock", | |
| 725 | 725 | Ohos => "OpenHarmony", |
| 726 | 726 | P1 => "WASIp1", |
| 727 | 727 | P2 => "WASIp2", |
src/tools/linkchecker/Cargo.toml+1-1| ... | ... | @@ -9,5 +9,5 @@ path = "main.rs" |
| 9 | 9 | |
| 10 | 10 | [dependencies] |
| 11 | 11 | regex = "1" |
| 12 | html5ever = "0.29.0" | |
| 12 | html5ever = "0.39.0" | |
| 13 | 13 | urlencoding = "2.1.3" |
src/tools/miri/src/shims/native_lib/mod.rs+1-1| ... | ... | @@ -321,7 +321,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { |
| 321 | 321 | imm.layout |
| 322 | 322 | ) |
| 323 | 323 | }; |
| 324 | a.size(this).align_to(b.align(this).abi).bytes_usize() | |
| 324 | a.size(this).align_to(b.default_align(this).abi).bytes_usize() | |
| 325 | 325 | }; |
| 326 | 326 | |
| 327 | 327 | write_scalar(this, sc_first, 0)?; |
src/tools/miri/tests/pass-dep/shims/gettid.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ fn gettid() -> u64 { |
| 9 | 9 | any(target_os = "android", target_os = "linux") => { |
| 10 | 10 | gettid_linux_like() |
| 11 | 11 | } |
| 12 | target_os = "nto" => { | |
| 12 | any(target_os = "nto", target_os = "qnx") => { | |
| 13 | 13 | unsafe { libc::gettid() as u64 } |
| 14 | 14 | } |
| 15 | 15 | target_os = "openbsd" => { |
tests/assembly-llvm/targets/targets-elf.rs+6-6| ... | ... | @@ -88,9 +88,9 @@ |
| 88 | 88 | //@ revisions: aarch64_unknown_nto_qnx710_iosock |
| 89 | 89 | //@ [aarch64_unknown_nto_qnx710_iosock] compile-flags: --target aarch64-unknown-nto-qnx710_iosock |
| 90 | 90 | //@ [aarch64_unknown_nto_qnx710_iosock] needs-llvm-components: aarch64 |
| 91 | //@ revisions: aarch64_unknown_nto_qnx800 | |
| 92 | //@ [aarch64_unknown_nto_qnx800] compile-flags: --target aarch64-unknown-nto-qnx800 | |
| 93 | //@ [aarch64_unknown_nto_qnx800] needs-llvm-components: aarch64 | |
| 91 | //@ revisions: aarch64_unknown_qnx | |
| 92 | //@ [aarch64_unknown_qnx] compile-flags: --target aarch64-unknown-qnx | |
| 93 | //@ [aarch64_unknown_qnx] needs-llvm-components: aarch64 | |
| 94 | 94 | //@ revisions: aarch64_unknown_openbsd |
| 95 | 95 | //@ [aarch64_unknown_openbsd] compile-flags: --target aarch64-unknown-openbsd |
| 96 | 96 | //@ [aarch64_unknown_openbsd] needs-llvm-components: aarch64 |
| ... | ... | @@ -685,9 +685,9 @@ |
| 685 | 685 | //@ revisions: x86_64_pc_nto_qnx710_iosock |
| 686 | 686 | //@ [x86_64_pc_nto_qnx710_iosock] compile-flags: --target x86_64-pc-nto-qnx710_iosock |
| 687 | 687 | //@ [x86_64_pc_nto_qnx710_iosock] needs-llvm-components: x86 |
| 688 | //@ revisions: x86_64_pc_nto_qnx800 | |
| 689 | //@ [x86_64_pc_nto_qnx800] compile-flags: --target x86_64-pc-nto-qnx800 | |
| 690 | //@ [x86_64_pc_nto_qnx800] needs-llvm-components: x86 | |
| 688 | //@ revisions: x86_64_pc_qnx | |
| 689 | //@ [x86_64_pc_qnx] compile-flags: --target x86_64-pc-qnx | |
| 690 | //@ [x86_64_pc_qnx] needs-llvm-components: x86 | |
| 691 | 691 | //@ revisions: x86_64_pc_solaris |
| 692 | 692 | //@ [x86_64_pc_solaris] compile-flags: --target x86_64-pc-solaris |
| 693 | 693 | //@ [x86_64_pc_solaris] needs-llvm-components: x86 |
tests/rustdoc-html/doc-cfg/all-targets.rs+5-5| ... | ... | @@ -3,9 +3,9 @@ |
| 3 | 3 | //@ has all_targets/fn.foo.html \ |
| 4 | 4 | // '//*[@id="main-content"]/*[@class="item-info"]/*[@class="stab portability"]' \ |
| 5 | 5 | // 'Available on target_env=fake_env or Catalyst or GNU or Managarm C Library \ |
| 6 | // or MSVC or musl or Neutrino 7.0 or Neutrino 7.1 or Neutrino 7.1 with io-sock \ | |
| 7 | // or Neutrino 8.0 or Newlib or OpenHarmony or relibc or SGX or Simulator or \ | |
| 8 | // uClibc or V5 or WASIp1 or WASIp2 or WASIp3 only.' | |
| 6 | // or MSVC or musl or Newlib or OpenHarmony or QNX SDP 7.0 or QNX SDP 7.1 or \ | |
| 7 | // QNX SDP 7.1 with io-sock or relibc or SGX or Simulator or uClibc or V5 or WASIp1 \ | |
| 8 | // or WASIp2 or WASIp3 only.' | |
| 9 | 9 | #[doc(cfg(any( |
| 10 | 10 | target_env = "gnu", |
| 11 | 11 | target_env = "macabi", |
| ... | ... | @@ -16,7 +16,6 @@ |
| 16 | 16 | target_env = "nto70", |
| 17 | 17 | target_env = "nto71", |
| 18 | 18 | target_env = "nto71_iosock", |
| 19 | target_env = "nto80", | |
| 20 | 19 | target_env = "ohos", |
| 21 | 20 | target_env = "relibc", |
| 22 | 21 | target_env = "sgx", |
| ... | ... | @@ -81,7 +80,7 @@ pub fn bar() {} |
| 81 | 80 | // and HelenOS and Hermit and Horizon and illumos and iOS and L4Re and Linux \ |
| 82 | 81 | // and LynxOS-178 and macOS and Managarm and Motor OS and NetBSD and NuttX \ |
| 83 | 82 | // and OpenBSD and Play Station 1 and Play Station Portable and Play Station Vita \ |
| 84 | // and QNX Neutrino and QuRT and Redox OS and RTEMS OS and Solaris and \ | |
| 83 | // and QNX SDP 7.x and QNX SDP 8.0+ and QuRT and Redox OS and RTEMS OS and Solaris and \ | |
| 85 | 84 | // SOLID ASP3 and TEEOS and Trusty and tvOS and UEFI and VEXos and visionOS \ |
| 86 | 85 | // and VxWorks and WASI and watchOS and Windows and Xous and zero knowledge \ |
| 87 | 86 | // Virtual Machine only.' |
| ... | ... | @@ -112,6 +111,7 @@ pub fn bar() {} |
| 112 | 111 | target_os = "netbsd", |
| 113 | 112 | target_os = "none", |
| 114 | 113 | target_os = "nto", |
| 114 | target_os = "qnx", | |
| 115 | 115 | target_os = "nuttx", |
| 116 | 116 | target_os = "openbsd", |
| 117 | 117 | target_os = "psp", |
tests/rustdoc-html/doc-cfg/sort.rs+2-4| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | // Tests that OS targets are sorted alphabetically. |
| 10 | 10 | //@ has 'foo/fn.foo.html' |
| 11 | 11 | //@ has - '//*[@class="stab portability"]' 'Available on Android or Apple or Cygwin \ |
| 12 | // or DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD or QNX Neutrino only.' | |
| 12 | // or DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD only.' | |
| 13 | 13 | #[doc(cfg(any( |
| 14 | 14 | target_os = "android", |
| 15 | 15 | target_os = "linux", |
| ... | ... | @@ -17,7 +17,6 @@ |
| 17 | 17 | target_os = "freebsd", |
| 18 | 18 | target_os = "netbsd", |
| 19 | 19 | target_os = "openbsd", |
| 20 | target_os = "nto", | |
| 21 | 20 | target_vendor = "apple", |
| 22 | 21 | target_os = "cygwin" |
| 23 | 22 | )))] |
| ... | ... | @@ -27,7 +26,7 @@ pub fn foo() {} |
| 27 | 26 | // Tests that targets are sorted alphabetically just like explicit `doc(cfg)`. |
| 28 | 27 | //@ has 'foo/fn.bar.html' |
| 29 | 28 | //@ has - '//*[@class="stab portability"]' 'Available on Android or Apple or Cygwin \ |
| 30 | // or DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD or QNX Neutrino only.' | |
| 29 | // or DragonFly BSD or FreeBSD or Linux or NetBSD or OpenBSD only.' | |
| 31 | 30 | #[cfg(any( |
| 32 | 31 | target_os = "android", |
| 33 | 32 | target_os = "linux", |
| ... | ... | @@ -35,7 +34,6 @@ pub fn foo() {} |
| 35 | 34 | target_os = "freebsd", |
| 36 | 35 | target_os = "netbsd", |
| 37 | 36 | target_os = "openbsd", |
| 38 | target_os = "nto", | |
| 39 | 37 | target_vendor = "apple", |
| 40 | 38 | target_os = "cygwin" |
| 41 | 39 | ))] |
tests/ui/attributes/auxiliary/used_pre_main_constructor.rs+1| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | target_os = "linux", |
| 19 | 19 | target_os = "netbsd", |
| 20 | 20 | target_os = "nto", |
| 21 | target_os = "qnx", | |
| 21 | 22 | target_os = "openbsd", |
| 22 | 23 | target_os = "fuchsia", |
| 23 | 24 | target_os = "managarm", |
tests/ui/check-cfg/cfg-crate-features.stderr+1-1| ... | ... | @@ -24,7 +24,7 @@ warning: unexpected `cfg` condition value: `does_not_exist` |
| 24 | 24 | LL | #![cfg(not(target(os = "does_not_exist")))] |
| 25 | 25 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 26 | 26 | | |
| 27 | = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, and `solid_asp3` and 14 more | |
| 27 | = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qnx`, `qurt`, `redox`, `rtems`, and `solaris` and 15 more | |
| 28 | 28 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 29 | 29 | = note: `#[warn(unexpected_cfgs)]` on by default |
| 30 | 30 |
tests/ui/check-cfg/well-known-values.stderr+3-3| ... | ... | @@ -156,7 +156,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 156 | 156 | LL | target_env = "_UNEXPECTED_VALUE", |
| 157 | 157 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 158 | 158 | | |
| 159 | = note: expected values for `target_env` are: ``, `gnu`, `macabi`, `mlibc`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `nto80`, `ohos`, `p1`, `p2`, `p3`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5` | |
| 159 | = note: expected values for `target_env` are: ``, `gnu`, `macabi`, `mlibc`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `ohos`, `p1`, `p2`, `p3`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5` | |
| 160 | 160 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 161 | 161 | |
| 162 | 162 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| ... | ... | @@ -210,7 +210,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| 210 | 210 | LL | target_os = "_UNEXPECTED_VALUE", |
| 211 | 211 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 212 | 212 | | |
| 213 | = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` | |
| 213 | = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qnx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` | |
| 214 | 214 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 215 | 215 | |
| 216 | 216 | warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` |
| ... | ... | @@ -283,7 +283,7 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` |
| 283 | 283 | | | |
| 284 | 284 | | help: there is a expected value with a similar name: `"linux"` |
| 285 | 285 | | |
| 286 | = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` | |
| 286 | = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `helenos`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `lynxos178`, `macos`, `managarm`, `motor`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `qnx`, `qurt`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `vexos`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` | |
| 287 | 287 | = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration |
| 288 | 288 | |
| 289 | 289 | warning: 29 warnings emitted |
tests/ui/intrinsics/intrinsic-alignment.rs+1| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | target_os = "solaris", |
| 17 | 17 | target_os = "vxworks", |
| 18 | 18 | target_os = "nto", |
| 19 | target_os = "qnx", | |
| 19 | 20 | target_vendor = "apple", |
| 20 | 21 | ))] |
| 21 | 22 | mod m { |
tests/ui/process/process-sigpipe.rs+2-2| ... | ... | @@ -31,9 +31,9 @@ fn main() { |
| 31 | 31 | thread::sleep_ms(5000); |
| 32 | 32 | process::exit(1); |
| 33 | 33 | }); |
| 34 | // QNX Neutrino does not have `yes`. Therefore, use `while-echo` for `nto` | |
| 34 | // QNX does not have `yes`. Therefore, use `while-echo` for `nto` | |
| 35 | 35 | // and `yes` for other platforms. |
| 36 | let command = if cfg!(target_os = "nto") { | |
| 36 | let command = if cfg!(any(target_os = "nto", target_os = "qnx")) { | |
| 37 | 37 | "while echo y ; do : ; done | head" |
| 38 | 38 | } else { |
| 39 | 39 | "yes | head" |
tests/ui/structs/rec-align-u64.rs+1| ... | ... | @@ -36,6 +36,7 @@ struct Outer { |
| 36 | 36 | target_os = "solaris", |
| 37 | 37 | target_os = "vxworks", |
| 38 | 38 | target_os = "nto", |
| 39 | target_os = "qnx", | |
| 39 | 40 | target_vendor = "apple", |
| 40 | 41 | ))] |
| 41 | 42 | mod m { |