Commit Graph

686 Commits

Author SHA1 Message Date
Ikko Ashimine
f41576bd3d
Fix typo in apple_base.rs
erronous -> erroneous
2022-12-09 18:09:32 +09:00
Matthias Krüger
4d5a2f3d81
Rollup merge of #105405 - sunfishcode:sunfishcode/export-dynamic, r=TaKO8Ki
Stop passing -export-dynamic to wasm-ld.

-export-dynamic was a temporary hack added in the early days of the Rust wasm32 target when Rust didn't have a way to specify wasm exports in the source code. This flag causes all global symbols, and some compiler-internal symbols, to be exported, which is often more than needed.

Rust now does have a way to specify exports in the source code: `#[export_name = "..."]`.

So as the original comment suggests, -export-dynamic can now be removed, allowing users to have smaller binaries and better encapsulation in their wasm32-unknown-unknown modules.

It's possible that this change will require existing wasm32-unknown-unknown users will to add explicit `#[export_name = "..."]` directives to exporrt the symbols that their programs depend on having exported.
2022-12-08 12:57:30 +01:00
Dan Gohman
3a07aa9b5e Stop passing -export-dynamic to wasm-ld.
-export-dynamic was a temporary hack added in the early days of the Rust
wasm32 target when Rust didn't have a way to specify wasm exports in the
source code. This flag causes all global symbols, and some compiler-internal
symbols, to be exported, which is often more than needed.

Rust now does have a way to specify exports in the source code:
`#[export_name = "..."]`.

So as the original comment suggests, -export-dynamic can now be removed,
allowing users to have smaller binaries and better encapsulation in
their wasm32-unknown-unknown modules.

It's possible that this change will require existing wasm32-unknown-unknown
users will to add explicit `#[export_name = "..."]` directives to
exporrt the symbols that their programs depend on having exported.
2022-12-06 16:50:29 -08:00
Matthias Krüger
7fe9597775
Rollup merge of #105123 - BlackHoleFox:fixing-the-macos-deployment, r=oli-obk
Fix passing MACOSX_DEPLOYMENT_TARGET to the linker

I messed up in https://github.com/rust-lang/rust/pull/103929 when merging the two base files together and as a result, started ignoring `MACOSX_DEPLOYMENT_TARGET` at the linker level. This ended up being the cause of nighty builds not running on older macOS versions.

My original hope with the previous PR was that CI would have caught something like that but there were only tests checking the compiler target definitions in codegen tests. Because of how badly this sucks to break, I put together a new test via `run-make` that actually confirms the deployment target set makes it to the linker instead of just LLVM.

Closes https://github.com/rust-lang/rust/issues/104570 (for real this time)
2022-12-04 11:38:51 +01:00
Matthias Krüger
1a2f79b82c
Rollup merge of #105050 - WaffleLapkin:uselessrefign, r=jyn514
Remove useless borrows and derefs

They are nothing more than noise.
<sub>These are not all of them, but my clippy started crashing (stack overflow), so rip :(</sub>
2022-12-03 17:37:42 +01:00
BlackHoleFox
56592d310f Fix passing MACOSX_DEPLOYMENT_TARGET to the linker 2022-12-02 18:12:16 -06:00
Maybe Waffle
f2b97a8bfe Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
hkalbasi
56126fb149 Extract llvm datalayout parsing out of spec module 2022-11-30 21:13:54 +03:30
Matthias Krüger
3e9a2233d0
Rollup merge of #104523 - flba-eb:fix_nto_target_name, r=wesleywiser
Don't use periods in target names

Using a period in the target name can cause issues in e.g. cargo, see also https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Running.20tests.20on.20remote.20target
2022-11-29 22:43:17 +01:00
Maybe Waffle
1d42936b18 Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
hkalbasi
390a637e29 move things from rustc_target::abi to rustc_abi 2022-11-24 16:26:13 +03:30
hkalbasi
27fb904d68 move some layout logic to rustc_target::abi::layout 2022-11-24 16:26:12 +03:30
hkalbasi
09a384643e make rustc_target usable outside of rustc 2022-11-24 16:26:12 +03:30
Yuki Okushi
b162bb4270
Rollup merge of #102293 - ecnelises:aix.initial, r=davidtwco
Add powerpc64-ibm-aix as Tier-3 target

This is part of the effort mentioned in https://github.com/rust-lang/compiler-team/issues/553.

A reference to these options are definitions from [clang](ad6fe32032/clang/lib/Basic/Targets/PPC.h (L414-L448)) and [llvm](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp).

AIX has a system `ld` but [its options and behaviors](https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command) are different from GNU ld. Thanks to ``@bzEq`` for contributing the linking args.
2022-11-23 06:40:22 +09:00
Dylan DPC
aeeac5dd0c
Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3
Improve generating Custom entry function

This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316.

Currently, this moves the entry function name and Call convention to the target spec.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-19 11:54:43 +05:30
bors
83356b78c4 Auto merge of #104361 - vladimir-ea:watchos_fix_linking, r=oli-obk
[watchos] Dynamic linking is not allowed for watchos targets

Dynamic linking of all apple targets was (re-) enabled in PR #100636. However, dynamic linking is not allowed on WatchOS so this broke the build of standard library for WatchOS.

This change disables dynamic linking for WatchOS non-simulator targets.
2022-11-17 17:15:31 +00:00
Florian Bartels
9c3555d5c2 Remove periods from QNX/nto target names 2022-11-17 11:25:28 +01:00
Qiu Chaofan
aef3d938e4 Add powerpc64-ibm-aix as Tier-3 target 2022-11-17 16:36:54 +08:00
Matthias Krüger
fbcd751ea1
Rollup merge of #104137 - StackDoubleFlow:err-lsc-unsupported, r=bjorn3
Issue error when -C link-self-contained option is used on unsupported platforms

The documentation was also updated to reflect this.

I'm assuming the supported platforms are the same as initially written in [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md#compiler-17).

Fixes #103576
2022-11-16 15:39:45 +01:00
StackDoubleFlow
0b6dce4309
Issue error when -C link-self-contained option is used on unsupported platforms
Document supported targets for `-C link-self-contained`

Move `LinkSelfContainedDefault::True` from wasm_base to wasm32_wasi
2022-11-14 22:21:24 -06:00
Matthias Krüger
5763fa74f0
Rollup merge of #104349 - rustaceanclub:master, r=oli-obk
fix some typos in comments
2022-11-14 19:26:18 +01:00
Matthias Krüger
8076b5903a
Rollup merge of #104357 - RalfJung:is-sized, r=cjgillot
add is_sized method on Abi and Layout, and use it

This avoids the double negation of `!is_unsized()` that we have quite a lot.
2022-11-13 17:37:38 +01:00
Vladimir Michael Eatwell
db99a89e38 [watchos] Dynamic linking is not allowed for watchos targets 2022-11-13 13:57:31 +00:00
Ralf Jung
c78021709a add is_sized method on Abi and Layout, and use it 2022-11-13 12:23:53 +01:00
cui fliter
442f848d74 fix some typos in comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-11-13 15:26:17 +08:00
Florian Bartels
84e1fbcadf Add no_std AArch64 support for the QNX Neutrino (nto) 7.1 RTOS
This change allows to compile no_std applications for the QNX Neutrino
realtime operating system for ARM 64 bit CPUs.
Tested with QNX Neutrino 7.1.
2022-11-11 10:44:48 +01:00
Ayush Singh
9f0a8620bd
Improve generating Custom entry function
This commit is aimed at making compiler generated entry functions
(Basically just C `main` right now) more generic so other targets can do
similar things for custom entry. This was initially implemented as part
of https://github.com/rust-lang/rust/pull/100316.

Currently, this moves the entry function name and Call convention to the
target spec.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-11 01:04:39 +05:30
Manish Goregaokar
8f2c1f8469
Rollup merge of #104077 - nicholasbishop:bishop-uefi-aapcs, r=nagisa
Use aapcs for efiapi calling convention on arm

On arm, [llvm treats the C calling convention as `aapcs` on soft-float targets and `aapcs-vfp` on hard-float targets](https://github.com/rust-lang/compiler-builtins/issues/116#issuecomment-261057422). UEFI specifies in the arm calling convention that [floating point extensions aren't used](https://uefi.org/specs/UEFI/2.10/02_Overview.html#detailed-calling-convention), so always translate `efiapi` to `aapcs` on arm.

https://github.com/rust-lang/rust/issues/65815
2022-11-10 10:47:39 -05:00
Manish Goregaokar
a7cd4f2edf
Rollup merge of #101939 - zhaixiaojuan:loongarch64-abi, r=oli-obk
Add loongarch64 abi support
2022-11-10 10:47:36 -05:00
Manish Goregaokar
bfd637a3cf
Rollup merge of #104020 - nicholasbishop:bishop-limit-efiapi, r=nagisa
Limit efiapi calling convention to supported arches

Supported architectures in UEFI are described here:
https://uefi.org/specs/UEFI/2.10/02_Overview.html#calling-conventions

https://github.com/rust-lang/rust/issues/65815
2022-11-09 15:39:05 -05:00
Manish Goregaokar
67c0bff934
Rollup merge of #104015 - alex:remove-kernel, r=oli-obk
Remove linuxkernel targets

These are not used by the actual Rust-for-Linux project, so they're mostly just confusing.
2022-11-09 15:39:05 -05:00
Manish Goregaokar
017c9aa4a0
Rollup merge of #103929 - BlackHoleFox:apple-targets-cleanup, r=petrochenkov
Cleanup Apple-related code in rustc_target

While working on https://github.com/rust-lang/rust/pull/103455, the consistency of the `rustc_target` code for Apple's platforms was "kind of bad." There were two "base" files (`apple_base.rs` and `apple_sdk_base.rs`) that the targets each pulled some parts out of, each and all of them were written slightly differently, and sometimes missed comments other implementations had.

So to hopefully make future maintenance, like implementing https://github.com/rust-lang/compiler-team/issues/556, easier, this makes all of them use similar patterns and the same target base logic everywhere instead of picking bits from both. This also has some other smaller upsides like less stringly-typed functions.
2022-11-09 15:39:04 -05:00
Dylan DPC
2b9e099a83
Rollup merge of #104067 - jeremyd2019:patch-1, r=davidtwco
fix debuginfo for windows_gnullvm_base.rs

These lines (including the FIXME comment) were added to windows_gnu_base.rs in cf2c492ef8 but windows_gnullvm_base.rs was not updated.  This resulted in an error `LLVM ERROR: dwo only supported with ELF and Wasm` attempting to build on aarch64-pc-windows-gnullvm.

See also https://github.com/msys2/MINGW-packages/pull/13921#issuecomment-1304391707

/cc ```@mati865``` ```@davidtwco```

r? ```@davidtwco```
2022-11-08 11:23:53 +05:30
jeremyd2019
6994651b6c fix debuginfo for windows_gnullvm_base.rs
These lines (including the FIXME comment) were added to windows_gnu_base.rs in cf2c492ef8 but windows_gnullvm_base.rs was not updated.  This resulted in an error `LLVM ERROR: dwo only supported with ELF and Wasm` attempting to build on aarch64-pc-windows-gnullvm.

Signed-off-by: Jeremy Drake <github@jdrake.com>
2022-11-06 17:29:14 -08:00
Nicholas Bishop
42cbb40157 Use aapcs for efiapi calling convention on arm
On arm, llvm treats the C calling convention as `aapcs` on soft-float
targets and `aapcs-vfp` on hard-float targets [1]. UEFI specifies in the
arm calling convention that floating point extensions aren't used [2],
so always translate `efiapi` to `aapcs` on arm.

[1]: https://github.com/rust-lang/compiler-builtins/issues/116#issuecomment-261057422
[2]: https://uefi.org/specs/UEFI/2.10/02_Overview.html#detailed-calling-convention

https://github.com/rust-lang/rust/issues/65815
2022-11-06 18:05:24 -05:00
Nicholas Bishop
16edaa56ba Limit efiapi calling convention to supported arches
Supported architectures in UEFI are described here:
https://uefi.org/specs/UEFI/2.10/02_Overview.html#calling-conventions

Changes to tests modeled on 8240e7aa10.

https://github.com/rust-lang/rust/issues/65815
2022-11-06 17:04:42 -05:00
Tim Neumann
f414715ebf LLVM 16: Update RISCV data layout 2022-11-06 19:03:22 +00:00
BlackHoleFox
ae948c6380 Cleanup Apple target specifications 2022-11-05 17:57:32 -05:00
BlackHoleFox
de0ab1cee6 Merge apple_base and apple_sdk_base into one module 2022-11-05 17:56:21 -05:00
Alex Gaynor
c33ee13391
Remove linuxkernel targets
These are not used by the actual Rust-for-Linux project, so they're mostly just confusing.
2022-11-05 12:30:28 -04:00
bors
ce1a7e41f9 Auto merge of #103455 - BlackHoleFox:apple-sim-abi-consistency, r=davidtwco
Fixed consistency of Apple simulator target's ABI

Currently there's a few Apple device simulator targets that are inconsistent since some set `target_abi = "sim"` (the correct thing to do) while a bunch of others don't set anything (`""`). Due to this its very hard to reliability check if some Rust code is running inside a simulator. This changes all of them to do the same thing and set `sim` as their `target_abi`.

The new way to identity a simulator during compilation is as simple as `cfg(all(target_vendor="apple", target_abi = "sim"))` or even `cfg(target_abi = "sim")` being less pedantic about it.

The issues with the current form (and inspiration for this) are also summarized in `@thomcc's` [Tweet](https://twitter.com/at_tcsc/status/1576685244702691328).
2022-11-03 03:07:31 +00:00
Michael Howell
16ca46297b
Rollup merge of #102689 - ayrtonm:master, r=cjgillot
Add a tier 3 target for the Sony PlayStation 1

This adds a tier 3 target, `mipsel-sony-psx`, for the Sony PlayStation 1. I've tested it pretty thoroughly with [this SDK](https://github.com/ayrtonm/psx-sdk-rs) I wrote for it.

From the [tier 3 target policy](https://doc.rust-lang.org/rustc/target-tier-policy.html#tier-3-target-policy) (I've omitted the subpoints for brevity, but read over everything)
> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I'd be the designated developer

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

The target name follows the conventions of the existing PSP target (`mipsel-sony-psp`) and uses `psx` following the convention of the broader [PlayStation homebrew community](https://psx-spx.consoledev.net/).

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

No legal issues with this target.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

👍

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

The psx supports `core` and `alloc`, but will likely not support `std` anytime soon.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

This target has an SDK and a `cargo-psx` tool for formatting binaries as psx executables. Documentation and examples are provided in the [psx-sdk-rs README](https://github.com/ayrtonm/psx-sdk-rs#psx-sdk-rs), the SDK and cargo tool are both available through crates.io and docs.rs has [SDK documentation](https://docs.rs/psx/latest/psx/).

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

👍

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

No problem
2022-10-30 19:31:38 -07:00
Soveu
ba847cad6d Enable varargs support for calling conventions other than C or cdecl
This patch makes it possible to use varargs for calling conventions,
which are either based on C (like efiapi) or C is based
on them (for example sysv64 and win64).
2022-10-23 18:46:16 -04:00
BlackHoleFox
ffccfa1eed Fix x86_64-apple-watchos-sim target to use the correct target_abi 2022-10-23 16:39:30 -05:00
BlackHoleFox
d2a3784780 Fix x86_64-apple-tvos target to use the correct target_abi 2022-10-23 15:46:43 -05:00
BlackHoleFox
79eedef984 Fix x86_64-apple-ios target to use the correct target_abi 2022-10-23 15:44:58 -05:00
Mara Bos
e60016eb55 Split is_stable from rustc_target::spec::abi::is_enabled. 2022-10-19 12:41:11 +02:00
Rageking8
7122abaddf more dupe word typos 2022-10-14 12:57:56 +08:00
Yuki Okushi
f4c9580c65
Rollup merge of #102836 - petrochenkov:jsonspec, r=eholk
rustc_target: Fix json target specs using LLD linker flavors in link args

Fixes https://github.com/rust-lang/rust/pull/101988#issuecomment-1272407248 (a regression introduced by https://github.com/rust-lang/rust/pull/101988).
2022-10-13 09:41:25 +09:00
Nilstrieb
7bfef19844 Use tidy-alphabetical in the compiler 2022-10-12 17:49:10 +05:30