about summary refs log tree commit diff
path: root/compiler/rustc_target/src
AgeCommit message (Collapse)AuthorLines
2023-07-10aarch64-linux: properly handle 128bit aligned aggregatesErik Desjardins-36/+44
2023-07-10repr(align) <= 4 should still be byvalErik Desjardins-2/+6
2023-07-10move has_repr to layout, handle repr(transparent) properlyErik Desjardins-15/+2
2023-07-10i686-windows: pass arguments with requested alignment > 4 indirectlyErik Desjardins-4/+34
2023-07-10implement vector-containing aggregate alignment for x86 darwinErik Desjardins-31/+51
2023-07-10rustc_target: Add alignment to indirectly-passed by-value types, correcting thePatrick Walton-13/+47
alignment of `byval` on x86 in the process. Commit 88e4d2c2918428d55e34cd57c11279ea839c8822 from five years ago removed support for alignment on indirectly-passed arguments because of problems with the `i686-pc-windows-msvc` target. Unfortunately, the `memcpy` optimizations I recently added to LLVM 16 depend on this to forward `memcpy`s. This commit attempts to fix the problems with `byval` parameters on that target and now correctly adds the `align` attribute. The problem is summarized in [this comment] by @eddyb. Briefly, 32-bit x86 has special alignment rules for `byval` parameters: for the most part, their alignment is forced to 4. This is not well-documented anywhere but in the Clang source. I looked at the logic in Clang `TargetInfo.cpp` and tried to replicate it here. The relevant methods in that file are `X86_32ABIInfo::getIndirectResult()` and `X86_32ABIInfo::getTypeStackAlignInBytes()`. The `align` parameter attribute for `byval` parameters in LLVM must match the platform ABI, or miscompilations will occur. Note that this doesn't use the approach suggested by eddyb, because I felt it was overkill to store the alignment in `on_stack` when special handling is really only needed for 32-bit x86. As a side effect, this should fix #80127, because it will make the `align` parameter attribute for `byval` parameters match the platform ABI on LLVM x86-64. [this comment]: https://github.com/rust-lang/rust/pull/80822#issuecomment-829985417
2023-07-05Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd.Havard Eidnes-0/+20
2023-07-03abi: avoid ice for non-ffi-safe fn ptrsDavid Wood-4/+6
Remove an `unwrap` that assumed FFI-safe types in foreign fn-ptr types. Signed-off-by: David Wood <david.wood@huawei.com>
2023-06-30require `-Zunstable-options` to use new link-self-contained values andRémy Rakic-0/+23
linker flavors - only the stable values for `-Clink-self-contained` can be used on stable until we have more feedback on the interface - `-Zunstable-options` is required to use unstable linker flavors
2023-06-30implement `-C linker-flavor` modern flavorsRémy Rakic-8/+73
2023-06-30add whether `LinkerFlavor` invokes the linker via a C/C++ compilerRémy Rakic-0/+19
2023-06-30add whether `LinkerFlavor` uses `lld`Rémy Rakic-0/+18
2023-06-30Auto merge of #106619 - agausmann:avr-object-file, r=nagisabors-0/+338
Fix unset e_flags in ELF files generated for AVR targets Closes #106576 ~~Sort-of blocked by gimli-rs/object#500~~ (merged) I'm not sure whether the list of AVR CPU names is okay here. Maybe it could be moved out-of-line to improve the readability of the function.
2023-06-26Add x86_64-unknown-linux-ohos targetAmanieu d'Antras-10/+42
This complements the existing `aarch64-unknown-linux-ohos` and `armv7-unknown-linux-ohos` targets.
2023-06-26Rollup merge of #111326 - he32:netbsd-aarch64-be, r=oli-obkMatthias Krüger-0/+18
Add support for NetBSD/aarch64-be (big-endian arm64).
2023-06-22switch to using a target property to control plt defaultAugie Fackler-5/+30
2023-06-21Reorder `tvos_*` functions in apple_base.rs to avoid breaking sorted orderThom Chiovoloni-10/+12
2023-06-21Fix rustc_target::spec::apple::testsThom Chiovoloni-1/+4
2023-06-21Fix the tvOS targets to use the right LLVM target and respect the deployment ↵Thom Chiovoloni-5/+19
target environment variables
2023-06-21Fix busted data_layout (mismatch vs LLVM) in x86_64 tvOS simulator targetThom Chiovoloni-1/+2
2023-06-13loongarch64-none*: Remove environment component from llvm targetWANG Rui-1/+1
2023-06-13Auto merge of #112386 - loongarch-rs:reloc-static, r=eholkbors-6/+4
loongarch64-unknown-none*: Set default relocation model to static This PR sets the default relocation model to `static` for `loongarch64-unknown-none*` targets. This change aims to streamline the development of the bare-metal project by removing the need for the executable program loader to implement relocation.
2023-06-07Auto merge of #111698 - Amanieu:force-static-lib, r=petrochenkovbors-0/+11
Force all native libraries to be statically linked when linking a static binary Previously, `#[link]` without an explicit `kind = "static"` would confuse the linker and end up producing a dynamically linked library because of the `-Bdynamic` flag. However this binary would not work correctly anyways since it was linked with startup code for a static binary. This PR solves this by forcing all native libraries to be statically linked when the output is a static binary that cannot link to dynamic libraries anyways. Fixes #108878 Fixes #102993
2023-06-07Force all native libraries to be statically linked when linking a static binaryAmanieu d'Antras-0/+11
2023-06-07loongarch64-unknown-none*: Set default relocation model to staticWANG Rui-6/+4
2023-06-07Auto merge of #111819 - nikarh:vita-improved, r=Amanieubors-7/+8
Improved std support for ps vita target Fixed a couple of things in std support for ps vita via Vita SDK newlib oss implementation: - Added missing hardware features to target spec - Compile in thumb by default (newlib is also compiled in thumb) - Fixed fs calls. Vita newlib has a not-very-posix dirent. Also vita does not expose inodes, it's stubbed as 0 in stat, and I'm stubbing it here for dirent (because vita newlibs's dirent doesn't even have that field) - Enabled signal handlers for panic unwinding - Dropped static link requirement from the platform support md. Also, rearranged sections to better stick with the template.
2023-06-06Auto merge of #112361 - matthiaskrgr:rollup-39zxrw1, r=matthiaskrgrbors-0/+50
Rollup of 8 pull requests Successful merges: - #111250 (Add Terminator conversion from MIR to SMIR, part #2) - #112310 (Add new Tier-3 targets: `loongarch64-unknown-none*`) - #112334 (Add myself to highfive rotation) - #112340 (remove `TyCtxt::has_error_field` helper method) - #112343 (Prevent emitting `missing_docs` for `pub extern crate`) - #112350 (Avoid duplicate type sanitization of local decls in borrowck) - #112356 (Fix comment for `get_region_var_origins`) - #112358 (Remove default visitor impl in region constraint generation) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-06Add new Tier-3 targets: `loongarch64-unknown-none*`WANG Rui-0/+50
MCP: https://github.com/rust-lang/compiler-team/issues/628
2023-06-05Std support improvement for ps vita targetNikolay Arhipov-7/+8
2023-06-04Added custom risc32-imac for esp-espidf targetVictor Gil-0/+32
2023-06-02Auto merge of #112198 - compiler-errors:rollup-o2xe4of, r=compiler-errorsbors-5/+5
Rollup of 7 pull requests Successful merges: - #111670 (Require that const param tys implement `ConstParamTy`) - #111914 (CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…) - #112030 (Migrate `item_trait_alias` to Askama) - #112150 (Support 128-bit atomics on all x86_64 Apple targets) - #112174 (Fix broken link) - #112190 (Improve comments on `TyCtxt` and `GlobalCtxt`.) - #112193 (Check tuple elements are `Sized` in `offset_of`) Failed merges: - #112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-01Rollup merge of #112174 - cuishuang:master, r=jyn514Michael Goulet-1/+1
Fix broken link The previous link is no longer accessible. Use the latest link.
2023-06-01Rollup merge of #112150 - taiki-e:apple-atomic-128, r=AmanieuMichael Goulet-4/+4
Support 128-bit atomics on all x86_64 Apple targets On x86_64, we currently set `max_atomic_width` to 128 only on macOS. https://github.com/rust-lang/rust/blob/ad8304a0d5280de30856b39c19df7b306957e878/compiler/rustc_target/src/spec/x86_64_apple_darwin.rs#L8 However, other x86_64 Apple targets (iOS, tvOS, and watchOS) are also core2+ and support cmpxchg16b. https://github.com/rust-lang/rust/blob/ad8304a0d5280de30856b39c19df7b306957e878/compiler/rustc_target/src/spec/apple_base.rs#L71-L76 ```console # Script to get targets that support cmpxchg16b by default: $ (for target in $(rustc --print target-list); do [[ $target == "x86_64"* ]] && rustc --print cfg --target "$target" | grep -q cmpxchg16b && echo "$target"; done) x86_64-apple-darwin x86_64-apple-ios x86_64-apple-ios-macabi x86_64-apple-tvos x86_64-apple-watchos-sim x86_64h-apple-darwin ``` r? `@Amanieu`
2023-06-02Fix broken linkcui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-11/+0
2023-05-31Auto merge of #110807 - petrochenkov:strictflavor, r=lqd,wesleywiserbors-18/+93
linker: Report linker flavors incompatible with the current target The linker flavor is checked for target compatibility even if linker is never used (e.g. we are producing a rlib). If it causes trouble, we can move the check to `link.rs` so it will run if the linker (flavor) is actually used. And also feature gate explicitly specifying linker flavors for tier 3 targets. The next step is supporting all the internal linker flavors in user-visible interfaces (command line and json).
2023-06-01Support 128-bit atomics on all x86_64 Apple targetsTaiki Endo-4/+4
2023-05-29linker: Report linker flavors incompatible with the current targetVadim Petrochenkov-2/+20
Previously they would be reported as link time errors about unknown linker options
2023-05-29rustc_target: Refactor linker flavor inferenceVadim Petrochenkov-16/+73
Go through an intermediate pair of `cc`and `lld` hints instead of mapping CLI options to `LinkerFlavor` directly, and use the target's default linker flavor as a reference.
2023-05-29Fix linkage for large binaries on mips64 platforms ...Ximin Luo-2/+2
... by enabling xgot feature Co-Authored-By: Zixing Liu <zixing.liu@canonical.com>
2023-05-28compiler: update solaris and illumos spec to support TSAN.David Carlier-2/+2
2023-05-26Add SafeStack support to rustcWesley Wiser-0/+5
Adds support for LLVM [SafeStack] which provides backward edge control flow protection by separating the stack into two parts: data which is only accessed in provable safe ways is allocated on the normal stack (the "safe stack") and all other data is placed in a separate allocation (the "unsafe stack"). SafeStack support is enabled by passing `-Zsanitizer=safestack`. [SafeStack]: https://clang.llvm.org/docs/SafeStack.html
2023-05-26Rollup merge of #111384 - bmisiak:issue-106021-fix, r=petrochenkovMatthias Krüger-2/+2
Fix linking Mac Catalyst by including LC_BUILD_VERSION in object files Hello. My first rustc PR! Issue #106021 prevents Rust code from being linked into Mac Catalyst applications. Apple's LD has started requiring object files to contain version information about the platform they were built for, such as: * the "deployment target" (minimum supported OS version), * the SDK version * the type of the platform (macOS/iOS/catalyst/tvOS/watchOS all have a different number). This is currently only enforced when building for Mac Catalyst. Rust uses the `object` crate which added support for including this information starting with `0.31.0`. ~~I upgraded it along with `thorin-dwp` so that everything depends on 0.31. Apparently 0.31 [pulls in](https://github.com/gimli-rs/object/issues/463) `ruzstd` due to a [new ELF standard](https://maskray.me/blog/2022-09-09-zstd-compressed-debug-sections) because its `compression` feature is enabled by thorin. If you find this objectionable, let me know what the best way to avoid pulling in those dependencies might be.~~ **(`object` upgraded in https://github.com/rust-lang/rust/pull/111413)** I then added two commits: * The first one adds very basic, hard-coded support for calling `set_macho_build_version` for `-macabi` (Catalyst) targets, where it claims deployment target of Catalyst 14.0 and SDK of 16.2. * The second weaves the versioning through `rust_target::spec::TargetOptions`, so that we can stick to specifying all target-related info in one place. Kudos to ``@ara4n`` for writing [this gist](https://gist.github.com/ara4n/320a53ea768aba51afad4c9ed2168536).
2023-05-25Mac Catalyst: specify 14.0 deployment taregt in llvm_targetBrian M-2/+2
2023-05-25Auto merge of #111933 - matthiaskrgr:rollup-m10k3ts, r=matthiaskrgrbors-1/+1
Rollup of 4 pull requests Successful merges: - #95198 (Add slice::{split_,}{first,last}_chunk{,_mut}) - #109899 (Use apple-m1 as target CPU for aarch64-apple-darwin.) - #111624 (Emit diagnostic for privately uninhabited uncovered witnesses.) - #111875 (Don't leak the function that is called on drop) r? `@ghost` `@rustbot` modify labels: rollup
2023-05-25Rollup merge of #109899 - daxpedda:patch-1, r=jackh726Matthias Krüger-1/+1
Use apple-m1 as target CPU for aarch64-apple-darwin. This updates the target CPU for the `aarch64-apple-darwin` target to `apple-m1`, which is the first generation of CPUs with this target anyway. This wasn't able to be done before because of the minimum supported version of LLVM being 12, now that it was updated to 13 (in fact we are already at 14), this is available. See previous update: https://github.com/rust-lang/rust/pull/90478. See LLVM update: https://github.com/rust-lang/rust/pull/100460.
2023-05-22Enable sanitizers and profiler for aarch64-unknown-linux-muslAlex Gaynor-1/+6
2023-05-21rustc_codegen_ssa: Set e_flags for AVR architecture based on target CPUAdam Gausmann-0/+338
2023-05-12asm: loongarch64: Drop efiapiWANG Rui-2/+2
2023-05-11Rollup merge of #111375 - rcvalle:rust-cfi-fix-106547, r=bjorn3Michael Goulet-4/+4
CFI: Fix SIGILL reached via trait objects Fix #106547 by transforming the concrete self into a reference to a trait object before emitting type metadata identifiers for trait methods.